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: Simplify the setting of global property. Add more tests. Created June 12, 2015, 7:33 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
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(std::string name, AdblockPlus::JsValuePtr value)
Felix Dahlke 2015/06/12 08:04:20 Nit: 80 columns please.
Oleksandr 2015/06/12 10:47:57 Done.
+{
+ if (!globalJsObject)
+ throw std::runtime_error("Global object cannot be null");
+
+ globalJsObject->SetProperty(name, value);
+
+}

Powered by Google App Engine
This is Rietveld