Backed out changeset 64f3b9dc2c81 (bug 1256399) for timeouts in test_9999_cleanup.xul
authorCarsten "Tomcat" Book <cbook@mozilla.com>
Thu, 17 Mar 2016 13:12:26 +0100
changeset 289203 21b7869572c92dab8d9fa07d333c43f2855a1b3b
parent 289202 4f746ff87cefd9cefd2d827868a278559a3a0655
child 289204 14c37c9ab9a46726da61e954bca1ecde5c4bfffc
push id19656
push usergwagner@mozilla.com
push dateMon, 04 Apr 2016 13:43:23 +0000
treeherderb2g-inbound@e99061fde28a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1256399
milestone48.0a1
backs out64f3b9dc2c817bfce599a97fdc2e27f99385a1c3
Backed out changeset 64f3b9dc2c81 (bug 1256399) for timeouts in test_9999_cleanup.xul
toolkit/mozapps/update/tests/chrome/utils.js
--- a/toolkit/mozapps/update/tests/chrome/utils.js
+++ b/toolkit/mozapps/update/tests/chrome/utils.js
@@ -1311,24 +1311,55 @@ function setupAddons(aCallback) {
         aAddon.userDisabled = true;
       }
     });
     // If there are no pre-existing add-ons the preference value will be an
     // empty string.
     Services.prefs.setCharPref(PREF_DISABLEDADDONS, disabledAddons.join(" "));
 
     // Install the test add-ons.
-    let promises = getTestAddonXPIFiles().map(function(aFile) {
-      return AddonManager.installTemporaryAddon(aFile).then(addon => {
-        if (getAddonTestType(addon.name) == "userdisabled") {
-          addon.userDisabled = true;
+    let xpiFiles = getTestAddonXPIFiles();
+    let xpiCount = xpiFiles.length;
+    let installs = [];
+    xpiFiles.forEach(function(aFile) {
+      AddonManager.getInstallForFile(aFile, function(aInstall) {
+        if (!aInstall) {
+          throw "No AddonInstall created for " + aFile.path;
+        }
+
+        installs.push(aInstall);
+
+        if (--xpiCount == 0) {
+          let installCount = installs.length;
+          let installCompleted = function(aInstall) {
+            aInstall.removeListener(listener);
+
+            if (getAddonTestType(aInstall.addon.name) == "userdisabled") {
+              aInstall.addon.userDisabled = true;
+            }
+            if (--installCount == 0) {
+              setNoUpdateAddonsDisabledState();
+            }
+          };
+
+          let listener = {
+            onDownloadFailed: installCompleted,
+            onDownloadCancelled: installCompleted,
+            onInstallFailed: installCompleted,
+            onInstallCancelled: installCompleted,
+            onInstallEnded: installCompleted
+          };
+
+          installs.forEach(function(aInstall) {
+            aInstall.addListener(listener);
+            aInstall.install();
+          });
         }
       });
     });
-    return Promise.all(promises).then(setNoUpdateAddonsDisabledState);
   });
 }
 
 /**
  * Uninstalls the test add-ons, enables add-ons that were disabled when the
  * test started, and calls the callback specified in the aCallback parameter.
  *
  * @param  aCallback