Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: src/JsValue.cpp

Issue 29734562: Issue 6526 - update usage of V8 API (Closed) Base URL: https://github.com/adblockplus/libadblockplus@18cc8b26874862bdc75c1cce28bd7b490066c659
Patch Set: Created March 27, 2018, 11:37 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/JsEngine.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * This file is part of Adblock Plus <https://adblockplus.org/>, 2 * This file is part of Adblock Plus <https://adblockplus.org/>,
3 * Copyright (C) 2006-present eyeo GmbH 3 * Copyright (C) 2006-present eyeo GmbH
4 * 4 *
5 * Adblock Plus is free software: you can redistribute it and/or modify 5 * Adblock Plus is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 3 as 6 * it under the terms of the GNU General Public License version 3 as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
8 * 8 *
9 * Adblock Plus is distributed in the hope that it will be useful, 9 * Adblock Plus is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after
277 277
278 JsValue JsValue::Call(std::vector<v8::Handle<v8::Value>>& args, v8::Local<v8::Ob ject> thisObj) const 278 JsValue JsValue::Call(std::vector<v8::Handle<v8::Value>>& args, v8::Local<v8::Ob ject> thisObj) const
279 { 279 {
280 if (!IsFunction()) 280 if (!IsFunction())
281 throw std::runtime_error("Attempting to call a non-function"); 281 throw std::runtime_error("Attempting to call a non-function");
282 if (!thisObj->IsObject()) 282 if (!thisObj->IsObject())
283 throw std::runtime_error("`this` pointer has to be an object"); 283 throw std::runtime_error("`this` pointer has to be an object");
284 284
285 const JsContext context(*jsEngine); 285 const JsContext context(*jsEngine);
286 286
287 const v8::TryCatch tryCatch; 287 const v8::TryCatch tryCatch(jsEngine->GetIsolate());
288 v8::Local<v8::Function> func = v8::Local<v8::Function>::Cast(UnwrapValue()); 288 v8::Local<v8::Function> func = v8::Local<v8::Function>::Cast(UnwrapValue());
289 v8::Local<v8::Value> result = func->Call(thisObj, args.size(), 289 v8::Local<v8::Value> result = func->Call(thisObj, args.size(),
290 args.size() ? &args[0] : nullptr); 290 args.size() ? &args[0] : nullptr);
291 291
292 if (tryCatch.HasCaught()) 292 if (tryCatch.HasCaught())
293 throw JsError(tryCatch.Exception(), tryCatch.Message()); 293 throw JsError(tryCatch.Exception(), tryCatch.Message());
294 294
295 return JsValue(jsEngine, result); 295 return JsValue(jsEngine, result);
296 } 296 }
OLDNEW
« no previous file with comments | « src/JsEngine.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld