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.
This commit is contained in:
Dan Stillman 2017-07-12 01:20:55 -04:00
parent a7021f80ca
commit a62161dfc1

View file

@ -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;