Bug 1383076 - restore workaround for 'current' setter on panelviews in non-photon panelmultiview, r?mconley draft
authorGijs Kruitbosch <gijskruitbosch@gmail.com>
Mon, 24 Jul 2017 14:56:01 +0100
changeset 614347 a1f2b6c96c063a0213bc331b0c571efe8cb294d9
parent 614262 60a5308fa987676fa5ed9fd5b3ad6c9938af0539
child 638850 c26f7a8873d6219cd483ba76374af85df6c11208
push id69994
push usergijskruitbosch@gmail.com
push dateMon, 24 Jul 2017 13:56:10 +0000
reviewersmconley
bugs1383076
milestone56.0a1
Bug 1383076 - restore workaround for 'current' setter on panelviews in non-photon panelmultiview, r?mconley MozReview-Commit-ID: 6YZ6Wyu0Spc
browser/components/extensions/ext-browserAction.js
--- a/browser/components/extensions/ext-browserAction.js
+++ b/browser/components/extensions/ext-browserAction.js
@@ -176,16 +176,22 @@ this.browserAction = class extends Exten
         let popupURL = this.getProperty(tab, "popup");
         this.tabManager.addActiveTabPermission(tab);
 
         // Popups are shown only if a popup URL is defined; otherwise
         // a "click" event is dispatched. This is done for compatibility with the
         // Google Chrome onClicked extension API.
         if (popupURL) {
           try {
+            if (event.target.closest("panelmultiview")) {
+              // FIXME: The line below needs to change eventually, but for now:
+              // ensure the view is _always_ visible _before_ `popup.attach()` is
+              // called. PanelMultiView.jsm dictates different behavior.
+              event.target.setAttribute("current", true);
+            }
             let popup = this.getPopup(document.defaultView, popupURL);
             let attachPromise = popup.attach(event.target);
             event.detail.addBlocker(attachPromise);
             await attachPromise;
             TelemetryStopwatch.finish(POPUP_OPEN_MS_HISTOGRAM, this);
             if (this.eventQueue.length) {
               let histogram = Services.telemetry.getHistogramById(POPUP_RESULT_HISTOGRAM);
               histogram.add("popupShown");