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

Unified Diff: src/WebRequestJsObject.cpp

Issue 10305024: Simplify context setup, set properties on the global object directly instead of using templates (Closed)
Patch Set: Unbitrotted patch Created April 18, 2013, 11:44 a.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
« src/GlobalJsObject.cpp ('K') | « src/WebRequestJsObject.h ('k') | no next file » | 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
@@ -84,19 +84,14 @@ namespace
{
return v8::ThrowException(v8::String::New(e.what()));
}
thread->Start();
return v8::Undefined();
}
}
-v8::Handle<v8::ObjectTemplate> AdblockPlus::WebRequestJsObject::Create(
- AdblockPlus::JsEngine& jsEngine)
+AdblockPlus::JsValuePtr AdblockPlus::WebRequestJsObject::Setup(
+ AdblockPlus::JsEngine& jsEngine, AdblockPlus::JsValuePtr obj)
{
- v8::HandleScope handleScope;
- const v8::Handle<v8::ObjectTemplate> request = v8::ObjectTemplate::New();
- const v8::Handle<v8::FunctionTemplate> getFunction =
- v8::FunctionTemplate::New(::GETCallback,
- v8::External::New(&jsEngine));
- request->Set(v8::String::New("GET"), getFunction);
- return handleScope.Close(request);
+ obj->SetProperty("GET", jsEngine.NewCallback(::GETCallback));
+ return obj;
}
« src/GlobalJsObject.cpp ('K') | « src/WebRequestJsObject.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld