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

Unified Diff: src/JsEngine.cpp

Issue 5653480979038208: Issue 2325 - Add a way to set settings in libadblockplus for FRP and automatic updates (Closed)
Patch Set: Address more comments Created June 22, 2015, 7:45 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
« no previous file with comments | « src/FilterEngine.cpp ('k') | test/JsEngine.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/JsEngine.cpp
===================================================================
--- a/src/JsEngine.cpp
+++ b/src/JsEngine.cpp
@@ -79,10 +79,12 @@
const v8::HandleScope handleScope;
result->context.reset(result->isolate, v8::Context::New(result->isolate));
+
v8::Local<v8::Object> globalContext = v8::Local<v8::Context>::New(
result->isolate, result->context)->Global();
- AdblockPlus::GlobalJsObject::Setup(result, appInfo,
- JsValuePtr(new JsValue(result, globalContext)));
+ result->globalJsObject = JsValuePtr(new JsValue(result, globalContext));
+
+ AdblockPlus::GlobalJsObject::Setup(result, appInfo, result->globalJsObject);
return result;
}
@@ -227,3 +229,13 @@
logSystem = val;
}
+
+
+void AdblockPlus::JsEngine::SetGlobalProperty(const std::string& name,
+ AdblockPlus::JsValuePtr value)
+{
+ if (!globalJsObject)
+ throw std::runtime_error("Global object cannot be null");
+
+ globalJsObject->SetProperty(name, value);
+}
« no previous file with comments | « src/FilterEngine.cpp ('k') | test/JsEngine.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld