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

Unified Diff: src/FilterEngine.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 | « lib/updater.js ('k') | src/JsEngine.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/FilterEngine.cpp
===================================================================
--- a/src/FilterEngine.cpp
+++ b/src/FilterEngine.cpp
@@ -134,7 +134,8 @@
return GetProperty("url")->AsString() == subscription.GetProperty("url")->AsString();
}
-FilterEngine::FilterEngine(JsEnginePtr jsEngine)
+FilterEngine::FilterEngine(JsEnginePtr jsEngine,
+ const FilterEngine::Prefs& preconfiguredPrefs)
: jsEngine(jsEngine), initialized(false), firstRun(false), updateCheckId(0)
{
jsEngine->SetEventCallback("_init", std::tr1::bind(&FilterEngine::InitDone,
@@ -144,6 +145,16 @@
// Lock the JS engine while we are loading scripts, no timeouts should fire
// until we are done.
const JsContext context(jsEngine);
+
+ // Set the preconfigured prefs
+ JsValuePtr preconfiguredPrefsObject = jsEngine->NewObject();
+ for (FilterEngine::Prefs::const_iterator it = preconfiguredPrefs.begin();
+ it != preconfiguredPrefs.end(); it++)
+ {
+ preconfiguredPrefsObject->SetProperty(it->first, it->second);
+ }
+ jsEngine->SetGlobalProperty("_preconfiguredPrefs", preconfiguredPrefsObject);
+ // Load adblockplus scripts
for (int i = 0; !jsSources[i].empty(); i += 2)
jsEngine->Evaluate(jsSources[i + 1], jsSources[i]);
}
« no previous file with comments | « lib/updater.js ('k') | src/JsEngine.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld