[Pkg-mozext-commits] [adblock-plus] 02/17: Issue 1489 - Support preconfigured defaults
David Prévot
taffit at moszumanska.debian.org
Mon Jun 8 20:50:30 UTC 2015
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch master
in repository adblock-plus.
commit dcae991143b58283b9ee9b1a80df4f5b3aaa21b2
Author: Felix Dahlke <felix at adblockplus.org>
Date: Thu Mar 19 23:14:06 2015 +0100
Issue 1489 - Support preconfigured defaults
---
lib/prefs.js | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/lib/prefs.js b/lib/prefs.js
index ab1cc5c..2cf4015 100644
--- a/lib/prefs.js
+++ b/lib/prefs.js
@@ -8,6 +8,8 @@ Cu.import("resource://gre/modules/XPCOMUtils.jsm");
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 @@ function init()
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,14 @@ function init()
pref = pref.substr(branchName.length);
let [getter, setter] = typeMap[typeof value];
+ if (preconfigurable)
+ {
+ try
+ {
+ value = getter(preconfiguredBranch, pref);
+ }
+ catch (e) {}
+ }
setter(defaultBranch, pref, value);
defineProperty(pref, false, getter, setter);
}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/adblock-plus.git
More information about the Pkg-mozext-commits
mailing list