Index: lib/prefs.js |
=================================================================== |
--- a/lib/prefs.js |
+++ b/lib/prefs.js |
@@ -8,6 +8,8 @@ |
let {addonRoot, addonName} = require("info"); |
let branchName = "extensions." + addonName + "."; |
let branch = Services.prefs.getBranch(branchName); |
+let preconfiguredBranch = |
+ Services.prefs.getBranch(branchName + "preconfigured."); |
let ignorePrefChanges = false; |
function init() |
@@ -16,7 +18,7 @@ |
let defaultBranch = Services.prefs.getDefaultBranch(branchName); |
let scope = |
{ |
- pref: function(pref, value) |
+ pref: function(pref, value, preconfigurable) |
{ |
if (pref.substr(0, branchName.length) != branchName) |
{ |
@@ -26,6 +28,12 @@ |
pref = pref.substr(branchName.length); |
let [getter, setter] = typeMap[typeof value]; |
+ if (preconfigurable) |
+ try |
+ { |
+ value = getter(preconfiguredBranch, pref); |
+ } |
+ catch (e) {} |
Wladimir Palant
2015/04/28 21:25:19
Nit: Please put brackets around this block.
Felix Dahlke
2015/04/28 21:28:32
Done.
|
setter(defaultBranch, pref, value); |
defineProperty(pref, false, getter, setter); |
} |