| Index: src/WebRequestJsObject.cpp |
| =================================================================== |
| --- a/src/WebRequestJsObject.cpp |
| +++ b/src/WebRequestJsObject.cpp |
| @@ -22,6 +22,7 @@ |
| #include "JsContext.h" |
| #include "Thread.h" |
| #include "WebRequestJsObject.h" |
| +#include "Utils.h" |
| namespace |
| { |
| @@ -59,7 +60,7 @@ |
| { |
| AdblockPlus::ServerResponse result = jsEngine->GetWebRequest()->GET(url, headers); |
| - AdblockPlus::JsContext context(jsEngine); |
| + AdblockPlus::JsContext context{*jsEngine}; |
| AdblockPlus::JsValuePtr resultObject = jsEngine->NewObject(); |
| resultObject->SetProperty("status", result.status); |
| @@ -87,23 +88,22 @@ |
| AdblockPlus::JsValuePtr callback; |
| }; |
| - v8::Handle<v8::Value> GETCallback(const v8::Arguments& arguments) |
| + void GETCallback(const v8::FunctionCallbackInfo<v8::Value>& info) |
| { |
| - WebRequestThread* thread; |
| + auto isolate = info.GetIsolate(); |
| try |
| { |
| - AdblockPlus::JsEnginePtr jsEngine = AdblockPlus::JsEngine::FromArguments(arguments); |
| - AdblockPlus::JsValueList converted = jsEngine->ConvertArguments(arguments); |
| + AdblockPlus::JsEnginePtr jsEngine = AdblockPlus::JsEngine::FromArguments(info); |
| + AdblockPlus::JsValueList converted = jsEngine->ConvertArguments(info); |
| if (converted.size() != 3u) |
| throw std::runtime_error("GET requires exactly 3 arguments"); |
| - thread = new WebRequestThread(jsEngine, converted); |
| + WebRequestThread* thread = new WebRequestThread(jsEngine, converted); |
| + thread->Start(); |
| } |
| catch (const std::exception& e) |
| { |
| - return v8::ThrowException(v8::String::New(e.what())); |
| + isolate->ThrowException(AdblockPlus::Utils::ToV8String(isolate, e.what())); |
| } |
| - thread->Start(); |
| - return v8::Undefined(); |
| } |
| } |