Index: lib/prefs.js |
=================================================================== |
--- a/lib/prefs.js |
+++ b/lib/prefs.js |
@@ -26,7 +26,9 @@ |
pref = pref.substr(branchName.length); |
let [getter, setter] = typeMap[typeof value]; |
- setter(defaultBranch, pref, value); |
+ if (!hasPreconfiguredDefault(branch, pref)) |
+ setter(defaultBranch, pref, value); |
+ |
defineProperty(pref, false, getter, setter); |
} |
}; |
@@ -45,6 +47,22 @@ |
} |
/** |
+ * Checks whether the supplied pref has a preconfigured default value. |
+ */ |
+function hasPreconfiguredDefault(branch, pref) |
+{ |
+ try |
+ { |
+ let defaults = getJSONPref(branch, "preconfigured_defaults"); |
+ return defaults.indexOf(pref) != -1; |
+ } |
+ catch (e) |
+ { |
+ return false; |
+ } |
+} |
+ |
+/** |
* Sets up getter/setter on Prefs object for preference. |
*/ |
function defineProperty(/**String*/ name, defaultValue, /**Function*/ readFunc, /**Function*/ writeFunc) |