From e9b287c83c241fa38fa394cac057622139c0491e Mon Sep 17 00:00:00 2001 From: Kris Maglione Date: Thu, 1 Dec 2011 14:29:53 -0500 Subject: [PATCH] Fix useragent.js bug. --- common/modules/commands.jsm | 2 +- common/modules/prefs.jsm | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/common/modules/commands.jsm b/common/modules/commands.jsm index 2fdfe780..eca375bf 100644 --- a/common/modules/commands.jsm +++ b/common/modules/commands.jsm @@ -1483,7 +1483,7 @@ var Commands = Module("commands", { let start = "«%-d-]'", end = "'[-d-%»"; - let n = /^\d+$/.test(cmd.argCount) ? parseInt(argCount) : 12; + let n = /^\d+$/.test(cmd.argCount) ? parseInt(cmd.argCount) : 12; for (let i = args.completeArg; i < n; i++) args[i] = start + i + end; diff --git a/common/modules/prefs.jsm b/common/modules/prefs.jsm index 202fe1d5..f8e7e403 100644 --- a/common/modules/prefs.jsm +++ b/common/modules/prefs.jsm @@ -199,10 +199,18 @@ var Prefs = Module("prefs", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]) */ getNames: function getNames(branch) this.branch.getChildList(branch || "", { value: 0 }), + /** + * Returns true if the current branch has the given preference. + * + * @param {string} name The preference name. + * @returns {boolean} + */ + has: function get(name) this.branch.getPrefType(name) != 0, + _checkSafe: function _checkSafe(name, message, value) { let curval = this.get(name, null); - if (this.branches.original.get(name) == null) + if (this.branches.original.get(name) == null && !this.branches.saved.has(name)) this.branches.original.set(name, curval, true); if (arguments.length > 2 && curval === value)