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

Unified Diff: lib/prefs.js

Issue 5653480979038208: Issue 2325 - Add a way to set settings in libadblockplus for FRP and automatic updates (Closed)
Patch Set: Added a unit test. Changed the global object injection routine. Created June 10, 2015, 8:42 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: lib/prefs.js
===================================================================
--- a/lib/prefs.js
+++ b/lib/prefs.js
@@ -41,7 +41,14 @@
update_hard_expiration: 0,
currentVersion: "0.0",
notificationdata: {},
- notificationurl: "https://notification.adblockplus.org/notification.json"
+ notificationurl: "https://notification.adblockplus.org/notification.json",
+ suppress_first_run_page: false,
+ disable_auto_updates: false
+};
+
+let isPreconfigurable = {
Felix Dahlke 2015/06/11 20:21:13 I'd prefer this to work the same way as in Firefox
Oleksandr 2015/06/12 10:47:57 Done.
+ suppress_first_run_page: true,
+ disable_auto_updates: true
};
let values = Object.create(defaults);
@@ -75,6 +82,15 @@
function load()
{
+ // Set default prefs based on _preconfiguredPrefs
+ for (let key in _preconfiguredPrefs)
+ {
+ if (isPreconfigurable[key])
+ {
+ values[key] = _preconfiguredPrefs[key];
Eric 2015/06/10 17:48:16 Shouldn't this first check to see if there is a pr
Felix Dahlke 2015/06/11 20:21:13 Yes, should be: `if (key in _preconfiguredPrefs &&
Oleksandr 2015/06/12 07:36:14 Hm, am I missing something? I don't see why would
Felix Dahlke 2015/06/12 07:55:03 Yes you're right, guess me and Eric both missed th
+ }
+ }
+
_fileSystem.read(path, function(result)
{
// prefs.json is expected to be missing, ignore errors reading file

Powered by Google App Engine
This is Rietveld