Bug 975372 - make Australis' customizeMode's undoReset not error out at the end when the gSavedState is null, r=jaws
authorGijs Kruitbosch <gijskruitbosch@gmail.com>
Fri, 21 Feb 2014 13:16:12 +0000
changeset 170180 c1e26b826011a0808c83e1db4eba16a5a56d8f4c
parent 170179 a11044dfe7cd901bc6c3d9b9e410eb42a81e97a4
child 170181 f9dcf7171707e64fa88423089553dc1c1749714f
push id5250
push usergijskruitbosch@gmail.com
push dateMon, 24 Feb 2014 19:03:57 +0000
treeherderfx-team@f9dcf7171707 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjaws
bugs975372
milestone30.0a1
Bug 975372 - make Australis' customizeMode's undoReset not error out at the end when the gSavedState is null, r=jaws
browser/components/customizableui/src/CustomizableUI.jsm
--- a/browser/components/customizableui/src/CustomizableUI.jsm
+++ b/browser/components/customizableui/src/CustomizableUI.jsm
@@ -2146,21 +2146,25 @@ let CustomizableUIInternal = {
 
     // Need to clear the previous state before setting the prefs
     // because pref observers may check if there is a previous UI state.
     this._clearPreviousUIState();
 
     Services.prefs.setCharPref(kPrefCustomizationState, uiCustomizationState);
     Services.prefs.setBoolPref(kPrefDrawInTitlebar, drawInTitlebar);
     this.loadSavedState();
-    for (let areaId of Object.keys(gSavedState.placements)) {
-      let placements = gSavedState.placements[areaId];
-      gPlacements.set(areaId, placements);
+    // If the user just customizes toolbar/titlebar visibility, gSavedState will be null
+    // and we don't need to do anything else here:
+    if (gSavedState) {
+      for (let areaId of Object.keys(gSavedState.placements)) {
+        let placements = gSavedState.placements[areaId];
+        gPlacements.set(areaId, placements);
+      }
+      this._rebuildRegisteredAreas();
     }
-    this._rebuildRegisteredAreas();
   },
 
   _clearPreviousUIState: function() {
     Object.getOwnPropertyNames(gUIStateBeforeReset).forEach((prop) => {
       gUIStateBeforeReset[prop] = null;
     });
   },