Index: lib/prefs.js |
=================================================================== |
--- a/lib/prefs.js |
+++ b/lib/prefs.js |
@@ -41,9 +41,13 @@ |
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 preconfigurable = ["suppress_first_run_page", "disable_auto_updates"]; |
+ |
let values = Object.create(defaults); |
let path = _fileSystem.resolve("prefs.json"); |
let listeners = []; |
@@ -75,6 +79,18 @@ |
function load() |
{ |
+ // Set default prefs based on _preconfiguredPrefs |
+ for (let key in _preconfiguredPrefs) |
+ { |
+ if (preconfigurable.indexOf(key) != -1) |
+ { |
+ if (typeof _preconfiguredPrefs[key] != typeof defaults[key]) |
Felix Dahlke
2015/06/12 11:55:35
Don't think we need to check for this - we don't d
Oleksandr
2015/06/12 12:29:59
Done.
|
+ throw new Error("Attempt to change preference type through preconfiguration"); |
+ defaults[key] = _preconfiguredPrefs[key]; |
Felix Dahlke
2015/06/12 11:55:35
Was about to complain that this isn't necessary, b
Oleksandr
2015/06/12 12:29:59
Done.
|
+ values[key] = _preconfiguredPrefs[key]; |
+ } |
+ } |
+ |
_fileSystem.read(path, function(result) |
{ |
// prefs.json is expected to be missing, ignore errors reading file |