Bug 979207 - Add PanelUI panelshown listener before showing panel. r=mikedeboer, a=test-only
authorGijs Kruitbosch <gijskruitbosch@gmail.com>
Mon, 09 Jun 2014 10:02:59 +0100
changeset 200533 2ec242c2dc78be96913803bc95259c9dbb78dbbd
parent 200532 055bf6fd1658342dbd371ab4e456e107e51aa917
child 200534 666e8890f22d7469965f9a89aff8018726daf5a7
push id486
push userasasaki@mozilla.com
push dateMon, 14 Jul 2014 18:39:42 +0000
treeherdermozilla-release@d33428174ff1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmikedeboer, test-only
bugs979207
milestone31.0
Bug 979207 - Add PanelUI panelshown listener before showing panel. r=mikedeboer, a=test-only
browser/components/customizableui/content/panelUI.js
--- a/browser/components/customizableui/content/panelUI.js
+++ b/browser/components/customizableui/content/panelUI.js
@@ -144,29 +144,30 @@ const PanelUI = {
 
       let anchor;
       if (!aEvent ||
           aEvent.type == "command") {
         anchor = this.menuButton;
       } else {
         anchor = aEvent.target;
       }
-      let iconAnchor =
-        document.getAnonymousElementByAttribute(anchor, "class",
-                                                "toolbarbutton-icon");
-      this.panel.openPopup(iconAnchor || anchor);
 
       this.panel.addEventListener("popupshown", function onPopupShown() {
         this.removeEventListener("popupshown", onPopupShown);
         // As an optimization for the customize mode transition, we preload
         // about:customizing in the background once the menu panel is first
         // shown.
         gCustomizationTabPreloader.ensurePreloading();
         deferred.resolve();
       });
+
+      let iconAnchor =
+        document.getAnonymousElementByAttribute(anchor, "class",
+                                                "toolbarbutton-icon");
+      this.panel.openPopup(iconAnchor || anchor);
     });
 
     return deferred.promise;
   },
 
   /**
    * If the menu panel is being shown, hide it.
    */