Backed out changeset ab6600d9847b (bug 1147808) for addon manager test failures.
authorRyan VanderMeulen <ryanvm@gmail.com>
Fri, 15 May 2015 16:14:28 -0400
changeset 244046 1725e7758d6ba593125bfe6e31305ce34b6308ee
parent 244045 4f55489df935494682d012d5d4d1e4f7dd064904
child 244047 6fa0256518e3c2d3b2d507a7e1ae2da1e85d288c
push id12973
push userryanvm@gmail.com
push dateFri, 15 May 2015 20:14:29 +0000
treeherderfx-team@1725e7758d6b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1147808
milestone41.0a1
backs outab6600d9847bc4d76381b204fccaa7e35ecc5bef
Backed out changeset ab6600d9847b (bug 1147808) for addon manager test failures.
browser/base/content/browser-addons.js
browser/base/content/test/general/browser_bug553455.js
--- a/browser/base/content/browser-addons.js
+++ b/browser/base/content/browser-addons.js
@@ -49,32 +49,16 @@ const gXPInstallObserver = {
     };
 
     try {
       options.displayOrigin = installInfo.originatingURI.host;
     } catch (e) {
       // originatingURI might be missing or 'host' might throw for non-nsStandardURL nsIURIs.
     }
 
-    let cancelInstallation = () => {
-      if (installInfo) {
-        for (let install of installInfo.installs)
-          install.cancel();
-      }
-
-      if (aTopic == "addon-install-confirmation")
-        this.acceptInstallation = null;
-
-      let tab = gBrowser.getTabForBrowser(browser);
-      if (tab)
-        tab.removeEventListener("TabClose", cancelInstallation);
-
-      window.removeEventListener("unload", cancelInstallation);
-    };
-
     switch (aTopic) {
     case "addon-install-disabled": {
       notificationID = "xpinstall-disabled";
 
       if (gPrefService.prefIsLocked("xpinstall.enabled")) {
         messageString = gNavigatorBundle.getString("xpinstallDisabledMessageLocked");
         buttons = [];
       }
@@ -131,36 +115,30 @@ const gXPInstallObserver = {
       options.installs = installInfo.installs;
       options.contentWindow = browser.contentWindow;
       options.sourceURI = browser.currentURI;
       options.eventCallback = (aEvent) => {
         switch (aEvent) {
           case "removed":
             options.contentWindow = null;
             options.sourceURI = null;
-
-            gBrowser.getTabForBrowser(browser).removeEventListener("TabClose", cancelInstallation);
-            window.removeEventListener("unload", cancelInstallation);
             break;
         }
       };
       let notification = PopupNotifications.show(browser, notificationID, messageString,
                                                  anchorID, null, null, options);
       notification._startTime = Date.now();
 
       let cancelButton = document.getElementById("addon-progress-cancel");
       cancelButton.label = gNavigatorBundle.getString("addonInstall.cancelButton.label");
       cancelButton.accessKey = gNavigatorBundle.getString("addonInstall.cancelButton.accesskey");
 
       let acceptButton = document.getElementById("addon-progress-accept");
       acceptButton.label = gNavigatorBundle.getString("addonInstall.acceptButton.label");
       acceptButton.accessKey = gNavigatorBundle.getString("addonInstall.acceptButton.accesskey");
-
-      gBrowser.getTabForBrowser(browser).addEventListener("TabClose", cancelInstallation);
-      window.addEventListener("unload", cancelInstallation);
       break; }
     case "addon-install-failed": {
       // TODO This isn't terribly ideal for the multiple failure case
       for (let install of installInfo.installs) {
         let host = options.displayOrigin;
         if (!host)
           host = (install.sourceURI instanceof Ci.nsIStandardURL) &&
                  install.sourceURI.host;
@@ -187,17 +165,21 @@ const gXPInstallObserver = {
       break; }
     case "addon-install-confirmation": {
       let unsigned = installInfo.installs.filter(i => i.addon.signedState <= AddonManager.SIGNEDSTATE_MISSING);
       let someUnsigned = unsigned.length > 0 && unsigned.length < installInfo.installs.length;
 
       options.eventCallback = (aEvent) => {
         switch (aEvent) {
           case "removed":
-            cancelInstallation();
+            if (installInfo) {
+              for (let install of installInfo.installs)
+                install.cancel();
+            }
+            this.acceptInstallation = null;
             break;
           case "shown":
             let addonList = document.getElementById("addon-install-confirmation-content");
             while (addonList.firstChild)
               addonList.firstChild.remove();
 
             for (let install of installInfo.installs) {
               let container = document.createElement("hbox");
@@ -256,22 +238,18 @@ const gXPInstallObserver = {
       cancelButton.accessKey = gNavigatorBundle.getString("addonInstall.cancelButton.accesskey");
 
       let acceptButton = document.getElementById("addon-install-confirmation-accept");
       acceptButton.label = gNavigatorBundle.getString("addonInstall.acceptButton.label");
       acceptButton.accessKey = gNavigatorBundle.getString("addonInstall.acceptButton.accesskey");
 
       let showNotification = () => {
         let tab = gBrowser.getTabForBrowser(browser);
-        if (tab) {
+        if (tab)
           gBrowser.selectedTab = tab;
-          tab.addEventListener("TabClose", cancelInstallation);
-        }
-
-        window.addEventListener("unload", cancelInstallation);
 
         if (PopupNotifications.isPanelOpen) {
           let rect = document.getElementById("addon-progress-notification").getBoundingClientRect();
           let notification = document.getElementById("addon-install-confirmation-notification");
           notification.style.minHeight = rect.height + "px";
         }
 
         PopupNotifications.show(browser, notificationID, messageString, anchorID,
--- a/browser/base/content/test/general/browser_bug553455.js
+++ b/browser/base/content/test/general/browser_bug553455.js
@@ -613,45 +613,16 @@ function test_localfile() {
     var path = cr.convertChromeURL(makeURI(CHROMEROOT + "corrupt.xpi")).spec;
   } catch (ex) {
     var path = CHROMEROOT + "corrupt.xpi";
   }
   gBrowser.selectedTab = gBrowser.addTab();
   gBrowser.loadURI(path);
 },
 
-function test_tabclose() {
-  if (!Preferences.get("xpinstall.customConfirmationUI", false)) {
-    runNextTest();
-    return;
-  }
-
-  // Wait for the progress notification
-  wait_for_progress_notification(aPanel => {
-    // Wait for the install confirmation dialog
-    wait_for_install_dialog(() => {
-      AddonManager.getAllInstalls(aInstalls => {
-        is(aInstalls.length, 1, "Should be one pending install");
-
-        wait_for_notification_close(() => {
-          AddonManager.getAllInstalls(aInstalls => {
-            is(aInstalls.length, 0, "Should be no pending install since the tab is closed");
-            runNextTest();
-          });
-        });
-
-        gBrowser.removeTab(gBrowser.selectedTab);
-      });
-    });
-  });
-
-  gBrowser.selectedTab = gBrowser.addTab();
-  gBrowser.loadURI(TESTROOT + "unsigned.xpi");
-},
-
 function test_wronghost() {
   gBrowser.selectedTab = gBrowser.addTab();
   gBrowser.addEventListener("load", function() {
     if (gBrowser.currentURI.spec != TESTROOT2 + "enabled.html")
       return;
 
     gBrowser.removeEventListener("load", arguments.callee, true);