Bug 1372954 - Do not persist sidebar checked state to document;r=Gijs draft
authorBrian Grinstead <bgrinstead@mozilla.com>
Mon, 19 Jun 2017 13:45:03 -0700
changeset 596822 2d145a02d1cfe3bf31f1bf0c6ad8739f01a37f4e
parent 596660 72346a4d6afcc17504f911190dbf470100e879ec
child 634081 add3961ebc25218d4da932c5fe904fdc7b3ea066
push id64767
push userbgrinstead@mozilla.com
push dateMon, 19 Jun 2017 20:45:10 +0000
reviewersGijs
bugs1372954
milestone56.0a1
Bug 1372954 - Do not persist sidebar checked state to document;r=Gijs The the state will be properly set in the show() call anyway, and the xulstore doesn't track attribute removals which led to improper checked state MozReview-Commit-ID: rGb6Td55eW
browser/base/content/browser-sidebar.js
browser/components/nsBrowserGlue.js
--- a/browser/base/content/browser-sidebar.js
+++ b/browser/base/content/browser-sidebar.js
@@ -63,17 +63,16 @@ var SidebarUI = {
     });
   },
 
   uninit() {
     let enumerator = Services.wm.getEnumerator(null);
     enumerator.getNext();
     if (!enumerator.hasMoreElements()) {
       document.persist("sidebar-box", "sidebarcommand");
-      document.persist("sidebar-box", "checked");
       document.persist("sidebar-box", "width");
       document.persist("sidebar-title", "value");
     }
   },
 
   /**
    * Opens the switcher panel if it's closed, or closes it if it's open.
    */
--- a/browser/components/nsBrowserGlue.js
+++ b/browser/components/nsBrowserGlue.js
@@ -1708,17 +1708,17 @@ BrowserGlue.prototype = {
         return;
       this._openPreferences("sync", { origin: "doorhanger" });
     }
     AlertsService.showAlertNotification(null, title, body, true, null, clickCallback);
   },
 
   // eslint-disable-next-line complexity
   _migrateUI: function BG__migrateUI() {
-    const UI_VERSION = 47;
+    const UI_VERSION = 48;
     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);
@@ -2038,16 +2038,24 @@ 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");
+    }
+
     // Update the migration version.
     Services.prefs.setIntPref("browser.migration.version", UI_VERSION);
   },
 
   // ------------------------------
   // public nsIBrowserGlue members
   // ------------------------------