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 206918 744d418c4f54a8eea2015a533a9a832cfb1f0933
parent 206917 8f5b0fa44ad38862d869606edf13934e2cacc4a9
child 206919 9ffd2b905c8eecc2e2c529ad069bab5d40086b15
push id3741
push userasasaki@mozilla.com
push dateMon, 21 Jul 2014 20:25:18 +0000
treeherdermozilla-beta@4d6f46f5af68 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmikedeboer, test-only
bugs979207
milestone32.0a2
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.
    */