Bug 1476030 - Part 3 - Migrate callers from document.persist to xulStore.persist;r=Gijs
MozReview-Commit-ID: JmlIDK9A8dv
--- a/browser/base/content/browser-sidebar.js
+++ b/browser/base/content/browser-sidebar.js
@@ -70,32 +70,32 @@ var SidebarUI = {
this._inited = true;
},
uninit() {
// If this is the last browser window, persist various values that should be
// remembered for after a restart / reopening a browser window.
let enumerator = Services.wm.getEnumerator("navigator:browser");
if (!enumerator.hasMoreElements()) {
- document.persist("sidebar-box", "sidebarcommand");
+ let xulStore = Services.xulStore;
+ xulStore.persist(this._box, "sidebarcommand");
- let xulStore = Services.xulStore;
if (this._box.hasAttribute("positionend")) {
- document.persist("sidebar-box", "positionend");
+ xulStore.persist(this._box, "positionend");
} else {
xulStore.removeValue(document.documentURI, "sidebar-box", "positionend");
}
if (this._box.hasAttribute("checked")) {
- document.persist("sidebar-box", "checked");
+ xulStore.persist(this._box, "checked");
} else {
xulStore.removeValue(document.documentURI, "sidebar-box", "checked");
}
- document.persist("sidebar-box", "width");
- document.persist("sidebar-title", "value");
+ xulStore.persist(this._box, "width");
+ xulStore.persist(this._title, "value");
}
},
/**
* Opens the switcher panel if it's closed, or closes it if it's open.
*/
toggleSwitcherPanel() {
if (this._switcherPanel.state == "open" || this._switcherPanel.state == "showing") {
--- a/browser/base/content/browser.js
+++ b/browser/base/content/browser.js
@@ -5647,17 +5647,17 @@ function setToolbarVisibility(toolbar, i
Services.prefs.setBoolPref("ui.key.menuAccessKeyFocuses", !isVisible);
}
} else {
hidingAttribute = "collapsed";
}
toolbar.setAttribute(hidingAttribute, !isVisible);
if (persist) {
- document.persist(toolbar.id, hidingAttribute);
+ Services.xulStore.persist(toolbar, hidingAttribute);
}
let eventParams = {
detail: {
visible: isVisible
},
bubbles: true
};
--- a/browser/components/customizableui/CustomizeMode.jsm
+++ b/browser/components/customizableui/CustomizeMode.jsm
@@ -1069,17 +1069,17 @@ CustomizeMode.prototype = {
let document = this.document;
let toolbars = document.querySelectorAll("toolbar[customizable='true'][currentset]");
for (let toolbar of toolbars) {
if (aSetBeforePersisting) {
let set = toolbar.currentSet;
toolbar.setAttribute("currentset", set);
}
// Persist the currentset attribute directly on hardcoded toolbars.
- document.persist(toolbar.id, "currentset");
+ Services.xulStore.persist(toolbar, "currentset");
}
},
reset() {
this.resetting = true;
// Disable the reset button temporarily while resetting:
let btn = this.$("customization-reset-button");
btn.disabled = true;
--- a/browser/components/shell/content/setDesktopBackground.js
+++ b/browser/components/shell/content/setDesktopBackground.js
@@ -69,17 +69,17 @@ var gSetBackground = {
document.getElementById("showDesktopPreferences").hidden = true;
}
this.updatePosition();
},
setDesktopBackground() {
if (AppConstants.platform != "macosx") {
- document.persist("menuPosition", "value");
+ Services.xulStore.persist(document.getElementById("menuPosition"), "value");
this._shell.desktopBackgroundColor = this._hexStringToLong(this._backgroundColor);
} else {
Services.obs.addObserver(this, "shell:desktop-background-changed");
var bundle = document.getElementById("backgroundBundle");
var setDesktopBackground = document.getElementById("setDesktopBackground");
setDesktopBackground.disabled = true;
setDesktopBackground.label = bundle.getString("DesktopBackgroundDownloading");