Index: lib/prefs.js |
=================================================================== |
--- a/lib/prefs.js |
+++ b/lib/prefs.js |
@@ -41,10 +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 values = Object.create(defaults); |
+let preconfigurable = ["suppress_first_run_page", "disable_auto_updates"]; |
sergei
2015/06/19 10:07:16
I saw the comment that `preconfigurable` is an arr
Felix Dahlke
2015/06/22 07:33:58
You mean splitting up defaults into two objects, p
Oleksandr
2015/06/22 07:47:10
I don't think this is a code duplication, really.
sergei
2015/06/22 09:10:49
Let me break the original quotes to comment them a
Eric
2015/06/25 17:44:40
It is bad practice not to specify default values f
|
+ |
+let values; |
let path = _fileSystem.resolve("prefs.json"); |
let listeners = []; |
let isDirty = false; |
@@ -131,7 +135,16 @@ |
}, |
}; |
+// Update the default prefs with what was preconfigured |
+for (let key in _preconfiguredPrefs) |
+ if (preconfigurable.indexOf(key) != -1) |
+ defaults[key] = _preconfiguredPrefs[key]; |
+ |
+// Define defaults |
for (let key in defaults) |
defineProperty(key); |
+// Set values of prefs based on defaults |
+values = Object.create(defaults); |
+ |
load(); |