Backed out changeset 7bd7b375eb2e (bug 1497921) per developer's request CLOSED TREE
authorshindli <shindli@mozilla.com>
Fri, 12 Oct 2018 01:19:46 +0300
changeset 499225 b9222b391f8960132c31d050d1843ffb32ac1693
parent 499224 122ac3c6e1dc29aeb824845419658dfd6c45604a
child 499226 0b2ac40765b93f823d36fbdb7804594da6a81552
push id1864
push userffxbld-merge
push dateMon, 03 Dec 2018 15:51:40 +0000
treeherdermozilla-release@f040763d99ad [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1497921
milestone64.0a1
backs out7bd7b375eb2ec849a949ba93abd30b3ea6f97919
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Backed out changeset 7bd7b375eb2e (bug 1497921) per developer's request CLOSED TREE
browser/components/extensions/ExtensionControlledPopup.jsm
--- a/browser/components/extensions/ExtensionControlledPopup.jsm
+++ b/browser/components/extensions/ExtensionControlledPopup.jsm
@@ -198,26 +198,18 @@ class ExtensionControlledPopup {
     // The item should have an extension and the user shouldn't have confirmed
     // the change here, but just to be sure check that it is still controlled
     // and the user hasn't already confirmed the change.
     // If there is no id, then the extension is no longer in control.
     if (!extensionId || this.userHasConfirmed(extensionId)) {
       return;
     }
 
+    // Find the elements we need.
     let win = targetWindow || this.topWindow;
-    // If the window closes while waiting for focus, this might reject/throw,
-    // and we should stop trying to show the popup.
-    try {
-      await this._ensureWindowReady(win);
-    } catch (ex) {
-      return;
-    }
-
-    // Find the elements we need.
     let doc = win.document;
     let panel = doc.getElementById("extension-notification-panel");
     let popupnotification = doc.getElementById(this.popupnotificationId);
     let urlBarWasFocused = win.gURLBar.focused;
 
     if (!popupnotification) {
       throw new Error(`No popupnotification found for id "${this.popupnotificationId}"`);
     }
@@ -304,51 +296,9 @@ class ExtensionControlledPopup {
     }
 
     let link = doc.createXULElement("label");
     link.setAttribute("class", "learnMore text-link");
     link.href = Services.urlFormatter.formatURLPref("app.support.baseURL") + this.learnMoreLink;
     link.textContent = strBundle.GetStringFromName(this.learnMoreMessageId);
     description.appendChild(link);
   }
-
-  _ensureWindowReady(win) {
-    return new Promise(async (resolve, reject) => {
-      if (win.closed) {
-        reject();
-        return;
-      }
-      let promises = [];
-      let listenersToRemove = [];
-      function promiseEvent(type) {
-        promises.push(new Promise(resolve => {
-          let listener = () => {
-            win.removeEventListener(type, listener);
-            resolve();
-          };
-          win.addEventListener(type, listener);
-          listenersToRemove.push([type, listener]);
-        }));
-      }
-      if (Services.focus.activeWindow != win) {
-        promiseEvent("activate");
-      }
-      if (Services.focus.focusedWindow != win) {
-        promiseEvent("focus");
-      }
-      let unloadListener;
-      if (promises.length) {
-        unloadListener = () => {
-          for (let [type, listener] of listenersToRemove) {
-            win.removeEventListener(type, listener);
-          }
-          reject();
-        };
-        win.addEventListener("unload", unloadListener, {once: true});
-      }
-      await Promise.all(promises);
-      if (unloadListener) {
-        win.removeEventListener("unload", unloadListener);
-      }
-      resolve();
-    });
-  }
 }