Bug 994712 - fix CART regression caused by switch to Promise.jsm for Task.jsm. r=mconley.
authorGijs Kruitbosch <gijskruitbosch+bugs@gmail.com>
Fri, 25 Apr 2014 14:49:28 +0200
changeset 181040 bef43b38d6ae2baa0f18c9da53f27b9b9a6ed0b3
parent 181039 d25120c7a148b85f477595fcde0af21e9321c11c
child 181041 d7c07694f3392e453619adee3aeede9473757f6b
child 181122 8a6ad7b3b23c9bd0c85b5cce9f929af8ff19607d
push id272
push userpvanderbeken@mozilla.com
push dateMon, 05 May 2014 16:31:18 +0000
reviewersmconley
bugs994712
milestone31.0a1
Bug 994712 - fix CART regression caused by switch to Promise.jsm for Task.jsm. r=mconley.
browser/components/customizableui/content/panelUI.js
browser/components/customizableui/src/CustomizeMode.jsm
--- a/browser/components/customizableui/content/panelUI.js
+++ b/browser/components/customizableui/content/panelUI.js
@@ -195,16 +195,20 @@ const PanelUI = {
           this.toggle(aEvent);
         break;
       case "keypress":
         this.toggle(aEvent);
         break;
     }
   },
 
+  isReady: function() {
+    return !!this._isReady;
+  },
+
   /**
    * Registering the menu panel is done lazily for performance reasons. This
    * method is exposed so that CustomizationMode can force panel-readyness in the
    * event that customization mode is started before the panel has been opened
    * by the user.
    *
    * @param aCustomizing (optional) set to true if this was called while entering
    *        customization mode. If that's the case, we trust that customization
@@ -258,16 +262,17 @@ const PanelUI = {
         try {
           CustomizableUI.registerMenuPanel(this.contents);
         } finally {
           this.endBatchUpdate();
         }
       }
       this._updateQuitTooltip();
       this.panel.hidden = false;
+      this._isReady = true;
     }.bind(this)).then(null, Cu.reportError);
 
     return this._readyPromise;
   },
 
   /**
    * Switch the panel to the main view if it's not already
    * in that view.
--- a/browser/components/customizableui/src/CustomizeMode.jsm
+++ b/browser/components/customizableui/src/CustomizeMode.jsm
@@ -183,20 +183,22 @@ CustomizeMode.prototype = {
       // menu button means a quick exit from customization mode.
       window.PanelUI.hide();
       window.PanelUI.menuButton.addEventListener("command", this);
       window.PanelUI.menuButton.open = true;
       window.PanelUI.beginBatchUpdate();
 
       // The menu panel is lazy, and registers itself when the popup shows. We
       // need to force the menu panel to register itself, or else customization
-      // is really not going to work. We pass "true" to ensureRegistered to
+      // is really not going to work. We pass "true" to ensureReady to
       // indicate that we're handling calling startBatchUpdate and
       // endBatchUpdate.
-      yield window.PanelUI.ensureReady(true);
+      if (!window.PanelUI.isReady()) {
+        yield window.PanelUI.ensureReady(true);
+      }
 
       // Hide the palette before starting the transition for increased perf.
       this.visiblePalette.hidden = true;
       this.visiblePalette.removeAttribute("showing");
 
       // Disable the button-text fade-out mask
       // during the transition for increased perf.
       let panelContents = window.PanelUI.contents;