diff options
Diffstat (limited to 'browser/base/content')
-rw-r--r-- | browser/base/content/browser-places.js | 33 |
1 files changed, 16 insertions, 17 deletions
diff --git a/browser/base/content/browser-places.js b/browser/base/content/browser-places.js index a447880be..83c737977 100644 --- a/browser/base/content/browser-places.js +++ b/browser/base/content/browser-places.js @@ -299,24 +299,23 @@ var StarUI = { parent.setAttribute("open", "true"); } } - let panel = this.panel; - let target = panel; - if (target.parentNode) { - // By targeting the panel's parent and using a capturing listener, we - // can have our listener called before others waiting for the panel to - // be shown (which probably expect the panel to be fully initialized) - target = target.parentNode; - } - target.addEventListener("popupshown", function shownListener(event) { - if (event.target == panel) { - target.removeEventListener("popupshown", shownListener, true); - - gEditItemOverlay.initPanel({ node: aNode - , hiddenRows: ["description", "location", - "loadInSidebar", "keyword"] - , focusedElement: "preferred"}); + let onPanelReady = fn => { + let target = this.panel; + if (target.parentNode) { + // By targeting the panel's parent and using a capturing listener, we + // can have our listener called before others waiting for the panel to + // be shown (which probably expect the panel to be fully initialized) + target = target.parentNode; } - }, true); + target.addEventListener("popupshown", function(event) { + fn(); + }, {"capture": true, "once": true}); + }; + gEditItemOverlay.initPanel({ node: aNode + , onPanelReady + , hiddenRows: ["description", "location", + "loadInSidebar", "keyword"] + , focusedElement: "preferred"}); this.panel.openPopup(aAnchorElement, aPosition); }), |