Bug 1454202: Part 1c - Manually fix non-eslint issues after auto-rewrite. r?aswan draft
authorKris Maglione <maglione.k@gmail.com>
Sat, 14 Apr 2018 19:38:18 -0700
changeset 782297 0713a5f0a67d8207f6f73de5fad265c5359523d9
parent 782290 df269e6ded771620b0654f1df4456b268fdd179a
child 782298 bf4871951fd5c541bfb85eb093c6c7cb928819c0
push id106511
push usermaglione.k@gmail.com
push dateSun, 15 Apr 2018 06:46:19 +0000
reviewersaswan
bugs1454202
milestone61.0a1
Bug 1454202: Part 1c - Manually fix non-eslint issues after auto-rewrite. r?aswan MozReview-Commit-ID: DtMscWZuExc
browser/base/content/browser.js
browser/components/nsBrowserGlue.js
devtools/server/actors/webbrowser.js
toolkit/components/normandy/lib/NormandyDriver.jsm
toolkit/mozapps/extensions/AddonManager.jsm
toolkit/mozapps/extensions/content/extensions.js
toolkit/mozapps/extensions/internal/XPIProvider.jsm
toolkit/mozapps/extensions/test/browser/browser_discovery.js
toolkit/mozapps/extensions/test/xpinstall/browser_doorhanger_installs.js
--- a/browser/base/content/browser.js
+++ b/browser/base/content/browser.js
@@ -962,26 +962,27 @@ function serializeInputStream(aStream) {
 /**
  * Handles URIs when we want to deal with them in chrome code rather than pass
  * them down to a content browser. This can avoid unnecessary process switching
  * for the browser.
  * @param aBrowser the browser that is attempting to load the URI
  * @param aUri the nsIURI that is being loaded
  * @returns true if the URI is handled, otherwise false
  */
-async function handleUriInChrome(aBrowser, aUri) {
+function handleUriInChrome(aBrowser, aUri) {
   if (aUri.scheme == "file") {
     try {
       let mimeType = Cc["@mozilla.org/mime;1"].getService(Ci.nsIMIMEService)
                                               .getTypeFromURI(aUri);
       if (mimeType == "application/x-xpinstall") {
         let systemPrincipal = Services.scriptSecurityManager.getSystemPrincipal();
-        let install = await AddonManager.getInstallForURL(aUri.spec, null, mimeType);
-        AddonManager.installAddonFromWebpage(mimeType, aBrowser, systemPrincipal,
-                                             install);
+        AddonManager.getInstallForURL(aUri.spec, null, mimeType).then(install => {
+          AddonManager.installAddonFromWebpage(mimeType, aBrowser, systemPrincipal,
+                                               install);
+        });
         return true;
       }
     } catch (e) {
       return false;
     }
   }
 
   return false;
--- a/browser/components/nsBrowserGlue.js
+++ b/browser/components/nsBrowserGlue.js
@@ -548,21 +548,18 @@ BrowserGlue.prototype = {
         }
         break;
       case "flash-plugin-hang":
         this._handleFlashHang();
         break;
       case "xpi-signature-changed":
         let disabledAddons = JSON.parse(data).disabled;
         let addons = await AddonManager.getAddonsByIDs(disabledAddons);
-        for (let addon of addons) {
-          if (addon.type != "experiment") {
-            this._notifyUnsignedAddonsDisabled();
-            break;
-          }
+        if (addons.some(addon => addon)) {
+          this._notifyUnsignedAddonsDisabled();
         }
         break;
       case "sync-ui-state:update":
         this._updateFxaBadges();
         break;
       case "handlersvc-store-initialized":
         // Initialize PdfJs when running in-process and remote. This only
         // happens once since PdfJs registers global hooks. If the PdfJs
@@ -1066,17 +1063,17 @@ BrowserGlue.prototype = {
     if (AppConstants.NIGHTLY_BUILD && AppConstants.MOZ_DATA_REPORTING) {
       this.browserErrorReporter.uninit();
     }
 
     Normandy.uninit();
   },
 
   // All initial windows have opened.
-  _onWindowsRestored: async function BG__onWindowsRestored() {
+  _onWindowsRestored: function BG__onWindowsRestored() {
     if (this._windowsWereRestored) {
       return;
     }
     this._windowsWereRestored = true;
 
     // Browser errors are only collected on Nightly
     if (AppConstants.NIGHTLY_BUILD && AppConstants.MOZ_DATA_REPORTING) {
       this.browserErrorReporter.init();
@@ -1095,26 +1092,24 @@ BrowserGlue.prototype = {
     if (AppConstants.MOZ_REQUIRE_SIGNING) {
       signingRequired = true;
     } else {
       signingRequired = Services.prefs.getBoolPref("xpinstall.signatures.required");
     }
 
     if (signingRequired) {
       let disabledAddons = AddonManager.getStartupChanges(AddonManager.STARTUP_CHANGE_DISABLED);
-      let addons = await AddonManager.getAddonsByIDs(disabledAddons);
-      for (let addon of addons) {
-        if (addon.type == "experiment")
-          continue;
-
-        if (addon.signedState <= AddonManager.SIGNEDSTATE_MISSING) {
-          this._notifyUnsignedAddonsDisabled();
-          break;
+      AddonManager.getAddonsByIDs(disabledAddons).then(addons => {
+        for (let addon of addons) {
+          if (addon.signedState <= AddonManager.SIGNEDSTATE_MISSING) {
+            this._notifyUnsignedAddonsDisabled();
+            break;
+          }
         }
-      }
+      });
     }
 
     if (AppConstants.MOZ_CRASHREPORTER) {
       UnsubmittedCrashHandler.init();
     }
 
     Sanitizer.onStartup();
     this._scheduleStartupIdleTasks();
--- a/devtools/server/actors/webbrowser.js
+++ b/devtools/server/actors/webbrowser.js
@@ -3,17 +3,16 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 "use strict";
 
 var { Ci } = require("chrome");
 var Services = require("Services");
-const defer = require("devtools/shared/defer");
 var { DebuggerServer } = require("devtools/server/main");
 var DevToolsUtils = require("devtools/shared/DevToolsUtils");
 
 loader.lazyRequireGetter(this, "RootActor", "devtools/server/actors/root", true);
 loader.lazyRequireGetter(this, "BrowserAddonActor", "devtools/server/actors/addon", true);
 loader.lazyRequireGetter(this, "WebExtensionParentActor", "devtools/server/actors/webextension-parent", true);
 loader.lazyRequireGetter(this, "WorkerActorList", "devtools/server/actors/worker-list", true);
 loader.lazyRequireGetter(this, "ServiceWorkerRegistrationActorList", "devtools/server/actors/worker-list", true);
@@ -859,34 +858,31 @@ exports.BrowserTabActor = BrowserTabActo
 
 function BrowserAddonList(connection) {
   this._connection = connection;
   this._actorByAddonId = new Map();
   this._onListChanged = null;
 }
 
 BrowserAddonList.prototype.getList = async function() {
-  let deferred = defer();
   let addons = await AddonManager.getAllAddons();
   for (let addon of addons) {
     let actor = this._actorByAddonId.get(addon.id);
     if (!actor) {
       if (addon.isWebExtension) {
         actor = new WebExtensionParentActor(this._connection, addon);
       } else {
         actor = new BrowserAddonActor(this._connection, addon);
       }
 
       this._actorByAddonId.set(addon.id, actor);
     }
   }
 
-  deferred.resolve([...this._actorByAddonId].map(([_, actor]) => actor));
-
-  return deferred.promise;
+  return Array.from(this._actorByAddonId, ([_, actor]) => actor);
 };
 
 Object.defineProperty(BrowserAddonList.prototype, "onListChanged", {
   enumerable: true,
   configurable: true,
   get() {
     return this._onListChanged;
   },
--- a/toolkit/components/normandy/lib/NormandyDriver.jsm
+++ b/toolkit/components/normandy/lib/NormandyDriver.jsm
@@ -98,25 +98,24 @@ var NormandyDriver = function(sandboxMan
         Services.search.init(rv => {
           if (Components.isSuccessCode(rv)) {
             appinfo.searchEngine = Services.search.defaultEngine.identifier;
           }
           resolve();
         });
       });
 
-      const pluginsPromise = new Promise(async resolve => {
+      const pluginsPromise = (async () => {
         let plugins = await AddonManager.getAddonsByTypes(["plugin"]);
         plugins.forEach(plugin => appinfo.plugins[plugin.name] = {
           name: plugin.name,
           description: plugin.description,
           version: plugin.version,
         });
-        resolve();
-      });
+      })();
 
       return new sandbox.Promise(resolve => {
         Promise.all([searchEnginePromise, pluginsPromise]).then(() => {
           resolve(Cu.cloneInto(appinfo, sandbox));
         });
       });
     },
 
--- a/toolkit/mozapps/extensions/AddonManager.jsm
+++ b/toolkit/mozapps/extensions/AddonManager.jsm
@@ -2734,21 +2734,18 @@ var AddonManagerInternal = {
     installs: new Map(),
     nextInstall: 0,
 
     sendEvent: null,
     setEventHandler(fn) {
       this.sendEvent = fn;
     },
 
-    getAddonByID(target, id) {
-      return new Promise(async resolve => {
-        let addon = await AddonManager.getAddonByID(id);
-        resolve(webAPIForAddon(addon));
-      });
+    async getAddonByID(target, id) {
+      return webAPIForAddon(await AddonManager.getAddonByID(id));
     },
 
     // helper to copy (and convert) the properties we care about
     copyProps(install, obj) {
       obj.state = AddonManager.stateToString(install.state);
       obj.error = AddonManager.errorToString(install.error);
       obj.progress = install.progress;
       obj.maxProgress = install.maxProgress;
--- a/toolkit/mozapps/extensions/content/extensions.js
+++ b/toolkit/mozapps/extensions/content/extensions.js
@@ -3449,16 +3449,18 @@ var gDragDrop = {
     var types = aEvent.dataTransfer.types;
     if (types.includes("text/uri-list") ||
         types.includes("text/x-moz-url") ||
         types.includes("application/x-moz-file"))
       aEvent.preventDefault();
   },
 
   async onDrop(aEvent) {
+    aEvent.preventDefault();
+
     let dataTransfer = aEvent.dataTransfer;
     let browser = getBrowserElement();
 
     // Convert every dropped item into a url and install it
     for (var i = 0; i < dataTransfer.mozItemCount; i++) {
       let url = dataTransfer.mozGetDataAt("text/uri-list", i);
       if (!url) {
         url = dataTransfer.mozGetDataAt("text/x-moz-url", i);
@@ -3472,18 +3474,16 @@ var gDragDrop = {
         }
       }
 
       if (url) {
         let install = await AddonManager.getInstallForURL(url, null, "application/x-xpinstall");
         AddonManager.installAddonFromAOM(browser, document.documentURIObject, install);
       }
     }
-
-    aEvent.preventDefault();
   }
 };
 
 // Stub tabbrowser implementation for use by the tab-modal alert code
 // when an alert/prompt/confirm method is called in a WebExtensions options_ui page
 // (See Bug 1385548 for rationale).
 var gBrowser = {
   getTabModalPromptBox(browser) {
--- a/toolkit/mozapps/extensions/internal/XPIProvider.jsm
+++ b/toolkit/mozapps/extensions/internal/XPIProvider.jsm
@@ -5981,18 +5981,18 @@ class SystemAddonInstallLocation extends
     // If this is running at app startup, the pref being cleared
     // will cause later stages of startup to notice that the
     // old updates are now gone.
     //
     // Updates will only be explicitly uninstalled if they are
     // removed restartlessly, for instance if they are no longer
     // part of the latest update set.
     if (this._addonSet) {
-      for (let id of Object.keys(this._addonSet.addons)) {
-        let addon = await AddonManager.getAddonByID(id);
+      let ids = Object.keys(this._addonSet.addons);
+      for (let addon of await AddonManager.getAddonsByIDs(ids)) {
         if (addon) {
           addon.uninstall();
         }
       }
     }
   }
 
   /**
--- a/toolkit/mozapps/extensions/test/browser/browser_discovery.js
+++ b/toolkit/mozapps/extensions/test/browser/browser_discovery.js
@@ -95,24 +95,23 @@ function getHash(aBrowser) {
 
   var url = aBrowser.currentURI.spec;
   var pos = url.indexOf("#");
   if (pos != -1)
     return decodeURIComponent(url.substring(pos + 1));
   return null;
 }
 
-async function testHash(aBrowser, aTestAddonVisible, aCallback) {
+async function testHash(aBrowser, aTestAddonVisible) {
   var hash = getHash(aBrowser);
   isnot(hash, null, "There should be a hash");
   try {
     var data = JSON.parse(hash);
   } catch (e) {
     ok(false, "Hash should have been valid JSON: " + e);
-    aCallback();
     return;
   }
   is(typeof data, "object", "Hash should be a JS object");
 
   // Ensure that at least the test add-ons are present
   if (aTestAddonVisible[0])
     ok("addon1@tests.mozilla.org" in data, "Test add-on 1 should be listed");
   else
@@ -141,17 +140,16 @@ async function testHash(aBrowser, aTestA
     var addonData = data[addon.id];
     is(addonData.name, addon.name, "Name should be correct");
     is(addonData.version, addon.version, "Version should be correct");
     is(addonData.type, addon.type, "Type should be correct");
     is(addonData.userDisabled, addon.userDisabled, "userDisabled should be correct");
     is(addonData.isBlocklisted, addon.blocklistState == Ci.nsIBlocklistService.STATE_BLOCKED, "blocklisted should be correct");
     is(addonData.isCompatible, addon.isCompatible, "isCompatible should be correct");
   }
-  aCallback();
 }
 
 function isLoading() {
   var loading = gManagerWindow.document.getElementById("discover-view").selectedPanel ==
                 gManagerWindow.document.getElementById("discover-loading");
   if (loading) {
     is_element_visible(gManagerWindow.document.querySelector("#discover-loading .loading"),
                        "Loading message should be visible when its panel is the selected panel");
@@ -182,46 +180,44 @@ function clickLink(aId, aCallback) {
 }
 
 // Tests that switching to the discovery view displays the right url
 add_test(function() {
   open_manager("addons://list/extension", function(aWindow) {
     gManagerWindow = aWindow;
     gCategoryUtilities = new CategoryUtilities(gManagerWindow);
 
-    gCategoryUtilities.openType("discover", function() {
+    gCategoryUtilities.openType("discover", async function() {
       var browser = gManagerWindow.document.getElementById("discover-browser");
       is(getURL(browser), MAIN_URL, "Should have loaded the right url");
 
-      testHash(browser, [true, true, true], function() {
-        close_manager(gManagerWindow, run_next_test);
-      });
+      await testHash(browser, [true, true, true]);
+      close_manager(gManagerWindow, run_next_test);
     });
 
     ok(isLoading(), "Should be loading at first");
   });
 });
 
 // Tests that loading the add-ons manager with the discovery view as the last
 // selected view displays the right url
 add_test(function() {
   // Hide one of the test add-ons
   Services.prefs.setBoolPref("extensions.addon2@tests.mozilla.org.getAddons.cache.enabled", false);
   Services.prefs.setBoolPref("extensions.addon3@tests.mozilla.org.getAddons.cache.enabled", true);
 
-  open_manager(null, function(aWindow) {
+  open_manager(null, async function(aWindow) {
     gCategoryUtilities = new CategoryUtilities(gManagerWindow);
     is(gCategoryUtilities.selectedCategory, "discover", "Should have loaded the right view");
 
     var browser = gManagerWindow.document.getElementById("discover-browser");
     is(getURL(browser), MAIN_URL, "Should have loaded the right url");
 
-    testHash(browser, [true, false, true], function() {
-      close_manager(gManagerWindow, run_next_test);
-    });
+    await testHash(browser, [true, false, true]);
+    close_manager(gManagerWindow, run_next_test);
   }, function(aWindow) {
     gManagerWindow = aWindow;
     ok(isLoading(), "Should be loading at first");
   });
 });
 
 // Tests that loading the add-ons manager with the discovery view as the initial
 // view displays the right url
@@ -229,27 +225,26 @@ add_test(function() {
   Services.prefs.clearUserPref("extensions.addon2@tests.mozilla.org.getAddons.cache.enabled");
   Services.prefs.setBoolPref("extensions.addon3@tests.mozilla.org.getAddons.cache.enabled", false);
 
   open_manager(null, function(aWindow) {
     gManagerWindow = aWindow;
     gCategoryUtilities = new CategoryUtilities(gManagerWindow);
     gCategoryUtilities.openType("extension", function() {
       close_manager(gManagerWindow, function() {
-        open_manager("addons://discover/", function(aWindow) {
+        open_manager("addons://discover/", async function(aWindow) {
           gCategoryUtilities = new CategoryUtilities(gManagerWindow);
           is(gCategoryUtilities.selectedCategory, "discover", "Should have loaded the right view");
 
           var browser = gManagerWindow.document.getElementById("discover-browser");
           is(getURL(browser), MAIN_URL, "Should have loaded the right url");
 
-          testHash(browser, [true, true, false], function() {
-            Services.prefs.clearUserPref("extensions.addon3@tests.mozilla.org.getAddons.cache.enabled");
-            close_manager(gManagerWindow, run_next_test);
-          });
+          await testHash(browser, [true, true, false]);
+          Services.prefs.clearUserPref("extensions.addon3@tests.mozilla.org.getAddons.cache.enabled");
+          close_manager(gManagerWindow, run_next_test);
         }, function(aWindow) {
           gManagerWindow = aWindow;
           ok(isLoading(), "Should be loading at first");
         });
       });
     });
   });
 });
--- a/toolkit/mozapps/extensions/test/xpinstall/browser_doorhanger_installs.js
+++ b/toolkit/mozapps/extensions/test/xpinstall/browser_doorhanger_installs.js
@@ -172,22 +172,16 @@ function setupRedirect(aSettings) {
     url += "&" + name + "=" + aSettings[name];
   }
 
   var req = new XMLHttpRequest();
   req.open("GET", url, false);
   req.send(null);
 }
 
-function getInstalls() {
-  return new Promise(resolve => {
-    AddonManager.getAllInstalls(installs => resolve(installs));
-  });
-}
-
 var TESTS = [
 async function test_disabledInstall() {
   Services.prefs.setBoolPref("xpinstall.enabled", false);
 
   let notificationPromise = waitForNotification("xpinstall-disabled");
   let triggers = encodeURIComponent(JSON.stringify({
     "XPI": "amosigned.xpi"
   }));
@@ -206,17 +200,17 @@ async function test_disabledInstall() {
 
   try {
     ok(Services.prefs.getBoolPref("xpinstall.enabled"), "Installation should be enabled");
   } catch (e) {
     ok(false, "xpinstall.enabled should be set");
   }
 
   BrowserTestUtils.removeTab(gBrowser.selectedTab);
-  let installs = await getInstalls();
+  let installs = await AddonManager.getAllInstalls();
   is(installs.length, 0, "Shouldn't be any pending installs");
 },
 
 async function test_blockedInstall() {
   let notificationPromise = waitForNotification("addon-install-blocked");
   let triggers = encodeURIComponent(JSON.stringify({
     "XPI": "amosigned.xpi"
   }));
@@ -240,17 +234,17 @@ async function test_blockedInstall() {
   is(notification.id, "addon-progress-notification", "Should have seen the progress notification");
 
   let installDialog = await dialogPromise;
 
   notificationPromise = waitForNotification("addon-installed");
   installDialog.button.click();
   panel = await notificationPromise;
 
-  let installs = await getInstalls();
+  let installs = await AddonManager.getAllInstalls();
   is(installs.length, 0, "Should be no pending installs");
 
   let addon = await AddonManager.getAddonByID("amosigned-xpi@tests.mozilla.org");
   addon.uninstall();
 
   await BrowserTestUtils.removeTab(gBrowser.selectedTab);
 },
 
@@ -274,17 +268,17 @@ async function test_whitelistedInstall()
 
   is(gBrowser.selectedTab, tab,
      "tab selected in response to the addon-install-confirmation notification");
 
   let notificationPromise = waitForNotification("addon-installed");
   acceptInstallDialog(installDialog);
   await notificationPromise;
 
-  let installs = await getInstalls();
+  let installs = await AddonManager.getAllInstalls();
   is(installs.length, 0, "Should be no pending installs");
 
   let addon = await AddonManager.getAddonByID("amosigned-xpi@tests.mozilla.org");
   addon.uninstall();
 
   Services.perms.remove(makeURI("http://example.com/"), "install");
   await removeTabAndWaitForNotificationClose();
 },
@@ -370,23 +364,20 @@ async function test_restartless() {
   gBrowser.loadURI(TESTROOT + "installtrigger.html?" + triggers);
   await progressPromise;
   let installDialog = await dialogPromise;
 
   let notificationPromise = waitForNotification("addon-installed");
   acceptInstallDialog(installDialog);
   await notificationPromise;
 
-  let installs = await getInstalls();
+  let installs = await AddonManager.getAllInstalls();
   is(installs.length, 0, "Should be no pending installs");
 
-  let addon = await new Promise(async resolve => {
-    let result = await AddonManager.getAddonByID("restartless-xpi@tests.mozilla.org");
-    resolve(result);
-  });
+  let addon = await AddonManager.getAddonByID("restartless-xpi@tests.mozilla.org");
   addon.uninstall();
 
   Services.perms.remove(makeURI("http://example.com/"), "install");
   await removeTabAndWaitForNotificationClose(gBrowser.selectedTab);
 },
 
 async function test_sequential() {
   // This test is only relevant if using the new doorhanger UI
@@ -490,20 +481,17 @@ async function test_allUnverified() {
   is(container.childNodes.length, 1, "Should be one item listed");
   is(container.childNodes[0].firstChild.getAttribute("value"), "XPI Test", "Should have the right add-on");
   is(container.childNodes[0].childNodes.length, 1, "Shouldn't have the unverified marker");
 
   let notificationPromise = waitForNotification("addon-installed");
   acceptInstallDialog(installDialog);
   await notificationPromise;
 
-  let addon = await new Promise(async resolve => {
-    let result = await AddonManager.getAddonByID("restartless-xpi@tests.mozilla.org");
-    resolve(result);
-  });
+  let addon = await AddonManager.getAddonByID("restartless-xpi@tests.mozilla.org");
   addon.uninstall();
 
   Services.perms.remove(makeURI("http://example.com/"), "install");
   await removeTabAndWaitForNotificationClose();
 },
 
 async function test_localFile() {
   let cr = Cc["@mozilla.org/chrome/chrome-registry;1"]
@@ -542,22 +530,22 @@ async function test_tabClose() {
   let progressPromise = waitForProgressNotification();
   let dialogPromise = waitForInstallDialog("addon-install-confirmation");
   gBrowser.selectedTab = BrowserTestUtils.addTab(gBrowser, "about:blank");
   await BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser);
   gBrowser.loadURI(TESTROOT + "restartless.xpi");
   await progressPromise;
   await dialogPromise;
 
-  let installs = await getInstalls();
+  let installs = await AddonManager.getAllInstalls();
   is(installs.length, 1, "Should be one pending install");
 
   await removeTabAndWaitForNotificationClose(gBrowser.selectedTab);
 
-  installs = await getInstalls();
+  installs = await AddonManager.getAllInstalls();
   is(installs.length, 0, "Should be no pending install since the tab is closed");
 },
 
 // Add-ons should be cancelled and the install notification destroyed when
 // navigating to a new origin
 async function test_tabNavigate() {
   let pm = Services.perms;
   pm.add(makeURI("http://example.com/"), "install", pm.ALLOW_ACTION);
@@ -578,17 +566,17 @@ async function test_tabNavigate() {
 
   // At the point of closing notification, AddonManager hasn't yet removed
   // pending installs.  It removes them in onLocationChange listener, and
   // the notification is also closed in another onLocationChange listener,
   // before AddonManager's one.  Wait for next tick to ensure all
   // onLocationChange listeners are performed.
   await waitForTick();
 
-  let installs = await getInstalls();
+  let installs = await AddonManager.getAllInstalls();
   is(installs.length, 0, "Should be no pending install");
 
   Services.perms.remove(makeURI("http://example.com/"), "install");
   await loadPromise;
 
   await removeTabAndWaitForNotificationClose();
 },
 
@@ -604,17 +592,17 @@ async function test_urlBar() {
 
   await progressPromise;
   let installDialog = await dialogPromise;
 
   let notificationPromise = waitForNotification("addon-installed");
   installDialog.button.click();
   await notificationPromise;
 
-  let installs = await getInstalls();
+  let installs = await AddonManager.getAllInstalls();
   is(installs.length, 0, "Should be no pending installs");
 
   let addon = await AddonManager.getAddonByID("amosigned-xpi@tests.mozilla.org");
   addon.uninstall();
 
   await removeTabAndWaitForNotificationClose();
 },
 
@@ -657,22 +645,22 @@ async function test_renotifyBlocked() {
   info("Timeouts after this probably mean bug 589954 regressed");
 
   await new Promise(resolve => executeSoon(resolve));
 
   notificationPromise = waitForNotification("addon-install-blocked");
   gBrowser.loadURI(TESTROOT + "installtrigger.html?" + triggers);
   await notificationPromise;
 
-  let installs = await getInstalls();
+  let installs = await AddonManager.getAllInstalls();
   is(installs.length, 2, "Should be two pending installs");
 
   await removeTabAndWaitForNotificationClose(gBrowser.selectedTab);
 
-  installs = await getInstalls();
+  installs = await AddonManager.getAllInstalls();
   is(installs.length, 0, "Should have cancelled the installs");
 },
 
 async function test_cancel() {
   let pm = Services.perms;
   pm.add(makeURI("http://example.com/"), "install", pm.ALLOW_ACTION);
 
   let notificationPromise = waitForNotification(PROGRESS_NOTIFICATION);
@@ -706,17 +694,17 @@ async function test_cancel() {
   });
   EventUtils.synthesizeMouseAtCenter(notification.secondaryButton, {});
   await cancelledPromise;
 
   await new Promise(resolve => executeSoon(resolve));
 
   ok(!PopupNotifications.isPanelOpen, "Notification should be closed");
 
-  let installs = await getInstalls();
+  let installs = await AddonManager.getAllInstalls();
   is(installs.length, 0, "Should be no pending install");
 
   Services.perms.remove(makeURI("http://example.com/"), "install");
   BrowserTestUtils.removeTab(gBrowser.selectedTab);
 },
 
 async function test_failedSecurity() {
   Services.prefs.setBoolPref(PREF_INSTALL_REQUIREBUILTINCERTS, false);
@@ -805,19 +793,16 @@ add_task(async function() {
   });
 
   for (let i = 0; i < TESTS.length; ++i) {
     if (gTestStart)
       info("Test part took " + (Date.now() - gTestStart) + "ms");
 
     ok(!PopupNotifications.isPanelOpen, "Notification should be closed");
 
-    let installs = await new Promise(async resolve => {
-      let aInstalls = await AddonManager.getAllInstalls();
-      resolve(aInstalls);
-    });
+    let installs = await AddonManager.getAllInstalls();
 
     is(installs.length, 0, "Should be no active installs");
     info("Running " + TESTS[i].name);
     gTestStart = Date.now();
     await TESTS[i]();
   }
 });