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

Unified Diff: src/WebRequestJsObject.cpp

Issue 4949583905947648: Issue 1280 - Update v8, the second part (Closed)
Patch Set: Created Oct. 27, 2014, 10:01 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/JsValue.cpp ('k') | test/ConsoleJsObject.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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();
}
}
« no previous file with comments | « src/JsValue.cpp ('k') | test/ConsoleJsObject.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld