commit a62161dfc15cc065fada50cd1d777d8056053892 parent a7021f80cac10d9cf8c51f5f85ed0d129f268515 Author: Dan Stillman <dstillman@zotero.org> Date: Wed, 12 Jul 2017 01:20:55 -0400 Add unused Zotero.Prefs.resetBranch() I wrote this for account unlinking (since nsIPrefBranch.resetBranch() isn't implemented) but decided we didn't want to delete all prefs for that. Diffstat:
| M | chrome/content/zotero/xpcom/zotero.js | | | 14 | ++++++++++++++ |
1 file changed, 14 insertions(+), 0 deletions(-)
diff --git a/chrome/content/zotero/xpcom/zotero.js b/chrome/content/zotero/xpcom/zotero.js @@ -2106,6 +2106,20 @@ Zotero.Prefs = new function(){ } + this.resetBranch = function (exclude = []) { + var keys = this.prefBranch.getChildList("", {}); + for (let key of keys) { + if (this.prefBranch.prefHasUserValue(key)) { + if (exclude.includes(key)) { + continue; + } + Zotero.debug("Clearing " + key); + this.prefBranch.clearUserPref(key); + } + } + }; + + // Import settings bundles this.importSettings = function (str, uri) { var ps = Services.prompt;