Bug 1401232 - ensure sidebar persists correctly on update, r?bgrins
MozReview-Commit-ID: 84x9ys2inJz
--- a/browser/components/nsBrowserGlue.js
+++ b/browser/components/nsBrowserGlue.js
@@ -1682,17 +1682,17 @@ BrowserGlue.prototype = {
return;
this._openPreferences("sync", { origin: "doorhanger" });
}
this.AlertsService.showAlertNotification(null, title, body, true, null, clickCallback);
},
// eslint-disable-next-line complexity
_migrateUI: function BG__migrateUI() {
- const UI_VERSION = 55;
+ const UI_VERSION = 56;
const BROWSER_DOCURL = "chrome://browser/content/browser.xul";
let currentUIVersion;
if (Services.prefs.prefHasUserValue("browser.migration.version")) {
currentUIVersion = Services.prefs.getIntPref("browser.migration.version");
} else {
// This is a new profile, nothing to migrate.
Services.prefs.setIntPref("browser.migration.version", UI_VERSION);
@@ -2012,24 +2012,16 @@ BrowserGlue.prototype = {
// In this case just fallback to the safest side and disable suggestions.
Services.prefs.setBoolPref("browser.urlbar.suggest.searches", false);
}
} catch (ex) {
// A missing pref is not a fatal error.
}
}
- if (currentUIVersion < 48) {
- // Bug 1372954 - the checked value was persisted but the attribute removal wouldn't
- // be persisted (Bug 15232). Turns out we can just not persist the value in this case.
- // The situation was only happening for a few nightlies in 56, so this migration can
- // be removed in version 58.
- xulStore.removeValue(BROWSER_DOCURL, "sidebar-box", "checked");
- }
-
if (currentUIVersion < 49) {
// Annotate that a user haven't seen any onboarding tour
Services.prefs.setIntPref("browser.onboarding.seen-tourset-version", 0);
}
if (currentUIVersion < 50) {
try {
// Transform prefs related to old DevTools Console.
@@ -2086,16 +2078,27 @@ BrowserGlue.prototype = {
Services.prefs.clearUserPref("browser.onboarding.hidden");
}
}
if (currentUIVersion < 55) {
Services.prefs.clearUserPref("browser.customizemode.tip0.shown");
}
+ if (currentUIVersion < 56) {
+ // Prior to the end of the Firefox 57 cycle, the sidebarcommand being present
+ // or not was the only thing that distinguished whether the sidebar was open.
+ // Now, the sidebarcommand always indicates the last opened sidebar, and we
+ // correctly persist the checked attribute to indicate whether or not the
+ // sidebar was open. We should set the checked attribute in case it wasn't:
+ if (xulStore.getValue(BROWSER_DOCURL, "sidebar-box", "sidebarcommand")) {
+ xulStore.setValue(BROWSER_DOCURL, "sidebar-box", "checked", "true");
+ }
+ }
+
// Update the migration version.
Services.prefs.setIntPref("browser.migration.version", UI_VERSION);
},
_checkForDefaultBrowser() {
// Perform default browser checking.
if (!ShellService) {
return;