Bug 1454202: Part 1 - Update legacy callers to use Promise-based AddonManager APIs. r=aswan
authorKris Maglione <maglione.k@gmail.com>
Sat, 14 Apr 2018 19:38:18 -0700
changeset 468488 f297b23906c2a9e87b34a6cf3aa9aa8dcd73db55
parent 468487 e57d78a2b830dc163f5dbcb070d45dd5552be786
child 468489 3a5b866d240e67287d5cb1be626287c233dff044
push id9165
push userasasaki@mozilla.com
push dateThu, 26 Apr 2018 21:04:54 +0000
treeherdermozilla-beta@064c3804de2e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersaswan
bugs1454202
milestone61.0a1
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
Bug 1454202: Part 1 - Update legacy callers to use Promise-based AddonManager APIs. r=aswan *** Bug 1454202: Part 1a - Auto-replace uses of callback-based AddonManager APIs with Promise-based versions. r=aswan This was done using the following script: https://bitbucket.org/kmaglione/m-c-rewrites/src/4cd5ae959765d0965dd0cc635de3e953bf46edbb/processors/aom-api-generators.jsm MozReview-Commit-ID: 8hobLz15a66 *** Bug 1454202: Part 1b - Manually fix eslint errors after auto-rewrite. r=aswan This also deletes an obsolete test whose xpcshell variant was already deleted. MozReview-Commit-ID: DM9W9Q2SVIE *** Bug 1454202: Part 1c - Manually fix non-eslint issues after auto-rewrite. r=aswan MozReview-Commit-ID: DtMscWZuExc
browser/base/content/browser.js
browser/base/content/test/general/browser_bug592338.js
browser/components/customizableui/CustomizeMode.jsm
browser/components/enterprisepolicies/Policies.jsm
browser/components/nsBrowserGlue.js
browser/components/preferences/in-content/tests/browser_extension_controlled.js
browser/tools/mozscreenshots/head.js
browser/tools/mozscreenshots/mozscreenshots/extension/bootstrap.js
devtools/client/aboutdebugging/test/head.js
devtools/client/webide/modules/addons.js
devtools/server/actors/webbrowser.js
dom/workers/test/test_extensionBootstrap.xul
toolkit/components/extensions/ExtensionTestCommon.jsm
toolkit/components/extensions/parent/ext-runtime.js
toolkit/components/extensions/test/xpcshell/test_ext_management_uninstall_self.js
toolkit/components/normandy/lib/NormandyDriver.jsm
toolkit/modules/Troubleshoot.jsm
toolkit/mozapps/extensions/AddonManager.jsm
toolkit/mozapps/extensions/addonManager.js
toolkit/mozapps/extensions/content/extensions.js
toolkit/mozapps/extensions/internal/XPIProvider.jsm
toolkit/mozapps/extensions/test/AddonManagerTesting.jsm
toolkit/mozapps/extensions/test/browser/browser.ini
toolkit/mozapps/extensions/test/browser/browser_bug591465.js
toolkit/mozapps/extensions/test/browser/browser_bug596336.js
toolkit/mozapps/extensions/test/browser/browser_bug616841.js
toolkit/mozapps/extensions/test/browser/browser_checkAddonCompatibility.js
toolkit/mozapps/extensions/test/browser/browser_details.js
toolkit/mozapps/extensions/test/browser/browser_discovery.js
toolkit/mozapps/extensions/test/browser/browser_installssl.js
toolkit/mozapps/extensions/test/browser/browser_manualupdates.js
toolkit/mozapps/extensions/test/browser/browser_pluginprefs.js
toolkit/mozapps/extensions/test/browser/browser_uninstalling.js
toolkit/mozapps/extensions/test/browser/browser_update.js
toolkit/mozapps/extensions/test/browser/head.js
toolkit/mozapps/extensions/test/mochitest/test_bug687194.html
toolkit/mozapps/extensions/test/xpcshell/test_LightweightThemeManager.js
toolkit/mozapps/extensions/test/xpcshell/test_backgroundupdate.js
toolkit/mozapps/extensions/test/xpcshell/test_blocklist_metadata_filters.js
toolkit/mozapps/extensions/test/xpcshell/test_blocklist_prefs.js
toolkit/mozapps/extensions/test/xpcshell/test_blocklist_regexp.js
toolkit/mozapps/extensions/test/xpcshell/test_bootstrap_globals.js
toolkit/mozapps/extensions/test/xpcshell/test_compatoverrides.js
toolkit/mozapps/extensions/test/xpcshell/test_corruptfile.js
toolkit/mozapps/extensions/test/xpcshell/test_distribution.js
toolkit/mozapps/extensions/test/xpcshell/test_duplicateplugins.js
toolkit/mozapps/extensions/test/xpcshell/test_error.js
toolkit/mozapps/extensions/test/xpcshell/test_general.js
toolkit/mozapps/extensions/test/xpcshell/test_getresource.js
toolkit/mozapps/extensions/test/xpcshell/test_install_icons.js
toolkit/mozapps/extensions/test/xpcshell/test_locale.js
toolkit/mozapps/extensions/test/xpcshell/test_onPropertyChanged_appDisabled.js
toolkit/mozapps/extensions/test/xpcshell/test_pluginchange.js
toolkit/mozapps/extensions/test/xpcshell/test_plugins.js
toolkit/mozapps/extensions/test/xpcshell/test_safemode.js
toolkit/mozapps/extensions/test/xpcshell/test_sourceURI.js
toolkit/mozapps/extensions/test/xpcshell/test_startup.js
toolkit/mozapps/extensions/test/xpcshell/test_syncGUID.js
toolkit/mozapps/extensions/test/xpcshell/test_update_compatmode.js
toolkit/mozapps/extensions/test/xpcshell/test_update_ignorecompat.js
toolkit/mozapps/extensions/test/xpcshell/test_upgrade.js
toolkit/mozapps/extensions/test/xpinstall/browser_doorhanger_installs.js
toolkit/mozapps/extensions/test/xpinstall/head.js
--- a/browser/base/content/browser.js
+++ b/browser/base/content/browser.js
@@ -969,20 +969,20 @@ function serializeInputStream(aStream) {
  */
 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();
-        AddonManager.getInstallForURL(aUri.spec, install => {
+        AddonManager.getInstallForURL(aUri.spec, null, mimeType).then(install => {
           AddonManager.installAddonFromWebpage(mimeType, aBrowser, systemPrincipal,
                                                install);
-        }, mimeType);
+        });
         return true;
       }
     } catch (e) {
       return false;
     }
   }
 
   return false;
--- a/browser/base/content/test/general/browser_bug592338.js
+++ b/browser/base/content/test/general/browser_bug592338.js
@@ -75,47 +75,43 @@ function test_install_lwtheme() {
       Services.perms.remove(makeURI("http://example.com/"), "install");
 
       runNextTest();
     });
   });
 }
 ];
 
-function runNextTest() {
-  AddonManager.getAllInstalls(function(aInstalls) {
-    is(aInstalls.length, 0, "Should be no active installs");
+async function runNextTest() {
+  let aInstalls = await AddonManager.getAllInstalls();
+  is(aInstalls.length, 0, "Should be no active installs");
 
-    if (TESTS.length == 0) {
-      AddonManager.getAddonByID("theme-xpi@tests.mozilla.org", function(aAddon) {
-        aAddon.uninstall();
+  if (TESTS.length == 0) {
+    let aAddon = await AddonManager.getAddonByID("theme-xpi@tests.mozilla.org");
+    aAddon.uninstall();
 
-        Services.prefs.setBoolPref("extensions.logging.enabled", false);
+    Services.prefs.setBoolPref("extensions.logging.enabled", false);
 
-        finish();
-      });
-      return;
-    }
+    finish();
+    return;
+  }
 
-    info("Running " + TESTS[0].name);
-    TESTS.shift()();
-  });
+  info("Running " + TESTS[0].name);
+  TESTS.shift()();
 }
 
-function test() {
+async function test() {
   waitForExplicitFinish();
 
   Services.prefs.setBoolPref("extensions.logging.enabled", true);
 
-  AddonManager.getInstallForURL(TESTROOT + "theme.xpi", function(aInstall) {
-    aInstall.addListener({
-      onInstallEnded() {
-        AddonManager.getAddonByID("theme-xpi@tests.mozilla.org", function(aAddon) {
-          isnot(aAddon, null, "Should have installed the test theme.");
+  let aInstall = await AddonManager.getInstallForURL(TESTROOT + "theme.xpi", null, "application/x-xpinstall");
+  aInstall.addListener({
+    async onInstallEnded() {
+      let aAddon = await AddonManager.getAddonByID("theme-xpi@tests.mozilla.org");
+      isnot(aAddon, null, "Should have installed the test theme.");
 
-          runNextTest();
-        });
-      }
-    });
+      runNextTest();
+    }
+  });
 
-    aInstall.install();
-  }, "application/x-xpinstall");
+  aInstall.install();
 }
--- a/browser/components/customizableui/CustomizeMode.jsm
+++ b/browser/components/customizableui/CustomizeMode.jsm
@@ -1334,17 +1334,17 @@ CustomizeMode.prototype = {
   updateAutoTouchMode(checked) {
     Services.prefs.setBoolPref("browser.touchmode.auto", checked);
     // Re-render the menu items since the active mode might have
     // change because of this.
     this.onUIDensityMenuShowing();
     this._onUIChange();
   },
 
-  onLWThemesMenuShowing(aEvent) {
+  async onLWThemesMenuShowing(aEvent) {
     const DEFAULT_THEME_ID = "{972ce4c6-7e08-4474-a285-3208198ce6fd}";
     const LIGHT_THEME_ID = "firefox-compact-light@mozilla.org";
     const DARK_THEME_ID = "firefox-compact-dark@mozilla.org";
     const MAX_THEME_COUNT = 6;
 
     this._clearLWThemesMenu(aEvent.target);
 
     function previewTheme(aPreviewThemeEvent) {
@@ -1358,112 +1358,111 @@ CustomizeMode.prototype = {
     }
 
     let onThemeSelected = panel => {
       this._updateLWThemeButtonIcon();
       this._onUIChange();
       panel.hidePopup();
     };
 
-    AddonManager.getAddonByID(DEFAULT_THEME_ID, aDefaultTheme => {
-      let doc = this.window.document;
+    let aDefaultTheme = await AddonManager.getAddonByID(DEFAULT_THEME_ID);
+    let doc = this.window.document;
 
-      function buildToolbarButton(aTheme) {
-        let tbb = doc.createElement("toolbarbutton");
-        tbb.theme = aTheme;
-        tbb.setAttribute("label", aTheme.name);
-        if (aDefaultTheme == aTheme) {
-          // The actual icon is set up so it looks nice in about:addons, but
-          // we'd like the version that's correct for the OS we're on, so we set
-          // an attribute that our styling will then use to display the icon.
-          tbb.setAttribute("defaulttheme", "true");
-        } else {
-          tbb.setAttribute("image", aTheme.iconURL);
-        }
-        if (aTheme.description)
-          tbb.setAttribute("tooltiptext", aTheme.description);
-        tbb.setAttribute("tabindex", "0");
-        tbb.classList.add("customization-lwtheme-menu-theme");
-        let isActive = activeThemeID == aTheme.id;
-        tbb.setAttribute("aria-checked", isActive);
-        tbb.setAttribute("role", "menuitemradio");
-        if (isActive) {
-          tbb.setAttribute("active", "true");
-        }
-        tbb.addEventListener("focus", previewTheme);
-        tbb.addEventListener("mouseover", previewTheme);
-        tbb.addEventListener("blur", resetPreview);
-        tbb.addEventListener("mouseout", resetPreview);
-
-        return tbb;
+    function buildToolbarButton(aTheme) {
+      let tbb = doc.createElement("toolbarbutton");
+      tbb.theme = aTheme;
+      tbb.setAttribute("label", aTheme.name);
+      if (aDefaultTheme == aTheme) {
+        // The actual icon is set up so it looks nice in about:addons, but
+        // we'd like the version that's correct for the OS we're on, so we set
+        // an attribute that our styling will then use to display the icon.
+        tbb.setAttribute("defaulttheme", "true");
+      } else {
+        tbb.setAttribute("image", aTheme.iconURL);
       }
-
-      let themes = [aDefaultTheme];
-      let lwts = LightweightThemeManager.usedThemes;
-      let currentLwt = LightweightThemeManager.currentTheme;
-
-      let activeThemeID = currentLwt ? currentLwt.id : DEFAULT_THEME_ID;
-
-      // Move the current theme (if any) and the light/dark themes to the start:
-      let importantThemes = [LIGHT_THEME_ID, DARK_THEME_ID];
-      if (currentLwt && !importantThemes.includes(currentLwt.id)) {
-        importantThemes.push(currentLwt.id);
+      if (aTheme.description)
+        tbb.setAttribute("tooltiptext", aTheme.description);
+      tbb.setAttribute("tabindex", "0");
+      tbb.classList.add("customization-lwtheme-menu-theme");
+      let isActive = activeThemeID == aTheme.id;
+      tbb.setAttribute("aria-checked", isActive);
+      tbb.setAttribute("role", "menuitemradio");
+      if (isActive) {
+        tbb.setAttribute("active", "true");
       }
-      for (let importantTheme of importantThemes) {
-        let themeIndex = lwts.findIndex(theme => theme.id == importantTheme);
-        if (themeIndex > -1) {
-          themes.push(...lwts.splice(themeIndex, 1));
-        }
-      }
-      themes = themes.concat(lwts);
-      if (themes.length > MAX_THEME_COUNT)
-        themes.length = MAX_THEME_COUNT;
+      tbb.addEventListener("focus", previewTheme);
+      tbb.addEventListener("mouseover", previewTheme);
+      tbb.addEventListener("blur", resetPreview);
+      tbb.addEventListener("mouseout", resetPreview);
+
+      return tbb;
+    }
+
+    let themes = [aDefaultTheme];
+    let lwts = LightweightThemeManager.usedThemes;
+    let currentLwt = LightweightThemeManager.currentTheme;
+
+    let activeThemeID = currentLwt ? currentLwt.id : DEFAULT_THEME_ID;
 
-      let footer = doc.getElementById("customization-lwtheme-menu-footer");
-      let panel = footer.parentNode;
-      let recommendedLabel = doc.getElementById("customization-lwtheme-menu-recommended");
-      for (let theme of themes) {
-        let button = buildToolbarButton(theme);
-        button.addEventListener("command", () => {
-          if ("userDisabled" in button.theme)
-            button.theme.userDisabled = false;
-          else
-            LightweightThemeManager.currentTheme = button.theme;
-          onThemeSelected(panel);
-        });
-        panel.insertBefore(button, recommendedLabel);
+    // Move the current theme (if any) and the light/dark themes to the start:
+    let importantThemes = [LIGHT_THEME_ID, DARK_THEME_ID];
+    if (currentLwt && !importantThemes.includes(currentLwt.id)) {
+      importantThemes.push(currentLwt.id);
+    }
+    for (let importantTheme of importantThemes) {
+      let themeIndex = lwts.findIndex(theme => theme.id == importantTheme);
+      if (themeIndex > -1) {
+        themes.push(...lwts.splice(themeIndex, 1));
       }
+    }
+    themes = themes.concat(lwts);
+    if (themes.length > MAX_THEME_COUNT)
+      themes.length = MAX_THEME_COUNT;
 
-      let lwthemePrefs = Services.prefs.getBranch("lightweightThemes.");
-      let recommendedThemes = lwthemePrefs.getStringPref("recommendedThemes");
-      recommendedThemes = JSON.parse(recommendedThemes);
-      let sb = Services.strings.createBundle("chrome://browser/locale/lightweightThemes.properties");
-      for (let theme of recommendedThemes) {
-        try {
-          theme.name = sb.GetStringFromName("lightweightThemes." + theme.id + ".name");
-          theme.description = sb.GetStringFromName("lightweightThemes." + theme.id + ".description");
-        } catch (ex) {
-          // If finding strings for this failed, just don't build it. This can
-          // happen for users with 'older' recommended themes lists, some of which
-          // have since been removed from Firefox.
-          continue;
-        }
-        let button = buildToolbarButton(theme);
-        button.addEventListener("command", () => {
-          LightweightThemeManager.setLocalTheme(button.theme);
-          recommendedThemes = recommendedThemes.filter((aTheme) => { return aTheme.id != button.theme.id; });
-          lwthemePrefs.setStringPref("recommendedThemes",
-                                     JSON.stringify(recommendedThemes));
-          onThemeSelected(panel);
-        });
-        panel.insertBefore(button, footer);
+    let footer = doc.getElementById("customization-lwtheme-menu-footer");
+    let panel = footer.parentNode;
+    let recommendedLabel = doc.getElementById("customization-lwtheme-menu-recommended");
+    for (let theme of themes) {
+      let button = buildToolbarButton(theme);
+      button.addEventListener("command", () => {
+        if ("userDisabled" in button.theme)
+          button.theme.userDisabled = false;
+        else
+          LightweightThemeManager.currentTheme = button.theme;
+        onThemeSelected(panel);
+      });
+      panel.insertBefore(button, recommendedLabel);
+    }
+
+    let lwthemePrefs = Services.prefs.getBranch("lightweightThemes.");
+    let recommendedThemes = lwthemePrefs.getStringPref("recommendedThemes");
+    recommendedThemes = JSON.parse(recommendedThemes);
+    let sb = Services.strings.createBundle("chrome://browser/locale/lightweightThemes.properties");
+    for (let theme of recommendedThemes) {
+      try {
+        theme.name = sb.GetStringFromName("lightweightThemes." + theme.id + ".name");
+        theme.description = sb.GetStringFromName("lightweightThemes." + theme.id + ".description");
+      } catch (ex) {
+        // If finding strings for this failed, just don't build it. This can
+        // happen for users with 'older' recommended themes lists, some of which
+        // have since been removed from Firefox.
+        continue;
       }
-      let hideRecommendedLabel = (footer.previousSibling == recommendedLabel);
-      recommendedLabel.hidden = hideRecommendedLabel;
-    });
+      let button = buildToolbarButton(theme);
+      button.addEventListener("command", () => {
+        LightweightThemeManager.setLocalTheme(button.theme);
+        recommendedThemes = recommendedThemes.filter((aTheme) => { return aTheme.id != button.theme.id; });
+        lwthemePrefs.setStringPref("recommendedThemes",
+                                   JSON.stringify(recommendedThemes));
+        onThemeSelected(panel);
+      });
+      panel.insertBefore(button, footer);
+    }
+    let hideRecommendedLabel = (footer.previousSibling == recommendedLabel);
+    recommendedLabel.hidden = hideRecommendedLabel;
   },
 
   _clearLWThemesMenu(panel) {
     let footer = this.$("customization-lwtheme-menu-footer");
     let recommendedLabel = this.$("customization-lwtheme-menu-recommended");
     for (let element of [footer, recommendedLabel]) {
       while (element.previousSibling &&
              element.previousSibling.localName == "toolbarbutton") {
--- a/browser/components/enterprisepolicies/Policies.jsm
+++ b/browser/components/enterprisepolicies/Policies.jsm
@@ -444,29 +444,28 @@ var Policies = {
               };
               install.addListener(listener);
               install.install();
             });
           }
         });
       }
       if ("Uninstall" in param) {
-        runOncePerModification("extensionsUninstall", JSON.stringify(param.Uninstall), () => {
-          AddonManager.getAddonsByIDs(param.Uninstall, (addons) => {
-            for (let addon of addons) {
-              if (addon) {
-                try {
-                  addon.uninstall();
-                } catch (e) {
-                  // This can fail for add-ons that can't be uninstalled.
-                  // Just ignore.
-                }
+        runOncePerModification("extensionsUninstall", JSON.stringify(param.Uninstall), async () => {
+          let addons = await AddonManager.getAddonsByIDs(param.Uninstall);
+          for (let addon of addons) {
+            if (addon) {
+              try {
+                addon.uninstall();
+              } catch (e) {
+                // This can fail for add-ons that can't be uninstalled.
+                // Just ignore.
               }
             }
-          });
+          }
         });
       }
       if ("Locked" in param) {
         for (let ID of param.Locked) {
           manager.disallowFeature(`modify-extension:${ID}`);
         }
       }
     }
--- a/browser/components/nsBrowserGlue.js
+++ b/browser/components/nsBrowserGlue.js
@@ -377,17 +377,17 @@ BrowserGlue.prototype = {
       event: "AS_ENABLED",
       value: true
     };
     const options = {filter: ACTIVITY_STREAM_ID};
     this.pingCentre.sendPing(payload, options);
   },
 
   // nsIObserver implementation
-  observe: function BG_observe(subject, topic, data) {
+  observe: async function BG_observe(subject, topic, data) {
     switch (topic) {
       case "notifications-open-settings":
         this._openPreferences("privacy", { origin: "notifOpenSettings" });
         break;
       case "prefservice:after-app-defaults":
         this._onAppDefaults();
         break;
       case "final-ui-startup":
@@ -548,24 +548,20 @@ BrowserGlue.prototype = {
           Services.prefs.setStringPref("browser.search.hiddenOneOffs", hiddenList.join(","));
         }
         break;
       case "flash-plugin-hang":
         this._handleFlashHang();
         break;
       case "xpi-signature-changed":
         let disabledAddons = JSON.parse(data).disabled;
-        AddonManager.getAddonsByIDs(disabledAddons, (addons) => {
-          for (let addon of addons) {
-            if (addon.type != "experiment") {
-              this._notifyUnsignedAddonsDisabled();
-              break;
-            }
-          }
-        });
+        let addons = await AddonManager.getAddonsByIDs(disabledAddons);
+        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
         // extension is installed the init method below will be overridden
@@ -1097,21 +1093,18 @@ 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);
-      AddonManager.getAddonsByIDs(disabledAddons, (addons) => {
+      AddonManager.getAddonsByIDs(disabledAddons).then(addons => {
         for (let addon of addons) {
-          if (addon.type == "experiment")
-            continue;
-
           if (addon.signedState <= AddonManager.SIGNEDSTATE_MISSING) {
             this._notifyUnsignedAddonsDisabled();
             break;
           }
         }
       });
     }
 
--- a/browser/components/preferences/in-content/tests/browser_extension_controlled.js
+++ b/browser/components/preferences/in-content/tests/browser_extension_controlled.js
@@ -17,30 +17,29 @@ function getSupportsFile(path) {
     .getService(Ci.nsIChromeRegistry);
   let uri = Services.io.newURI(CHROME_URL_ROOT + path);
   let fileurl = cr.convertChromeURL(uri);
   return fileurl.QueryInterface(Ci.nsIFileURL);
 }
 
 function installAddon(xpiName) {
   let filePath = getSupportsFile(`addons/${xpiName}`).file;
-  return new Promise((resolve, reject) => {
-    AddonManager.getInstallForFile(filePath, install => {
-      if (!install) {
-        throw new Error(`An install was not created for ${filePath}`);
-      }
-      install.addListener({
-        onDownloadFailed: reject,
-        onDownloadCancelled: reject,
-        onInstallFailed: reject,
-        onInstallCancelled: reject,
-        onInstallEnded: resolve
-      });
-      install.install();
+  return new Promise(async (resolve, reject) => {
+    let install = await AddonManager.getInstallForFile(filePath);
+    if (!install) {
+      throw new Error(`An install was not created for ${filePath}`);
+    }
+    install.addListener({
+      onDownloadFailed: reject,
+      onDownloadCancelled: reject,
+      onInstallFailed: reject,
+      onInstallCancelled: reject,
+      onInstallEnded: resolve
     });
+    install.install();
   });
 }
 
 function waitForMutation(target, opts, cb) {
   return new Promise((resolve) => {
     let observer = new MutationObserver(() => {
       if (!cb || cb(target)) {
         observer.disconnect();
--- a/browser/tools/mozscreenshots/head.js
+++ b/browser/tools/mozscreenshots/head.js
@@ -21,23 +21,22 @@ async function setup() {
   SimpleTest.requestCompleteLog();
 
   info("installing extension temporarily");
   let chromeURL = Services.io.newURI(EXTENSION_DIR);
   let dir = chromeRegistry.convertChromeURL(chromeURL).QueryInterface(Ci.nsIFileURL).file;
   await AddonManager.installTemporaryAddon(dir);
 
   info("Checking for mozscreenshots extension");
-  return new Promise((resolve) => {
-    AddonManager.getAddonByID("mozscreenshots@mozilla.org", (aAddon) => {
-      isnot(aAddon, null, "The mozscreenshots extension should be installed");
-      TestRunner = ChromeUtils.import("chrome://mozscreenshots/content/TestRunner.jsm", {}).TestRunner;
-      TestRunner.initTest(this);
-      resolve();
-    });
+  return new Promise(async (resolve) => {
+    let aAddon = await AddonManager.getAddonByID("mozscreenshots@mozilla.org");
+    isnot(aAddon, null, "The mozscreenshots extension should be installed");
+    TestRunner = ChromeUtils.import("chrome://mozscreenshots/content/TestRunner.jsm", {}).TestRunner;
+    TestRunner.initTest(this);
+    resolve();
   });
 }
 
 /**
  * Used by pre-defined sets of configurations to decide whether to run for a build.
  * @note This is not used by browser_screenshots.js which handles when MOZSCREENSHOTS_SETS is set.
  * @return {bool} whether to capture screenshots.
  */
--- a/browser/tools/mozscreenshots/mozscreenshots/extension/bootstrap.js
+++ b/browser/tools/mozscreenshots/mozscreenshots/extension/bootstrap.js
@@ -9,50 +9,46 @@
 ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
 ChromeUtils.import("resource://gre/modules/AddonManager.jsm");
 ChromeUtils.import("resource://gre/modules/Services.jsm");
 ChromeUtils.import("resource://gre/modules/Timer.jsm");
 
 ChromeUtils.defineModuleGetter(this, "TestRunner",
                                "chrome://mozscreenshots/content/TestRunner.jsm");
 
-function install(data, reason) {
+async function install(data, reason) {
   if (!isAppSupported()) {
     uninstallExtension(data);
     return;
   }
 
-  AddonManager.getAddonByID(data.id, function(addon) {
-    // Enable on install in case the user disabled a prior version
-    if (addon) {
-      addon.userDisabled = false;
-    }
-  });
+  let addon = await AddonManager.getAddonByID(data.id);
+  if (addon) {
+    addon.userDisabled = false;
+  }
 }
 
-function startup(data, reason) {
+async function startup(data, reason) {
   if (!isAppSupported()) {
     uninstallExtension(data);
     return;
   }
 
-  AddonManager.getAddonByID(data.id, function(addon) {
-    let extensionPath = addon.getResourceURI();
-    TestRunner.init(extensionPath);
-  });
+  let addon = await AddonManager.getAddonByID(data.id);
+  let extensionPath = addon.getResourceURI();
+  TestRunner.init(extensionPath);
 }
 
 function shutdown(data, reason) { }
 
 function uninstall(data, reason) { }
 
 /**
  * @return boolean whether the test suite applies to the application.
  */
 function isAppSupported() {
   return true;
 }
 
-function uninstallExtension(data) {
-  AddonManager.getAddonByID(data.id, function(addon) {
-    addon.uninstall();
-  });
+async function uninstallExtension(data) {
+  let addon = await AddonManager.getAddonByID(data.id);
+  addon.uninstall();
 }
--- a/devtools/client/aboutdebugging/test/head.js
+++ b/devtools/client/aboutdebugging/test/head.js
@@ -202,31 +202,30 @@ async function installAddon({document, p
   ok(true, "Addon installed and running its bootstrap.js file");
 
   info("Wait for the addon to appear in the UI");
   await waitUntilAddonContainer(name, document);
 }
 
 async function uninstallAddon({document, id, name}) {
   // Now uninstall this addon
-  await new Promise(done => {
-    AddonManager.getAddonByID(id, addon => {
-      let listener = {
-        onUninstalled: function(uninstalledAddon) {
-          if (uninstalledAddon != addon) {
-            return;
-          }
-          AddonManager.removeAddonListener(listener);
+  await new Promise(async done => {
+    let addon = await AddonManager.getAddonByID(id);
+    let listener = {
+      onUninstalled: function(uninstalledAddon) {
+        if (uninstalledAddon != addon) {
+          return;
+        }
+        AddonManager.removeAddonListener(listener);
 
-          done();
-        }
-      };
-      AddonManager.addAddonListener(listener);
-      addon.uninstall();
-    });
+        done();
+      }
+    };
+    AddonManager.addAddonListener(listener);
+    addon.uninstall();
   });
 
   info("Wait until the addon is removed from about:debugging");
   await waitUntil(() => !getAddonContainer(name, document), 100);
 }
 
 function getAddonCount(document) {
   const addonListContainer = getAddonList(document);
@@ -430,30 +429,29 @@ function promiseAddonEvent(event) {
     AddonManager.addAddonListener(listener);
   });
 }
 
 /**
  * Install an add-on using the AddonManager so it does not show up as temporary.
  */
 function installAddonWithManager(filePath) {
-  return new Promise((resolve, reject) => {
-    AddonManager.getInstallForFile(filePath, install => {
-      if (!install) {
-        throw new Error(`An install was not created for ${filePath}`);
-      }
-      install.addListener({
-        onDownloadFailed: reject,
-        onDownloadCancelled: reject,
-        onInstallFailed: reject,
-        onInstallCancelled: reject,
-        onInstallEnded: resolve
-      });
-      install.install();
+  return new Promise(async (resolve, reject) => {
+    let install = await AddonManager.getInstallForFile(filePath);
+    if (!install) {
+      throw new Error(`An install was not created for ${filePath}`);
+    }
+    install.addListener({
+      onDownloadFailed: reject,
+      onDownloadCancelled: reject,
+      onInstallFailed: reject,
+      onInstallCancelled: reject,
+      onInstallEnded: resolve
     });
+    install.install();
   });
 }
 
 function getAddonByID(addonId) {
   return new Promise(resolve => {
     AddonManager.getAddonByID(addonId, addon => resolve(addon));
   });
 }
--- a/devtools/client/webide/modules/addons.js
+++ b/devtools/client/webide/modules/addons.js
@@ -57,48 +57,44 @@ Addon.prototype = {
       this._status = value;
       this.emit("update");
     }
   },
   get status() {
     return this._status;
   },
 
-  updateInstallStatus: function() {
-    AddonManager.getAddonByID(this.addonID, (addon) => {
-      if (addon && !addon.userDisabled) {
-        this.status = "installed";
-      } else {
-        this.status = "uninstalled";
-      }
-    });
+  updateInstallStatus: async function() {
+    let addon = await AddonManager.getAddonByID(this.addonID);
+    if (addon && !addon.userDisabled) {
+      this.status = "installed";
+    } else {
+      this.status = "uninstalled";
+    }
   },
 
-  install: function() {
-    AddonManager.getAddonByID(this.addonID, (addon) => {
-      if (addon && !addon.userDisabled) {
-        this.status = "installed";
-        return;
-      }
-      this.status = "preparing";
-      if (addon && addon.userDisabled) {
-        addon.userDisabled = false;
-      } else {
-        AddonManager.getInstallForURL(this.xpiLink, (install) => {
-          install.addListener(this);
-          install.install();
-        }, "application/x-xpinstall");
-      }
-    });
+  install: async function() {
+    let addon = await AddonManager.getAddonByID(this.addonID);
+    if (addon && !addon.userDisabled) {
+      this.status = "installed";
+      return;
+    }
+    this.status = "preparing";
+    if (addon && addon.userDisabled) {
+      addon.userDisabled = false;
+    } else {
+      let install = await AddonManager.getInstallForURL(this.xpiLink, null, "application/x-xpinstall");
+      install.addListener(this);
+      install.install();
+    }
   },
 
-  uninstall: function() {
-    AddonManager.getAddonByID(this.addonID, (addon) => {
-      addon.uninstall();
-    });
+  uninstall: async function() {
+    let addon = await AddonManager.getAddonByID(this.addonID);
+    addon.uninstall();
   },
 
   installFailureHandler: function(install, message) {
     this.status = "uninstalled";
     this.emit("failure", message);
   },
 
   onDownloadStarted: function() {
--- 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);
@@ -858,36 +857,32 @@ BrowserTabActor.prototype = {
 exports.BrowserTabActor = BrowserTabActor;
 
 function BrowserAddonList(connection) {
   this._connection = connection;
   this._actorByAddonId = new Map();
   this._onListChanged = null;
 }
 
-BrowserAddonList.prototype.getList = function() {
-  let deferred = defer();
-  AddonManager.getAllAddons((addons) => {
-    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);
-        }
+BrowserAddonList.prototype.getList = async function() {
+  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);
-      }
+      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/dom/workers/test/test_extensionBootstrap.xul
+++ b/dom/workers/test/test_extensionBootstrap.xul
@@ -15,38 +15,36 @@
 
   <script type="application/javascript">
   <![CDATA[
 
     function test() {
       const message = "woohoo";
 
       var observer = {
-        observe: function(subject, topic, data) {
+        observe: async function(subject, topic, data) {
           is(topic, "message", "Correct type of event");
           is(data, message, "Correct message");
 
-          AddonManager.getAddonByID("workerbootstrap-test@mozilla.org",
-                                    function(addon) {
-            addon.uninstall();
+          let addon = await AddonManager.getAddonByID("workerbootstrap-test@mozilla.org");
+          addon.uninstall();
 
-            const stages = [ "install", "startup", "shutdown", "uninstall" ];
-            const symbols = [ "Worker", "ChromeWorker" ];
+          const stages = [ "install", "startup", "shutdown", "uninstall" ];
+          const symbols = [ "Worker", "ChromeWorker" ];
 
-            for (var stage of stages) {
-              for (var symbol of symbols) {
-                is(Services.prefs.getBoolPref("workertest.bootstrap." + stage +
-                                              "." + symbol),
-                   true,
-                   "Symbol '" + symbol + "' present during '" + stage + "'");
-              }
+          for (var stage of stages) {
+            for (var symbol of symbols) {
+              is(Services.prefs.getBoolPref("workertest.bootstrap." + stage +
+                                            "." + symbol),
+                 true,
+                 "Symbol '" + symbol + "' present during '" + stage + "'");
             }
+          }
 
-            SimpleTest.finish();
-          });
+          SimpleTest.finish();
         },
         QueryInterface: XPCOMUtils.generateQI([Ci.nsIObserver])
       };
 
       var workertestbootstrap = Cc["@mozilla.org/test/workertestbootstrap;1"].
                                 createInstance(Ci.nsIObserver);
 
       workertestbootstrap.observe(observer, "postMessage", message);
--- a/toolkit/components/extensions/ExtensionTestCommon.jsm
+++ b/toolkit/components/extensions/ExtensionTestCommon.jsm
@@ -101,29 +101,28 @@ class MockExtension {
 
   startup() {
     if (this.installType == "temporary") {
       return AddonManager.installTemporaryAddon(this.file).then(addon => {
         this.addon = addon;
         return this._readyPromise;
       });
     } else if (this.installType == "permanent") {
-      return new Promise((resolve, reject) => {
-        AddonManager.getInstallForFile(this.file, install => {
-          let listener = {
-            onInstallFailed: reject,
-            onInstallEnded: (install, newAddon) => {
-              this.addon = newAddon;
-              resolve(this._readyPromise);
-            },
-          };
+      return new Promise(async (resolve, reject) => {
+        let install = await AddonManager.getInstallForFile(this.file);
+        let listener = {
+          onInstallFailed: reject,
+          onInstallEnded: (install, newAddon) => {
+            this.addon = newAddon;
+            resolve(this._readyPromise);
+          },
+        };
 
-          install.addListener(listener);
-          install.install();
-        });
+        install.addListener(listener);
+        install.install();
       });
     }
     throw new Error("installType must be one of: temporary, permanent");
   }
 
   shutdown() {
     this.addon.uninstall();
     return this.cleanupGeneratedFile();
--- a/toolkit/components/extensions/parent/ext-runtime.js
+++ b/toolkit/components/extensions/parent/ext-runtime.js
@@ -83,25 +83,24 @@ this.runtime = class extends ExtensionAP
             return () => {
               AddonManager.removeUpgradeListener(instanceID).catch(e => {
                 // This can happen if we try this after shutdown is complete.
               });
             };
           },
         }).api(),
 
-        reload: () => {
+        reload: async () => {
           if (extension.upgrade) {
             // If there is a pending update, install it now.
             extension.upgrade.install();
           } else {
             // Otherwise, reload the current extension.
-            AddonManager.getAddonByID(extension.id, addon => {
-              addon.reload();
-            });
+            let addon = await AddonManager.getAddonByID(extension.id);
+            addon.reload();
           }
         },
 
         get lastError() {
           // TODO(robwu): Figure out how to make sure that errors in the parent
           // process are propagated to the child process.
           // lastError should not be accessed from the parent.
           return context.lastError;
--- a/toolkit/components/extensions/test/xpcshell/test_ext_management_uninstall_self.js
+++ b/toolkit/components/extensions/test/xpcshell/test_ext_management_uninstall_self.js
@@ -15,23 +15,22 @@ const manifest = {
     },
   },
   name: "test extension name",
   version: "1.0",
 };
 
 const waitForUninstalled = () => new Promise(resolve => {
   const listener = {
-    onUninstalled: (addon) => {
+    onUninstalled: async (addon) => {
       equal(addon.id, id, "The expected add-on has been uninstalled");
-      AddonManager.getAddonByID(addon.id, checkedAddon => {
-        equal(checkedAddon, null, "Add-on no longer exists");
-        AddonManager.removeAddonListener(listener);
-        resolve();
-      });
+      let checkedAddon = await AddonManager.getAddonByID(addon.id);
+      equal(checkedAddon, null, "Add-on no longer exists");
+      AddonManager.removeAddonListener(listener);
+      resolve();
     },
   };
   AddonManager.addAddonListener(listener);
 });
 
 let promptService = {
   _response: null,
   QueryInterface: XPCOMUtils.generateQI([Ci.nsIPromptService]),
--- a/toolkit/components/normandy/lib/NormandyDriver.jsm
+++ b/toolkit/components/normandy/lib/NormandyDriver.jsm
@@ -98,26 +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(resolve => {
-        AddonManager.getAddonsByTypes(["plugin"], plugins => {
-          plugins.forEach(plugin => appinfo.plugins[plugin.name] = {
-            name: plugin.name,
-            description: plugin.description,
-            version: plugin.version,
-          });
-          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,
         });
-      });
+      })();
 
       return new sandbox.Promise(resolve => {
         Promise.all([searchEnginePromise, pluginsPromise]).then(() => {
           resolve(Cu.cloneInto(appinfo, sandbox));
         });
       });
     },
 
--- a/toolkit/modules/Troubleshoot.jsm
+++ b/toolkit/modules/Troubleshoot.jsm
@@ -223,41 +223,40 @@ var dataProviders = {
     data.keyGoogleFound = keyGoogle != "no-google-api-key" && keyGoogle.length > 0;
 
     const keyMozilla = Services.urlFormatter.formatURL("%MOZILLA_API_KEY%").trim();
     data.keyMozillaFound = keyMozilla != "no-mozilla-api-key" && keyMozilla.length > 0;
 
     done(data);
   },
 
-  extensions: function extensions(done) {
-    AddonManager.getAddonsByTypes(["extension"], function(extensions) {
-      extensions = extensions.filter(e => !e.isSystem);
-      extensions.sort(function(a, b) {
-        if (a.isActive != b.isActive)
-          return b.isActive ? 1 : -1;
+  extensions: async function extensions(done) {
+    let extensions = await AddonManager.getAddonsByTypes(["extension"]);
+    extensions = extensions.filter(e => !e.isSystem);
+    extensions.sort(function(a, b) {
+      if (a.isActive != b.isActive)
+        return b.isActive ? 1 : -1;
 
-        // In some unfortunate cases addon names can be null.
-        let aname = a.name || null;
-        let bname = b.name || null;
-        let lc = aname.localeCompare(bname);
-        if (lc != 0)
-          return lc;
-        if (a.version != b.version)
-          return a.version > b.version ? 1 : -1;
-        return 0;
-      });
-      let props = ["name", "version", "isActive", "id"];
-      done(extensions.map(function(ext) {
-        return props.reduce(function(extData, prop) {
-          extData[prop] = ext[prop];
-          return extData;
-        }, {});
-      }));
+      // In some unfortunate cases addon names can be null.
+      let aname = a.name || null;
+      let bname = b.name || null;
+      let lc = aname.localeCompare(bname);
+      if (lc != 0)
+        return lc;
+      if (a.version != b.version)
+        return a.version > b.version ? 1 : -1;
+      return 0;
     });
+    let props = ["name", "version", "isActive", "id"];
+    done(extensions.map(function(ext) {
+      return props.reduce(function(extData, prop) {
+        extData[prop] = ext[prop];
+        return extData;
+      }, {});
+    }));
   },
 
   securitySoftware: function securitySoftware(done) {
     let data = {};
 
     let sysInfo = Cc["@mozilla.org/system-info;1"].
                   getService(Ci.nsIPropertyBag2);
 
@@ -271,38 +270,37 @@ var dataProviders = {
       }
 
       data[key] = prop;
     }
 
     done(data);
   },
 
-  features: function features(done) {
-    AddonManager.getAddonsByTypes(["extension"], function(features) {
-      features = features.filter(f => f.isSystem);
-      features.sort(function(a, b) {
-        // In some unfortunate cases addon names can be null.
-        let aname = a.name || null;
-        let bname = b.name || null;
-        let lc = aname.localeCompare(bname);
-        if (lc != 0)
-          return lc;
-        if (a.version != b.version)
-          return a.version > b.version ? 1 : -1;
-        return 0;
-      });
-      let props = ["name", "version", "id"];
-      done(features.map(function(f) {
-        return props.reduce(function(fData, prop) {
-          fData[prop] = f[prop];
-          return fData;
-        }, {});
-      }));
+  features: async function features(done) {
+    let features = await AddonManager.getAddonsByTypes(["extension"]);
+    features = features.filter(f => f.isSystem);
+    features.sort(function(a, b) {
+      // In some unfortunate cases addon names can be null.
+      let aname = a.name || null;
+      let bname = b.name || null;
+      let lc = aname.localeCompare(bname);
+      if (lc != 0)
+        return lc;
+      if (a.version != b.version)
+        return a.version > b.version ? 1 : -1;
+      return 0;
     });
+    let props = ["name", "version", "id"];
+    done(features.map(function(f) {
+      return props.reduce(function(fData, prop) {
+        fData[prop] = f[prop];
+        return fData;
+      }, {});
+    }));
   },
 
   modifiedPreferences: function modifiedPreferences(done) {
     done(getPrefList(name => Services.prefs.prefHasUserValue(name)));
   },
 
   lockedPreferences: function lockedPreferences(done) {
     done(getPrefList(name => Services.prefs.prefIsLocked(name)));
--- a/toolkit/mozapps/extensions/AddonManager.jsm
+++ b/toolkit/mozapps/extensions/AddonManager.jsm
@@ -1134,32 +1134,31 @@ var AddonManagerInternal = {
     gStartupComplete = false;
     gShutdownBarrier = null;
     gShutdownInProgress = false;
     if (savedError) {
       throw savedError;
     }
   },
 
-  requestPlugins({ target: port }) {
+  async requestPlugins({ target: port }) {
     // Lists all the properties that plugins.html needs
     const NEEDED_PROPS = ["name", "pluginLibraries", "pluginFullpath", "version",
                           "isActive", "blocklistState", "description",
                           "pluginMimeTypes"];
     function filterProperties(plugin) {
       let filtered = {};
       for (let prop of NEEDED_PROPS) {
         filtered[prop] = plugin[prop];
       }
       return filtered;
     }
 
-    AddonManager.getAddonsByTypes(["plugin"], function(aPlugins) {
-      port.sendAsyncMessage("PluginList", aPlugins.map(filterProperties));
-    });
+    let aPlugins = await AddonManager.getAddonsByTypes(["plugin"]);
+    port.sendAsyncMessage("PluginList", aPlugins.map(filterProperties));
   },
 
   /**
    * Notified when a preference we're interested in has changed.
    *
    * @see nsIObserver
    */
   observe(aSubject, aTopic, aData) {
@@ -2735,22 +2734,18 @@ var AddonManagerInternal = {
     installs: new Map(),
     nextInstall: 0,
 
     sendEvent: null,
     setEventHandler(fn) {
       this.sendEvent = fn;
     },
 
-    getAddonByID(target, id) {
-      return new Promise(resolve => {
-        AddonManager.getAddonByID(id, (addon) => {
-          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/addonManager.js
+++ b/toolkit/mozapps/extensions/addonManager.js
@@ -66,24 +66,24 @@ amManager.prototype = {
       case "message-manager-close":
       case "message-manager-disconnect":
         this.childClosed(aSubject);
         break;
     }
   },
 
   installAddonFromWebpage(aMimetype, aBrowser, aInstallingPrincipal,
-                                    aUri, aHash, aName, aIcon, aCallback) {
+                          aUri, aHash, aName, aIcon, aCallback) {
     let retval = true;
     if (!AddonManager.isInstallAllowed(aMimetype, aInstallingPrincipal)) {
       aCallback = null;
       retval = false;
     }
 
-    AddonManager.getInstallForURL(aUri, function(aInstall) {
+    AddonManager.getInstallForURL(aUri, null, aMimetype, aHash, aName, aIcon, null, aBrowser).then(aInstall => {
       function callCallback(uri, status) {
         try {
           aCallback.onInstallEnded(uri, status);
         } catch (e) {
           Cu.reportError(e);
         }
       }
 
@@ -111,17 +111,17 @@ amManager.prototype = {
 
           onInstallEnded(aInstall, aStatus) {
             callCallback(aUri, SUCCESS);
           }
         });
       }
 
       AddonManager.installAddonFromWebpage(aMimetype, aBrowser, aInstallingPrincipal, aInstall);
-    }, aMimetype, aHash, aName, aIcon, null, aBrowser);
+    });
 
     return retval;
   },
 
   notify(aTimer) {
     AddonManagerPrivate.backgroundUpdateTimerHandler();
   },
 
--- a/toolkit/mozapps/extensions/content/extensions.js
+++ b/toolkit/mozapps/extensions/content/extensions.js
@@ -932,23 +932,22 @@ var gViewController = {
         }
       }
     },
 
     cmd_resetAddonAutoUpdate: {
       isEnabled() {
         return true;
       },
-      doCommand() {
-        AddonManager.getAllAddons(function(aAddonList) {
-          for (let addon of aAddonList) {
-            if ("applyBackgroundUpdates" in addon)
-              addon.applyBackgroundUpdates = AddonManager.AUTOUPDATE_DEFAULT;
-          }
-        });
+      async doCommand() {
+        let aAddonList = await AddonManager.getAllAddons();
+        for (let addon of aAddonList) {
+          if ("applyBackgroundUpdates" in addon)
+            addon.applyBackgroundUpdates = AddonManager.AUTOUPDATE_DEFAULT;
+        }
       }
     },
 
     cmd_goToDiscoverPane: {
       isEnabled() {
         return gDiscoverView.enabled;
       },
       doCommand() {
@@ -985,17 +984,17 @@ var gViewController = {
       }
     },
 
     cmd_findAllUpdates: {
       inProgress: false,
       isEnabled() {
         return !this.inProgress;
       },
-      doCommand() {
+      async doCommand() {
         this.inProgress = true;
         gViewController.updateCommand("cmd_findAllUpdates");
         document.getElementById("updates-noneFound").hidden = true;
         document.getElementById("updates-progress").hidden = false;
         document.getElementById("updates-manualUpdatesFound-btn").hidden = true;
 
         var pendingChecks = 0;
         var numUpdated = 0;
@@ -1064,28 +1063,27 @@ var gViewController = {
             updateStatus();
           },
           onUpdateFinished(aAddon, aError) {
             gEventManager.delegateAddonEvent("onUpdateFinished",
                                              [aAddon, aError]);
           }
         };
 
-        AddonManager.getAddonsByTypes(null, function(aAddonList) {
-          for (let addon of aAddonList) {
-            if (addon.permissions & AddonManager.PERM_CAN_UPGRADE) {
-              pendingChecks++;
-              addon.findUpdates(updateCheckListener,
-                                AddonManager.UPDATE_WHEN_USER_REQUESTED);
-            }
+        let aAddonList = await AddonManager.getAddonsByTypes(null);
+        for (let addon of aAddonList) {
+          if (addon.permissions & AddonManager.PERM_CAN_UPGRADE) {
+            pendingChecks++;
+            addon.findUpdates(updateCheckListener,
+                              AddonManager.UPDATE_WHEN_USER_REQUESTED);
           }
-
-          if (pendingChecks == 0)
-            updateStatus();
-        });
+        }
+
+        if (pendingChecks == 0)
+          updateStatus();
       }
     },
 
     cmd_findItemUpdates: {
       isEnabled(aAddon) {
         if (!aAddon)
           return false;
         return hasPermission(aAddon, "upgrade");
@@ -1248,27 +1246,26 @@ var gViewController = {
                 gStrings.ext.GetStringFromName("installFromFile.dialogTitle"),
                 nsIFilePicker.modeOpenMultiple);
         try {
           fp.appendFilter(gStrings.ext.GetStringFromName("installFromFile.filterName"),
                           "*.xpi;*.jar;*.zip");
           fp.appendFilters(nsIFilePicker.filterAll);
         } catch (e) { }
 
-        fp.open(result => {
+        fp.open(async result => {
           if (result != nsIFilePicker.returnOK)
             return;
 
           let browser = getBrowserElement();
           let files = fp.files;
           while (files.hasMoreElements()) {
             let file = files.getNext();
-            AddonManager.getInstallForFile(file, install => {
-              AddonManager.installAddonFromAOM(browser, document.documentURIObject, install);
-            });
+            let install = await AddonManager.getInstallForFile(file);
+            AddonManager.installAddonFromAOM(browser, document.documentURIObject, install);
           }
         });
       }
     },
 
     cmd_debugAddons: {
       isEnabled() {
         return true;
@@ -1633,36 +1630,33 @@ function sortList(aList, aSortBy, aAscen
 
   while (aList.listChild)
     aList.removeChild(aList.lastChild);
 
   for (let element of elements)
     aList.appendChild(element);
 }
 
-function getAddonsAndInstalls(aType, aCallback) {
+async function getAddonsAndInstalls(aType, aCallback) {
   let addons = null, installs = null;
   let types = (aType != null) ? [aType] : null;
 
-  AddonManager.getAddonsByTypes(types, function(aAddonsList) {
-    addons = aAddonsList.filter(a => !a.hidden);
-    if (installs != null)
-      aCallback(addons, installs);
+  let aAddonsList = await AddonManager.getAddonsByTypes(types);
+  addons = aAddonsList.filter(a => !a.hidden);
+  if (installs != null)
+    aCallback(addons, installs);
+
+  let aInstallsList = await AddonManager.getInstallsByTypes(types);
+  installs = aInstallsList.filter(function(aInstall) {
+    return !(aInstall.existingAddon ||
+             aInstall.state == AddonManager.STATE_AVAILABLE);
   });
 
-  AddonManager.getInstallsByTypes(types, function(aInstallsList) {
-    // skip over upgrade installs and non-active installs
-    installs = aInstallsList.filter(function(aInstall) {
-      return !(aInstall.existingAddon ||
-               aInstall.state == AddonManager.STATE_AVAILABLE);
-    });
-
-    if (addons != null)
-      aCallback(addons, installs);
-  });
+  if (addons != null)
+    aCallback(addons, installs);
 }
 
 function doPendingUninstalls(aListBox) {
   // Uninstalling add-ons can mutate the list so find the add-ons first then
   // uninstall them
   var items = [];
   var listitem = aListBox.firstChild;
   while (listitem) {
@@ -1961,17 +1955,17 @@ var gDiscoverView = {
   loaded: false,
   _browser: null,
   _loading: null,
   _error: null,
   homepageURL: null,
   _loadListeners: [],
   hideHeader: true,
 
-  initialize() {
+  async initialize() {
     this.enabled = isDiscoverEnabled();
     if (!this.enabled) {
       gCategories.get("addons://discover/").hidden = true;
       return;
     }
 
     this.node = document.getElementById("discover-view");
     this._loading = document.getElementById("discover-loading");
@@ -2006,37 +2000,36 @@ var gDiscoverView = {
     };
 
     if (!Services.prefs.getBoolPref(PREF_GETADDONS_CACHE_ENABLED)) {
       setURL(url);
       return;
     }
 
     gPendingInitializations++;
-    AddonManager.getAllAddons(function(aAddons) {
-      var list = {};
-      for (let addon of aAddons) {
-        var prefName = PREF_GETADDONS_CACHE_ID_ENABLED.replace("%ID%",
-                                                               addon.id);
-        try {
-          if (!Services.prefs.getBoolPref(prefName))
-            continue;
-        } catch (e) { }
-        list[addon.id] = {
-          name: addon.name,
-          version: addon.version,
-          type: addon.type,
-          userDisabled: addon.userDisabled,
-          isCompatible: addon.isCompatible,
-          isBlocklisted: addon.blocklistState == Ci.nsIBlocklistService.STATE_BLOCKED
-        };
-      }
-
-      setURL(url + "#" + JSON.stringify(list));
-    });
+    let aAddons = await AddonManager.getAllAddons();
+    var list = {};
+    for (let addon of aAddons) {
+      var prefName = PREF_GETADDONS_CACHE_ID_ENABLED.replace("%ID%",
+                                                             addon.id);
+      try {
+        if (!Services.prefs.getBoolPref(prefName))
+          continue;
+      } catch (e) { }
+      list[addon.id] = {
+        name: addon.name,
+        version: addon.version,
+        type: addon.type,
+        userDisabled: addon.userDisabled,
+        isCompatible: addon.isCompatible,
+        isBlocklisted: addon.blocklistState == Ci.nsIBlocklistService.STATE_BLOCKED
+      };
+    }
+
+    setURL(url + "#" + JSON.stringify(list));
   },
 
   destroy() {
     try {
       this._browser.removeProgressListener(this);
     } catch (e) {
       // Ignore the case when the listener wasn't already registered
     }
@@ -2761,53 +2754,51 @@ var gDetailView = {
     }
 
     this.fillSettingsRows(aScrollToPreferences, () => {
       this.updateState();
       gViewController.notifyViewChanged();
     });
   },
 
-  show(aAddonId, aRequest) {
+  async show(aAddonId, aRequest) {
     let index = aAddonId.indexOf("/preferences");
     let scrollToPreferences = false;
     if (index >= 0) {
       aAddonId = aAddonId.substring(0, index);
       scrollToPreferences = true;
     }
 
     this._loadingTimer = setTimeout(() => {
       this.node.setAttribute("loading-extended", true);
     }, LOADING_MSG_DELAY);
 
-    AddonManager.getAddonByID(aAddonId, (aAddon) => {
-      if (gViewController && aRequest != gViewController.currentViewRequest)
-        return;
-
-      if (aAddon) {
-        this._updateView(aAddon, false, scrollToPreferences);
+    let aAddon = await AddonManager.getAddonByID(aAddonId);
+    if (gViewController && aRequest != gViewController.currentViewRequest)
+      return;
+
+    if (aAddon) {
+      this._updateView(aAddon, false, scrollToPreferences);
+      return;
+    }
+
+    // Look for an add-on pending install
+    let aInstalls = await AddonManager.getAllInstalls();
+    for (let install of aInstalls) {
+      if (install.state == AddonManager.STATE_INSTALLED &&
+          install.addon.id == aAddonId) {
+        this._updateView(install.addon, false);
         return;
       }
-
-      // Look for an add-on pending install
-      AddonManager.getAllInstalls(aInstalls => {
-        for (let install of aInstalls) {
-          if (install.state == AddonManager.STATE_INSTALLED &&
-              install.addon.id == aAddonId) {
-            this._updateView(install.addon, false);
-            return;
-          }
-        }
-
-        // This might happen due to session restore restoring us back to an
-        // add-on that doesn't exist but otherwise shouldn't normally happen.
-        // Either way just revert to the default view.
-        gViewController.replaceView(gViewDefault);
-      });
-    });
+    }
+
+    // This might happen due to session restore restoring us back to an
+    // add-on that doesn't exist but otherwise shouldn't normally happen.
+    // Either way just revert to the default view.
+    gViewController.replaceView(gViewDefault);
   },
 
   hide() {
     AddonManager.removeManagerListener(this);
     this.clearLoading();
     if (this._addon) {
       if (hasInlineOptions(this._addon)) {
         Services.obs.notifyObservers(document,
@@ -3275,87 +3266,85 @@ var gUpdatesView = {
   },
 
   hide() {
     this._updateSelected.hidden = true;
     this._categoryItem.disabled = this._categoryItem.badgeCount == 0;
     doPendingUninstalls(this._listBox);
   },
 
-  _showRecentUpdates(aRequest) {
-    AddonManager.getAllAddons((aAddonsList) => {
-      if (gViewController && aRequest != gViewController.currentViewRequest)
-        return;
-
-      var elements = [];
-      let threshold = Date.now() - UPDATES_RECENT_TIMESPAN;
-      for (let addon of aAddonsList) {
-        if (addon.hidden || !addon.updateDate || addon.updateDate.getTime() < threshold)
-          continue;
-
-        elements.push(createItem(addon));
-      }
-
-      this.showEmptyNotice(elements.length == 0);
-      if (elements.length > 0) {
-        sortElements(elements, ["updateDate"], false);
-        for (let element of elements)
-          this._listBox.appendChild(element);
-      }
-
-      gViewController.notifyViewChanged();
-    });
+  async _showRecentUpdates(aRequest) {
+    let aAddonsList = await AddonManager.getAllAddons();
+    if (gViewController && aRequest != gViewController.currentViewRequest)
+      return;
+
+    var elements = [];
+    let threshold = Date.now() - UPDATES_RECENT_TIMESPAN;
+    for (let addon of aAddonsList) {
+      if (addon.hidden || !addon.updateDate || addon.updateDate.getTime() < threshold)
+        continue;
+
+      elements.push(createItem(addon));
+    }
+
+    this.showEmptyNotice(elements.length == 0);
+    if (elements.length > 0) {
+      sortElements(elements, ["updateDate"], false);
+      for (let element of elements)
+        this._listBox.appendChild(element);
+    }
+
+    gViewController.notifyViewChanged();
   },
 
-  _showAvailableUpdates(aIsRefresh, aRequest) {
+  async _showAvailableUpdates(aIsRefresh, aRequest) {
     /* Disable the Update Selected button so it can't get clicked
        before everything is initialized asynchronously.
        It will get re-enabled by maybeDisableUpdateSelected(). */
     this._updateSelected.disabled = true;
 
-    AddonManager.getAllInstalls((aInstallsList) => {
-      if (!aIsRefresh && gViewController && aRequest &&
-          aRequest != gViewController.currentViewRequest)
-        return;
-
-      if (aIsRefresh) {
-        this.showEmptyNotice(false);
-        this._updateSelected.hidden = true;
-
-        while (this._listBox.childNodes.length > 0)
-          this._listBox.firstChild.remove();
-      }
-
-      var elements = [];
-
-      for (let install of aInstallsList) {
-        if (!this.isManualUpdate(install))
-          continue;
-
-        let item = createItem(install.existingAddon);
-        item.setAttribute("upgrade", true);
-        item.addEventListener("IncludeUpdateChanged", () => {
-          this.maybeDisableUpdateSelected();
-        });
-        elements.push(item);
-      }
-
-      this.showEmptyNotice(elements.length == 0);
-      if (elements.length > 0) {
-        this._updateSelected.hidden = false;
-        sortElements(elements, ["updateDate"], false);
-        for (let element of elements)
-          this._listBox.appendChild(element);
-      }
-
-      // ensure badge count is in sync
-      this._categoryItem.badgeCount = this._listBox.itemCount;
-
-      gViewController.notifyViewChanged();
-    });
+    let aInstallsList = await AddonManager.getAllInstalls();
+    if (!aIsRefresh && gViewController && aRequest &&
+        aRequest != gViewController.currentViewRequest)
+      return;
+
+    if (aIsRefresh) {
+      this.showEmptyNotice(false);
+      this._updateSelected.hidden = true;
+
+      while (this._listBox.childNodes.length > 0)
+        this._listBox.firstChild.remove();
+    }
+
+    var elements = [];
+
+    for (let install of aInstallsList) {
+      if (!this.isManualUpdate(install))
+        continue;
+
+      let item = createItem(install.existingAddon);
+      item.setAttribute("upgrade", true);
+      item.addEventListener("IncludeUpdateChanged", () => {
+        this.maybeDisableUpdateSelected();
+      });
+      elements.push(item);
+    }
+
+    this.showEmptyNotice(elements.length == 0);
+    if (elements.length > 0) {
+      this._updateSelected.hidden = false;
+      sortElements(elements, ["updateDate"], false);
+      for (let element of elements)
+        this._listBox.appendChild(element);
+    }
+
+    // ensure badge count is in sync
+    this._categoryItem.badgeCount = this._listBox.itemCount;
+
+    gViewController.notifyViewChanged();
   },
 
   showEmptyNotice(aShow) {
     this._emptyNotice.hidden = !aShow;
     this._listBox.hidden = aShow;
   },
 
   isManualUpdate(aInstall, aOnlyAvailable) {
@@ -3367,29 +3356,28 @@ var gUpdatesView = {
   },
 
   maybeRefresh() {
     if (gViewController.currentViewId == "addons://updates/available")
       this._showAvailableUpdates(true);
     this.updateAvailableCount();
   },
 
-  updateAvailableCount(aInitializing) {
+  async updateAvailableCount(aInitializing) {
     if (aInitializing)
       gPendingInitializations++;
-    AddonManager.getAllInstalls((aInstallsList) => {
-      var count = aInstallsList.filter(aInstall => {
-        return this.isManualUpdate(aInstall, true);
-      }).length;
-      this._categoryItem.disabled = gViewController.currentViewId != "addons://updates/available" &&
-                                    count == 0;
-      this._categoryItem.badgeCount = count;
-      if (aInitializing)
-        notifyInitialized();
-    });
+    let aInstallsList = await AddonManager.getAllInstalls();
+    var count = aInstallsList.filter(aInstall => {
+      return this.isManualUpdate(aInstall, true);
+    }).length;
+    this._categoryItem.disabled = gViewController.currentViewId != "addons://updates/available" &&
+                                  count == 0;
+    this._categoryItem.badgeCount = count;
+    if (aInitializing)
+      notifyInitialized();
   },
 
   maybeDisableUpdateSelected() {
     for (let item of this._listBox.childNodes) {
       if (item.includeUpdate) {
         this._updateSelected.disabled = false;
         return;
       }
@@ -3457,17 +3445,19 @@ 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();
   },
 
-  onDrop(aEvent) {
+  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);
@@ -3477,23 +3467,20 @@ var gDragDrop = {
       } else {
         let file = dataTransfer.mozGetDataAt("application/x-moz-file", i);
         if (file) {
           url = Services.io.newFileURI(file).spec;
         }
       }
 
       if (url) {
-        AddonManager.getInstallForURL(url, install => {
-          AddonManager.installAddonFromAOM(browser, document.documentURIObject, install);
-        }, "application/x-xpinstall");
+        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
@@ -5968,39 +5968,38 @@ class SystemAddonInstallLocation extends
     }
 
     return true;
   }
 
   /**
    * Resets the add-on set so on the next startup the default set will be used.
    */
-  resetAddonSet() {
+  async resetAddonSet() {
     logger.info("Removing all system add-on upgrades.");
 
     // remove everything from the pref first, if uninstall
     // fails then at least they will not be re-activated on
     // next restart.
     this._addonSet = { schema: 1, addons: {} };
     SystemAddonInstallLocation._saveAddonSet(this._addonSet);
 
     // 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)) {
-        AddonManager.getAddonByID(id, addon => {
-          if (addon) {
-            addon.uninstall();
-          }
-        });
+      let ids = Object.keys(this._addonSet.addons);
+      for (let addon of await AddonManager.getAddonsByIDs(ids)) {
+        if (addon) {
+          addon.uninstall();
+        }
       }
     }
   }
 
   /**
    * Removes any directories not currently in use or pending use after a
    * restart. Any errors that happen here don't really matter as we'll attempt
    * to cleanup again next time.
--- a/toolkit/mozapps/extensions/test/AddonManagerTesting.jsm
+++ b/toolkit/mozapps/extensions/test/AddonManagerTesting.jsm
@@ -31,82 +31,80 @@ var AddonManagerTesting = {
    * Uninstall an add-on that is specified by its ID.
    *
    * The returned promise resolves on successful uninstall and rejects
    * if the add-on is not unknown.
    *
    * @return Promise<restartRequired>
    */
   uninstallAddonByID(id) {
-    return new Promise((resolve, reject) => {
+    return new Promise(async (resolve, reject) => {
 
-      AddonManager.getAddonByID(id, (addon) => {
-        if (!addon) {
-          reject(new Error("Add-on is not known: " + id));
-          return;
-        }
+      let addon = await AddonManager.getAddonByID(id);
+      if (!addon) {
+        reject(new Error("Add-on is not known: " + id));
+        return;
+      }
 
-        let listener = {
-          onUninstalling(addon, needsRestart) {
-            if (addon.id != id) {
-              return;
-            }
+      let listener = {
+        onUninstalling(addon, needsRestart) {
+          if (addon.id != id) {
+            return;
+          }
 
-            if (needsRestart) {
-              AddonManager.removeAddonListener(listener);
-              resolve(true);
-            }
-          },
+          if (needsRestart) {
+            AddonManager.removeAddonListener(listener);
+            resolve(true);
+          }
+        },
 
-          onUninstalled(addon) {
-            if (addon.id != id) {
-              return;
-            }
+        onUninstalled(addon) {
+          if (addon.id != id) {
+            return;
+          }
 
-            AddonManager.removeAddonListener(listener);
-            resolve(false);
-          },
+          AddonManager.removeAddonListener(listener);
+          resolve(false);
+        },
 
-          onOperationCancelled(addon) {
-            if (addon.id != id) {
-              return;
-            }
+        onOperationCancelled(addon) {
+          if (addon.id != id) {
+            return;
+          }
 
-            AddonManager.removeAddonListener(listener);
-            reject(new Error("Uninstall cancelled."));
-          },
-        };
+          AddonManager.removeAddonListener(listener);
+          reject(new Error("Uninstall cancelled."));
+        },
+      };
 
-        AddonManager.addAddonListener(listener);
-        addon.uninstall();
-      });
+      AddonManager.addAddonListener(listener);
+      addon.uninstall();
 
     });
   },
 
   /**
    * Install an XPI add-on from a URL.
    *
    * @return Promise<addon>
    */
   installXPIFromURL(url, hash, name, iconURL, version) {
-    return new Promise((resolve, reject) => {
+    return new Promise(async (resolve, reject) => {
 
-      AddonManager.getInstallForURL(url, (install) => {
-        let fail = () => { reject(new Error("Add-on install failed.")); };
+      let install = await AddonManager.getInstallForURL(url, null, "application/x-xpinstall", hash, name, iconURL, version);
+      let fail = () => { reject(new Error("Add-on install failed.")); };
 
-        let listener = {
-          onDownloadCancelled: fail,
-          onDownloadFailed: fail,
-          onInstallCancelled: fail,
-          onInstallFailed: fail,
-          onInstallEnded(install, addon) {
-            resolve(addon);
-          },
-        };
+      let listener = {
+        onDownloadCancelled: fail,
+        onDownloadFailed: fail,
+        onInstallCancelled: fail,
+        onInstallFailed: fail,
+        onInstallEnded(install, addon) {
+          resolve(addon);
+        },
+      };
 
-        install.addListener(listener);
-        install.install();
-      }, "application/x-xpinstall", hash, name, iconURL, version);
+      install.addListener(listener);
+      install.install();
 
     });
   },
 };
--- a/toolkit/mozapps/extensions/test/browser/browser.ini
+++ b/toolkit/mozapps/extensions/test/browser/browser.ini
@@ -46,17 +46,16 @@ skip-if = buildapp == 'mulet'
 [browser_bug577990.js]
 [browser_bug580298.js]
 [browser_bug586574.js]
 [browser_bug587970.js]
 [browser_bug591465.js]
 skip-if = os == "linux" && !debug # Bug 1395539 - fails on multi-core
 [browser_bug591663.js]
 [browser_bug596336.js]
-[browser_bug616841.js]
 [browser_bug618502.js]
 [browser_bug679604.js]
 [browser_bug590347.js]
 [browser_checkAddonCompatibility.js]
 [browser_details.js]
 [browser_discovery.js]
 [browser_dragdrop.js]
 skip-if = buildapp == 'mulet'
--- a/toolkit/mozapps/extensions/test/browser/browser_bug591465.js
+++ b/toolkit/mozapps/extensions/test/browser/browser_bug591465.js
@@ -293,25 +293,24 @@ add_test(function() {
 
 
 add_test(function() {
   LightweightThemeManager.currentTheme = null;
 
   gManagerWindow.loadView("addons://detail/4@personas.mozilla.org");
   wait_for_view_load(gManagerWindow, function() {
 
-    gContextMenu.addEventListener("popupshown", function() {
+    gContextMenu.addEventListener("popupshown", async function() {
       check_contextmenu(true, false, false, true, false);
 
       gContextMenu.hidePopup();
 
-      AddonManager.getAddonByID("4@personas.mozilla.org", function(aAddon) {
-        aAddon.uninstall();
-        run_next_test();
-      });
+      let aAddon = await AddonManager.getAddonByID("4@personas.mozilla.org");
+      aAddon.uninstall();
+      run_next_test();
     }, {once: true});
 
     info("Opening context menu on disabled LW theme, in detail view");
     var el = gManagerWindow.document.querySelector("#detail-view .detail-view-container");
     EventUtils.synthesizeMouse(el, 4, 4, { }, gManagerWindow);
     EventUtils.synthesizeMouse(el, 4, 4, { type: "contextmenu", button: 2 }, gManagerWindow);
   });
 });
--- a/toolkit/mozapps/extensions/test/browser/browser_bug596336.js
+++ b/toolkit/mozapps/extensions/test/browser/browser_bug596336.js
@@ -21,26 +21,24 @@ function get_node(parent, anonid) {
   return parent.ownerDocument.getAnonymousElementByAttribute(parent, "anonid", anonid);
 }
 
 function get_class_node(parent, cls) {
   return parent.ownerDocument.getAnonymousElementByAttribute(parent, "class", cls);
 }
 
 function install_addon(aXpi) {
-  return new Promise(resolve => {
-    AddonManager.getInstallForURL(TESTROOT + "addons/" + aXpi + ".xpi",
-                                  function(aInstall) {
-      aInstall.addListener({
-        onInstallEnded(aInstall) {
-          resolve();
-        }
-      });
-      aInstall.install();
-    }, "application/x-xpinstall");
+  return new Promise(async resolve => {
+    let aInstall = await AddonManager.getInstallForURL(TESTROOT + "addons/" + aXpi + ".xpi", null, "application/x-xpinstall");
+    aInstall.addListener({
+      onInstallEnded(aInstall) {
+        resolve();
+      }
+    });
+    aInstall.install();
   });
 }
 
 var check_addon = async function(aAddon, aVersion) {
   is(get_list_item_count(), 1, "Should be one item in the list");
   is(aAddon.version, aVersion, "Add-on should have the right version");
 
   let item = get_addon_element(gManagerWindow, "bug596336-1@tests.mozilla.org");
deleted file mode 100644
--- a/toolkit/mozapps/extensions/test/browser/browser_bug616841.js
+++ /dev/null
@@ -1,21 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/
- */
-
-function test_string_compare() {
-  ok("C".localeCompare("D") < 0, "C < D");
-  ok("D".localeCompare("C") > 0, "D > C");
-  ok("\u010C".localeCompare("D") < 0, "\u010C < D");
-  ok("D".localeCompare("\u010C") > 0, "D > \u010C");
-}
-
-function test() {
-  waitForExplicitFinish();
-
-  test_string_compare();
-
-  AddonManager.getAddonByID("foo", function(aAddon) {
-    test_string_compare();
-    finish();
-  });
-}
--- a/toolkit/mozapps/extensions/test/browser/browser_checkAddonCompatibility.js
+++ b/toolkit/mozapps/extensions/test/browser/browser_checkAddonCompatibility.js
@@ -1,31 +1,29 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 // Test that all bundled add-ons are compatible.
 
-function test() {
+async function test() {
   waitForExplicitFinish();
 
   Services.prefs.setBoolPref(PREF_STRICT_COMPAT, true);
   ok(AddonManager.strictCompatibility, "Strict compatibility should be enabled");
 
-  AddonManager.getAllAddons(function gAACallback(aAddons) {
-    // Sort add-ons (by type and name) to improve output.
-    aAddons.sort(function compareTypeName(a, b) {
-      return a.type.localeCompare(b.type) || a.name.localeCompare(b.name);
-    });
+  let aAddons = await AddonManager.getAllAddons();
+  aAddons.sort(function compareTypeName(a, b) {
+    return a.type.localeCompare(b.type) || a.name.localeCompare(b.name);
+  });
 
-    let allCompatible = true;
-    for (let a of aAddons) {
-      // Ignore plugins.
-      if (a.type == "plugin")
-        continue;
+  let allCompatible = true;
+  for (let a of aAddons) {
+    // Ignore plugins.
+    if (a.type == "plugin")
+      continue;
 
-      ok(a.isCompatible, a.type + " " + a.name + " " + a.version + " should be compatible");
-      allCompatible = allCompatible && a.isCompatible;
-    }
+    ok(a.isCompatible, a.type + " " + a.name + " " + a.version + " should be compatible");
+    allCompatible = allCompatible && a.isCompatible;
+  }
 
-    finish();
-  });
+  finish();
 }
--- a/toolkit/mozapps/extensions/test/browser/browser_details.js
+++ b/toolkit/mozapps/extensions/test/browser/browser_details.js
@@ -604,32 +604,31 @@ add_test(function() {
     is_element_hidden(get("detail-error"), "Error message should be hidden");
     is_element_hidden(get("detail-pending"), "Pending message should be hidden");
 
     run_next_test();
   });
 });
 
 // Check that onPropertyChanges for appDisabled updates the UI
-add_test(function() {
+add_test(async function() {
   info("Checking that onPropertyChanges for appDisabled updates the UI");
 
-  AddonManager.getAddonByID("addon1@tests.mozilla.org", function(aAddon) {
-    aAddon.userDisabled = true;
-    aAddon.isCompatible = true;
-    aAddon.appDisabled = false;
+  let aAddon = await AddonManager.getAddonByID("addon1@tests.mozilla.org");
+  aAddon.userDisabled = true;
+  aAddon.isCompatible = true;
+  aAddon.appDisabled = false;
 
-    open_details("addon1@tests.mozilla.org", "extension", function() {
-      is(get("detail-view").getAttribute("active"), "false", "Addon should not be marked as active");
-      is_element_hidden(get("detail-warning"), "Warning message should not be visible");
+  open_details("addon1@tests.mozilla.org", "extension", function() {
+    is(get("detail-view").getAttribute("active"), "false", "Addon should not be marked as active");
+    is_element_hidden(get("detail-warning"), "Warning message should not be visible");
 
-      info("Making addon incompatible and appDisabled");
-      aAddon.isCompatible = false;
-      aAddon.appDisabled = true;
+    info("Making addon incompatible and appDisabled");
+    aAddon.isCompatible = false;
+    aAddon.appDisabled = true;
 
-      is(get("detail-view").getAttribute("active"), "false", "Addon should not be marked as active");
-      is_element_visible(get("detail-warning"), "Warning message should be visible");
-      is(get("detail-warning").textContent, "Test add-on replacement is incompatible with " + gApp + " " + gVersion + ".", "Warning message should be correct");
+    is(get("detail-view").getAttribute("active"), "false", "Addon should not be marked as active");
+    is_element_visible(get("detail-warning"), "Warning message should be visible");
+    is(get("detail-warning").textContent, "Test add-on replacement is incompatible with " + gApp + " " + gVersion + ".", "Warning message should be correct");
 
-      run_next_test();
-    });
+    run_next_test();
   });
 });
--- 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;
 }
 
-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
@@ -123,36 +122,34 @@ function testHash(aBrowser, aTestAddonVi
     ok(!("addon2@tests.mozilla.org" in data), "Test add-on 2 should not be listed");
   if (aTestAddonVisible[2])
     ok("addon3@tests.mozilla.org" in data, "Test add-on 3 should be listed");
   else
     ok(!("addon3@tests.mozilla.org" in data), "Test add-on 3 should not be listed");
 
   // Test against all the add-ons the manager knows about since plugins and
   // app extensions may exist
-  AddonManager.getAllAddons(function(aAddons) {
-    for (let addon of aAddons) {
-      if (!(addon.id in data)) {
-        // Test add-ons will have shown an error if necessary above
-        if (addon.id.substring(6) != "@tests.mozilla.org")
-          ok(false, "Add-on " + addon.id + " was not included in the data");
-        continue;
-      }
+  let aAddons = await AddonManager.getAllAddons();
+  for (let addon of aAddons) {
+    if (!(addon.id in data)) {
+      // Test add-ons will have shown an error if necessary above
+      if (addon.id.substring(6) != "@tests.mozilla.org")
+        ok(false, "Add-on " + addon.id + " was not included in the data");
+      continue;
+    }
 
-      info("Testing data for add-on " + addon.id);
-      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();
-  });
+    info("Testing data for add-on " + addon.id);
+    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");
+  }
 }
 
 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");
@@ -183,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
@@ -230,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/browser/browser_installssl.js
+++ b/toolkit/mozapps/extensions/test/browser/browser_installssl.js
@@ -57,17 +57,17 @@ function end_test() {
   finish();
 }
 
 function add_install_test(mainURL, redirectURL, expectedStatus) {
   gTests.push([mainURL, redirectURL, expectedStatus]);
 }
 
 function run_install_tests(callback) {
-  function run_next_install_test() {
+  async function run_next_install_test() {
     if (gTests.length == 0) {
       callback();
       return;
     }
     gLast = Date.now();
 
     let [mainURL, redirectURL, expectedStatus] = gTests.shift();
     if (redirectURL) {
@@ -75,38 +75,37 @@ function run_install_tests(callback) {
       var message = "Should have seen the right result for an install redirected from " +
                     mainURL + " to " + redirectURL;
     } else {
       url = mainURL + xpi;
       message = "Should have seen the right result for an install from " +
                 mainURL;
     }
 
-    AddonManager.getInstallForURL(url, function(install) {
-      gPendingInstall = install;
-      install.addListener({
-        onDownloadEnded(install) {
-          is(SUCCESS, expectedStatus, message);
-          info("Install test ran in " + (Date.now() - gLast) + "ms");
-          // Don't proceed with the install
-          install.cancel();
-          gPendingInstall = null;
-          run_next_install_test();
-          return false;
-        },
+    let install = await AddonManager.getInstallForURL(url, null, "application/x-xpinstall");
+    gPendingInstall = install;
+    install.addListener({
+      onDownloadEnded(install) {
+        is(SUCCESS, expectedStatus, message);
+        info("Install test ran in " + (Date.now() - gLast) + "ms");
+        // Don't proceed with the install
+        install.cancel();
+        gPendingInstall = null;
+        run_next_install_test();
+        return false;
+      },
 
-        onDownloadFailed(install) {
-          is(install.error, expectedStatus, message);
-          info("Install test ran in " + (Date.now() - gLast) + "ms");
-          gPendingInstall = null;
-          run_next_install_test();
-        }
-      });
-      install.install();
-    }, "application/x-xpinstall");
+      onDownloadFailed(install) {
+        is(install.error, expectedStatus, message);
+        info("Install test ran in " + (Date.now() - gLast) + "ms");
+        gPendingInstall = null;
+        run_next_install_test();
+      }
+    });
+    install.install();
   }
 
   run_next_install_test();
 }
 
 // Add overrides for the bad certificates
 function addCertOverrides() {
   addCertOverride("nocert.example.com", Ci.nsICertOverrideService.ERROR_MISMATCH);
--- a/toolkit/mozapps/extensions/test/browser/browser_manualupdates.js
+++ b/toolkit/mozapps/extensions/test/browser/browser_manualupdates.js
@@ -211,29 +211,28 @@ add_test(function() {
 
         run_next_test();
       });
     });
   });
 });
 
 add_test(function() {
-  gAvailableCategory.addEventListener("CategoryBadgeUpdated", function() {
+  gAvailableCategory.addEventListener("CategoryBadgeUpdated", async function() {
     is(gCategoryUtilities.isVisible(gAvailableCategory), true, "Available Updates category should now be visible");
     is(gAvailableCategory.badgeCount, 1, "Badge for Available Updates should now be 1");
 
     gAvailableCategory.addEventListener("CategoryBadgeUpdated", function() {
       is(gCategoryUtilities.isVisible(gAvailableCategory), false, "Available Updates category should now be hidden");
 
       run_next_test();
     }, {once: true});
 
-    AddonManager.getAddonByID("addon2@tests.mozilla.org", function(aAddon) {
-      aAddon.applyBackgroundUpdates = AddonManager.AUTOUPDATE_ENABLE;
-    });
+    let aAddon = await AddonManager.getAddonByID("addon2@tests.mozilla.org");
+    aAddon.applyBackgroundUpdates = AddonManager.AUTOUPDATE_ENABLE;
   }, {once: true});
 
   gProvider.createInstalls([{
     name: "manually updating addon (new and even more improved!)",
     existingAddon: gProvider.addons[1],
     version: "1.2",
     releaseNotesURI: Services.io.newURI(TESTROOT + "thereIsNoFileHere.xhtml")
   }]);
--- a/toolkit/mozapps/extensions/test/browser/browser_pluginprefs.js
+++ b/toolkit/mozapps/extensions/test/browser/browser_pluginprefs.js
@@ -17,52 +17,50 @@ function test() {
 }
 
 function end_test() {
   close_manager(gManagerWindow, function() {
     finish();
   });
 }
 
-add_test(function() {
-  AddonManager.getAddonsByTypes(["plugin"], function(plugins) {
-    let testPluginId;
-    for (let plugin of plugins) {
-      if (plugin.name == "Test Plug-in") {
-        testPluginId = plugin.id;
-        break;
-      }
+add_test(async function() {
+  let plugins = await AddonManager.getAddonsByTypes(["plugin"]);
+  let testPluginId;
+  for (let plugin of plugins) {
+    if (plugin.name == "Test Plug-in") {
+      testPluginId = plugin.id;
+      break;
     }
-    ok(testPluginId, "Test Plug-in should exist");
+  }
+  ok(testPluginId, "Test Plug-in should exist");
 
-    AddonManager.getAddonByID(testPluginId, function(testPlugin) {
-      let pluginEl = get_addon_element(gManagerWindow, testPluginId);
-      is(pluginEl.mAddon.optionsType, AddonManager.OPTIONS_TYPE_INLINE_BROWSER, "Options should be inline type");
-      pluginEl.parentNode.ensureElementIsVisible(pluginEl);
+  let testPlugin = await AddonManager.getAddonByID(testPluginId);
+  let pluginEl = get_addon_element(gManagerWindow, testPluginId);
+  is(pluginEl.mAddon.optionsType, AddonManager.OPTIONS_TYPE_INLINE_BROWSER, "Options should be inline type");
+  pluginEl.parentNode.ensureElementIsVisible(pluginEl);
 
-      let button = gManagerWindow.document.getAnonymousElementByAttribute(pluginEl, "anonid", "preferences-btn");
-      is_element_visible(button, "Preferences button should be visible");
-
-      button = gManagerWindow.document.getAnonymousElementByAttribute(pluginEl, "anonid", "details-btn");
-      EventUtils.synthesizeMouseAtCenter(button, { clickCount: 1 }, gManagerWindow);
+  let button = gManagerWindow.document.getAnonymousElementByAttribute(pluginEl, "anonid", "preferences-btn");
+  is_element_visible(button, "Preferences button should be visible");
 
-      Services.obs.addObserver(function observer(subject, topic, data) {
-        Services.obs.removeObserver(observer, topic);
+  button = gManagerWindow.document.getAnonymousElementByAttribute(pluginEl, "anonid", "details-btn");
+  EventUtils.synthesizeMouseAtCenter(button, { clickCount: 1 }, gManagerWindow);
 
-        // Wait for PluginProvider to do its stuff.
-        executeSoon(function() {
-          let doc = gManagerWindow.document.getElementById("addon-options").contentDocument;
+  Services.obs.addObserver(function observer(subject, topic, data) {
+    Services.obs.removeObserver(observer, topic);
+
+    // Wait for PluginProvider to do its stuff.
+    executeSoon(function() {
+      let doc = gManagerWindow.document.getElementById("addon-options").contentDocument;
 
-          let pluginLibraries = doc.getElementById("pluginLibraries");
-          ok(pluginLibraries, "Plugin file name row should be displayed");
-          // the file name depends on the platform
-          ok(pluginLibraries.textContent, testPlugin.pluginLibraries, "Plugin file name should be displayed");
+      let pluginLibraries = doc.getElementById("pluginLibraries");
+      ok(pluginLibraries, "Plugin file name row should be displayed");
+      // the file name depends on the platform
+      ok(pluginLibraries.textContent, testPlugin.pluginLibraries, "Plugin file name should be displayed");
 
-          let pluginMimeTypes = doc.getElementById("pluginMimeTypes");
-          ok(pluginMimeTypes, "Plugin mime type row should be displayed");
-          ok(pluginMimeTypes.textContent, "application/x-test (tst)", "Plugin mime type should be displayed");
+      let pluginMimeTypes = doc.getElementById("pluginMimeTypes");
+      ok(pluginMimeTypes, "Plugin mime type row should be displayed");
+      ok(pluginMimeTypes.textContent, "application/x-test (tst)", "Plugin mime type should be displayed");
 
-          run_next_test();
-        });
-      }, AddonManager.OPTIONS_NOTIFICATION_DISPLAYED);
+      run_next_test();
     });
-  });
+  }, AddonManager.OPTIONS_NOTIFICATION_DISPLAYED);
 });
--- a/toolkit/mozapps/extensions/test/browser/browser_uninstalling.js
+++ b/toolkit/mozapps/extensions/test/browser/browser_uninstalling.js
@@ -82,372 +82,364 @@ function get_item_in_list(aId, aList) {
 }
 
 // Tests that uninstalling a restartless add-on from the list view can be undone
 add_test(function() {
   var ID = "addon2@tests.mozilla.org";
   var list = gDocument.getElementById("addon-list");
 
   // Select the extensions category
-  gCategoryUtilities.openType("extension", function() {
+  gCategoryUtilities.openType("extension", async function() {
     is(gCategoryUtilities.selectedCategory, "extension", "View should have changed to extension");
 
-    AddonManager.getAddonByID(ID, function(aAddon) {
-      ok(aAddon.isActive, "Add-on should be active");
-      ok(!(aAddon.operationsRequiringRestart & AddonManager.OP_NEEDS_RESTART_UNINSTALL), "Add-on should not require a restart to uninstall");
-      ok(!(aAddon.pendingOperations & AddonManager.PENDING_UNINSTALL), "Add-on should not be pending uninstall");
+    let aAddon = await AddonManager.getAddonByID(ID);
+    ok(aAddon.isActive, "Add-on should be active");
+    ok(!(aAddon.operationsRequiringRestart & AddonManager.OP_NEEDS_RESTART_UNINSTALL), "Add-on should not require a restart to uninstall");
+    ok(!(aAddon.pendingOperations & AddonManager.PENDING_UNINSTALL), "Add-on should not be pending uninstall");
 
-      var item = get_item_in_list(ID, list);
-      isnot(item, null, "Should have found the add-on in the list");
+    var item = get_item_in_list(ID, list);
+    isnot(item, null, "Should have found the add-on in the list");
 
-      var button = gDocument.getAnonymousElementByAttribute(item, "anonid", "remove-btn");
-      isnot(button, null, "Should have a remove button");
-      ok(!button.disabled, "Button should not be disabled");
+    var button = gDocument.getAnonymousElementByAttribute(item, "anonid", "remove-btn");
+    isnot(button, null, "Should have a remove button");
+    ok(!button.disabled, "Button should not be disabled");
 
-      EventUtils.synthesizeMouseAtCenter(button, { }, gManagerWindow);
+    EventUtils.synthesizeMouseAtCenter(button, { }, gManagerWindow);
 
-      // Force XBL to apply
-      item.clientTop;
-
-      is(item.getAttribute("pending"), "uninstall", "Add-on should be uninstalling");
+    // Force XBL to apply
+    item.clientTop;
 
-      ok(aAddon.pendingOperations & AddonManager.PENDING_UNINSTALL, "Add-on should be pending uninstall");
-      ok(!aAddon.isActive, "Add-on should be inactive");
+    is(item.getAttribute("pending"), "uninstall", "Add-on should be uninstalling");
+
+    ok(aAddon.pendingOperations & AddonManager.PENDING_UNINSTALL, "Add-on should be pending uninstall");
+    ok(!aAddon.isActive, "Add-on should be inactive");
 
-      button = gDocument.getAnonymousElementByAttribute(item, "anonid", "undo-btn");
-      isnot(button, null, "Should have an undo button");
+    button = gDocument.getAnonymousElementByAttribute(item, "anonid", "undo-btn");
+    isnot(button, null, "Should have an undo button");
 
-      EventUtils.synthesizeMouseAtCenter(button, { }, gManagerWindow);
+    EventUtils.synthesizeMouseAtCenter(button, { }, gManagerWindow);
 
-      // Force XBL to apply
-      item.clientTop;
+    // Force XBL to apply
+    item.clientTop;
 
-      ok(aAddon.isActive, "Add-on should be active");
-      button = gDocument.getAnonymousElementByAttribute(item, "anonid", "remove-btn");
-      isnot(button, null, "Should have a remove button");
-      ok(!button.disabled, "Button should not be disabled");
+    ok(aAddon.isActive, "Add-on should be active");
+    button = gDocument.getAnonymousElementByAttribute(item, "anonid", "remove-btn");
+    isnot(button, null, "Should have a remove button");
+    ok(!button.disabled, "Button should not be disabled");
 
-      run_next_test();
-    });
+    run_next_test();
   });
 });
 
 // Tests that uninstalling a disabled restartless add-on from the list view can
 // be undone and doesn't re-enable
 add_test(function() {
   var ID = "addon2@tests.mozilla.org";
   var list = gDocument.getElementById("addon-list");
 
   // Select the extensions category
-  gCategoryUtilities.openType("extension", function() {
+  gCategoryUtilities.openType("extension", async function() {
     is(gCategoryUtilities.selectedCategory, "extension", "View should have changed to extension");
 
-    AddonManager.getAddonByID(ID, function(aAddon) {
-      aAddon.userDisabled = true;
+    let aAddon = await AddonManager.getAddonByID(ID);
+    aAddon.userDisabled = true;
 
-      ok(!aAddon.isActive, "Add-on should be inactive");
-      ok(!(aAddon.operationsRequiringRestart & AddonManager.OP_NEEDS_RESTART_UNINSTALL), "Add-on should not require a restart to uninstall");
-      ok(!(aAddon.pendingOperations & AddonManager.PENDING_UNINSTALL), "Add-on should not be pending uninstall");
+    ok(!aAddon.isActive, "Add-on should be inactive");
+    ok(!(aAddon.operationsRequiringRestart & AddonManager.OP_NEEDS_RESTART_UNINSTALL), "Add-on should not require a restart to uninstall");
+    ok(!(aAddon.pendingOperations & AddonManager.PENDING_UNINSTALL), "Add-on should not be pending uninstall");
 
-      var item = get_item_in_list(ID, list);
-      isnot(item, null, "Should have found the add-on in the list");
+    var item = get_item_in_list(ID, list);
+    isnot(item, null, "Should have found the add-on in the list");
 
-      var button = gDocument.getAnonymousElementByAttribute(item, "anonid", "remove-btn");
-      isnot(button, null, "Should have a remove button");
-      ok(!button.disabled, "Button should not be disabled");
+    var button = gDocument.getAnonymousElementByAttribute(item, "anonid", "remove-btn");
+    isnot(button, null, "Should have a remove button");
+    ok(!button.disabled, "Button should not be disabled");
 
-      EventUtils.synthesizeMouseAtCenter(button, { }, gManagerWindow);
+    EventUtils.synthesizeMouseAtCenter(button, { }, gManagerWindow);
 
-      // Force XBL to apply
-      item.clientTop;
+    // Force XBL to apply
+    item.clientTop;
 
-      is(item.getAttribute("pending"), "uninstall", "Add-on should be uninstalling");
+    is(item.getAttribute("pending"), "uninstall", "Add-on should be uninstalling");
 
-      ok(aAddon.pendingOperations & AddonManager.PENDING_UNINSTALL, "Add-on should be pending uninstall");
-      ok(!aAddon.isActive, "Add-on should be inactive");
+    ok(aAddon.pendingOperations & AddonManager.PENDING_UNINSTALL, "Add-on should be pending uninstall");
+    ok(!aAddon.isActive, "Add-on should be inactive");
 
-      button = gDocument.getAnonymousElementByAttribute(item, "anonid", "undo-btn");
-      isnot(button, null, "Should have an undo button");
+    button = gDocument.getAnonymousElementByAttribute(item, "anonid", "undo-btn");
+    isnot(button, null, "Should have an undo button");
 
-      EventUtils.synthesizeMouseAtCenter(button, { }, gManagerWindow);
-
-      // Force XBL to apply
-      item.clientTop;
+    EventUtils.synthesizeMouseAtCenter(button, { }, gManagerWindow);
 
-      ok(!aAddon.isActive, "Add-on should be inactive");
-      button = gDocument.getAnonymousElementByAttribute(item, "anonid", "remove-btn");
-      isnot(button, null, "Should have a remove button");
-      ok(!button.disabled, "Button should not be disabled");
+    // Force XBL to apply
+    item.clientTop;
 
-      aAddon.userDisabled = false;
-      ok(aAddon.isActive, "Add-on should be active");
+    ok(!aAddon.isActive, "Add-on should be inactive");
+    button = gDocument.getAnonymousElementByAttribute(item, "anonid", "remove-btn");
+    isnot(button, null, "Should have a remove button");
+    ok(!button.disabled, "Button should not be disabled");
 
-      run_next_test();
-    });
+    aAddon.userDisabled = false;
+    ok(aAddon.isActive, "Add-on should be active");
+
+    run_next_test();
   });
 });
 
 // Tests that uninstalling a restartless add-on from the details view switches
 // back to the list view and can be undone
 add_test(function() {
   var ID = "addon2@tests.mozilla.org";
   var list = gDocument.getElementById("addon-list");
 
   // Select the extensions category
-  gCategoryUtilities.openType("extension", function() {
+  gCategoryUtilities.openType("extension", async function() {
     is(gCategoryUtilities.selectedCategory, "extension", "View should have changed to extension");
 
-    AddonManager.getAddonByID(ID, function(aAddon) {
-      ok(aAddon.isActive, "Add-on should be active");
-      ok(!(aAddon.operationsRequiringRestart & AddonManager.OP_NEEDS_RESTART_UNINSTALL), "Add-on should not require a restart to uninstall");
-      ok(!(aAddon.pendingOperations & AddonManager.PENDING_UNINSTALL), "Add-on should not be pending uninstall");
+    let aAddon = await AddonManager.getAddonByID(ID);
+    ok(aAddon.isActive, "Add-on should be active");
+    ok(!(aAddon.operationsRequiringRestart & AddonManager.OP_NEEDS_RESTART_UNINSTALL), "Add-on should not require a restart to uninstall");
+    ok(!(aAddon.pendingOperations & AddonManager.PENDING_UNINSTALL), "Add-on should not be pending uninstall");
+
+    var item = get_item_in_list(ID, list);
+    isnot(item, null, "Should have found the add-on in the list");
 
-      var item = get_item_in_list(ID, list);
-      isnot(item, null, "Should have found the add-on in the list");
+    EventUtils.synthesizeMouseAtCenter(item, { clickCount: 1 }, gManagerWindow);
+    EventUtils.synthesizeMouseAtCenter(item, { clickCount: 2 }, gManagerWindow);
+    wait_for_view_load(gManagerWindow, function() {
+      is(get_current_view(gManagerWindow).id, "detail-view", "Should be in the detail view");
+
+      var button = gDocument.getElementById("detail-uninstall-btn");
+      isnot(button, null, "Should have a remove button");
+      ok(!button.disabled, "Button should not be disabled");
 
-      EventUtils.synthesizeMouseAtCenter(item, { clickCount: 1 }, gManagerWindow);
-      EventUtils.synthesizeMouseAtCenter(item, { clickCount: 2 }, gManagerWindow);
+      EventUtils.synthesizeMouseAtCenter(button, { }, gManagerWindow);
+
       wait_for_view_load(gManagerWindow, function() {
-        is(get_current_view(gManagerWindow).id, "detail-view", "Should be in the detail view");
+        is(gCategoryUtilities.selectedCategory, "extension", "View should have changed to extension");
+
+        var item = get_item_in_list(ID, list);
+        isnot(item, null, "Should have found the add-on in the list");
+        is(item.getAttribute("pending"), "uninstall", "Add-on should be uninstalling");
 
-        var button = gDocument.getElementById("detail-uninstall-btn");
-        isnot(button, null, "Should have a remove button");
-        ok(!button.disabled, "Button should not be disabled");
+        ok(!!(aAddon.pendingOperations & AddonManager.PENDING_UNINSTALL), "Add-on should be pending uninstall");
+        ok(!aAddon.isActive, "Add-on should be inactive");
+
+        // Force XBL to apply
+        item.clientTop;
+
+        button = gDocument.getAnonymousElementByAttribute(item, "anonid", "undo-btn");
+        isnot(button, null, "Should have an undo button");
 
         EventUtils.synthesizeMouseAtCenter(button, { }, gManagerWindow);
 
-        wait_for_view_load(gManagerWindow, function() {
-          is(gCategoryUtilities.selectedCategory, "extension", "View should have changed to extension");
-
-          var item = get_item_in_list(ID, list);
-          isnot(item, null, "Should have found the add-on in the list");
-          is(item.getAttribute("pending"), "uninstall", "Add-on should be uninstalling");
-
-          ok(!!(aAddon.pendingOperations & AddonManager.PENDING_UNINSTALL), "Add-on should be pending uninstall");
-          ok(!aAddon.isActive, "Add-on should be inactive");
-
-          // Force XBL to apply
-          item.clientTop;
+        // Force XBL to apply
+        item.clientTop;
 
-          button = gDocument.getAnonymousElementByAttribute(item, "anonid", "undo-btn");
-          isnot(button, null, "Should have an undo button");
-
-          EventUtils.synthesizeMouseAtCenter(button, { }, gManagerWindow);
-
-          // Force XBL to apply
-          item.clientTop;
+        ok(aAddon.isActive, "Add-on should be active");
+        button = gDocument.getAnonymousElementByAttribute(item, "anonid", "remove-btn");
+        isnot(button, null, "Should have a remove button");
+        ok(!button.disabled, "Button should not be disabled");
 
-          ok(aAddon.isActive, "Add-on should be active");
-          button = gDocument.getAnonymousElementByAttribute(item, "anonid", "remove-btn");
-          isnot(button, null, "Should have a remove button");
-          ok(!button.disabled, "Button should not be disabled");
-
-          run_next_test();
-        });
+        run_next_test();
       });
     });
   });
 });
 
 // Tests that uninstalling a restartless add-on from the details view switches
 // back to the list view and can be undone and doesn't re-enable
 add_test(function() {
   var ID = "addon2@tests.mozilla.org";
   var list = gDocument.getElementById("addon-list");
 
   // Select the extensions category
-  gCategoryUtilities.openType("extension", function() {
+  gCategoryUtilities.openType("extension", async function() {
     is(gCategoryUtilities.selectedCategory, "extension", "View should have changed to extension");
 
-    AddonManager.getAddonByID(ID, function(aAddon) {
-      aAddon.userDisabled = true;
+    let aAddon = await AddonManager.getAddonByID(ID);
+    aAddon.userDisabled = true;
+
+    ok(!aAddon.isActive, "Add-on should be inactive");
+    ok(!(aAddon.operationsRequiringRestart & AddonManager.OP_NEEDS_RESTART_UNINSTALL), "Add-on should not require a restart to uninstall");
+    ok(!(aAddon.pendingOperations & AddonManager.PENDING_UNINSTALL), "Add-on should not be pending uninstall");
 
-      ok(!aAddon.isActive, "Add-on should be inactive");
-      ok(!(aAddon.operationsRequiringRestart & AddonManager.OP_NEEDS_RESTART_UNINSTALL), "Add-on should not require a restart to uninstall");
-      ok(!(aAddon.pendingOperations & AddonManager.PENDING_UNINSTALL), "Add-on should not be pending uninstall");
+    var item = get_item_in_list(ID, list);
+    isnot(item, null, "Should have found the add-on in the list");
+
+    EventUtils.synthesizeMouseAtCenter(item, { clickCount: 1 }, gManagerWindow);
+    EventUtils.synthesizeMouseAtCenter(item, { clickCount: 2 }, gManagerWindow);
+    wait_for_view_load(gManagerWindow, function() {
+      is(get_current_view(gManagerWindow).id, "detail-view", "Should be in the detail view");
 
-      var item = get_item_in_list(ID, list);
-      isnot(item, null, "Should have found the add-on in the list");
+      var button = gDocument.getElementById("detail-uninstall-btn");
+      isnot(button, null, "Should have a remove button");
+      ok(!button.disabled, "Button should not be disabled");
 
-      EventUtils.synthesizeMouseAtCenter(item, { clickCount: 1 }, gManagerWindow);
-      EventUtils.synthesizeMouseAtCenter(item, { clickCount: 2 }, gManagerWindow);
+      EventUtils.synthesizeMouseAtCenter(button, { }, gManagerWindow);
+
       wait_for_view_load(gManagerWindow, function() {
-        is(get_current_view(gManagerWindow).id, "detail-view", "Should be in the detail view");
+        is(gCategoryUtilities.selectedCategory, "extension", "View should have changed to extension");
+
+        var item = get_item_in_list(ID, list);
+        isnot(item, null, "Should have found the add-on in the list");
+        is(item.getAttribute("pending"), "uninstall", "Add-on should be uninstalling");
 
-        var button = gDocument.getElementById("detail-uninstall-btn");
-        isnot(button, null, "Should have a remove button");
-        ok(!button.disabled, "Button should not be disabled");
+        ok(!!(aAddon.pendingOperations & AddonManager.PENDING_UNINSTALL), "Add-on should be pending uninstall");
+        ok(!aAddon.isActive, "Add-on should be inactive");
+
+        // Force XBL to apply
+        item.clientTop;
+
+        button = gDocument.getAnonymousElementByAttribute(item, "anonid", "undo-btn");
+        isnot(button, null, "Should have an undo button");
 
         EventUtils.synthesizeMouseAtCenter(button, { }, gManagerWindow);
 
-        wait_for_view_load(gManagerWindow, function() {
-          is(gCategoryUtilities.selectedCategory, "extension", "View should have changed to extension");
-
-          var item = get_item_in_list(ID, list);
-          isnot(item, null, "Should have found the add-on in the list");
-          is(item.getAttribute("pending"), "uninstall", "Add-on should be uninstalling");
-
-          ok(!!(aAddon.pendingOperations & AddonManager.PENDING_UNINSTALL), "Add-on should be pending uninstall");
-          ok(!aAddon.isActive, "Add-on should be inactive");
-
-          // Force XBL to apply
-          item.clientTop;
-
-          button = gDocument.getAnonymousElementByAttribute(item, "anonid", "undo-btn");
-          isnot(button, null, "Should have an undo button");
+        // Force XBL to apply
+        item.clientTop;
 
-          EventUtils.synthesizeMouseAtCenter(button, { }, gManagerWindow);
-
-          // Force XBL to apply
-          item.clientTop;
+        ok(!aAddon.isActive, "Add-on should be inactive");
+        button = gDocument.getAnonymousElementByAttribute(item, "anonid", "remove-btn");
+        isnot(button, null, "Should have a remove button");
+        ok(!button.disabled, "Button should not be disabled");
 
-          ok(!aAddon.isActive, "Add-on should be inactive");
-          button = gDocument.getAnonymousElementByAttribute(item, "anonid", "remove-btn");
-          isnot(button, null, "Should have a remove button");
-          ok(!button.disabled, "Button should not be disabled");
+        aAddon.userDisabled = false;
+        ok(aAddon.isActive, "Add-on should be active");
 
-          aAddon.userDisabled = false;
-          ok(aAddon.isActive, "Add-on should be active");
-
-          run_next_test();
-        });
+        run_next_test();
       });
     });
   });
 });
 
 // Tests that switching away from the list view finalises the uninstall of
 // multiple restartless add-ons
 add_test(function() {
   var ID = "addon2@tests.mozilla.org";
   var ID2 = "addon6@tests.mozilla.org";
   var list = gDocument.getElementById("addon-list");
 
   // Select the extensions category
-  gCategoryUtilities.openType("extension", function() {
+  gCategoryUtilities.openType("extension", async function() {
     is(gCategoryUtilities.selectedCategory, "extension", "View should have changed to extension");
 
-    AddonManager.getAddonByID(ID, function(aAddon) {
-      ok(aAddon.isActive, "Add-on should be active");
-      ok(!(aAddon.operationsRequiringRestart & AddonManager.OP_NEEDS_RESTART_UNINSTALL), "Add-on should not require a restart to uninstall");
-      ok(!(aAddon.pendingOperations & AddonManager.PENDING_UNINSTALL), "Add-on should not be pending uninstall");
+    let aAddon = await AddonManager.getAddonByID(ID);
+    ok(aAddon.isActive, "Add-on should be active");
+    ok(!(aAddon.operationsRequiringRestart & AddonManager.OP_NEEDS_RESTART_UNINSTALL), "Add-on should not require a restart to uninstall");
+    ok(!(aAddon.pendingOperations & AddonManager.PENDING_UNINSTALL), "Add-on should not be pending uninstall");
 
-      var item = get_item_in_list(ID, list);
-      isnot(item, null, "Should have found the add-on in the list");
+    var item = get_item_in_list(ID, list);
+    isnot(item, null, "Should have found the add-on in the list");
 
-      var button = gDocument.getAnonymousElementByAttribute(item, "anonid", "remove-btn");
-      isnot(button, null, "Should have a remove button");
-      ok(!button.disabled, "Button should not be disabled");
+    var button = gDocument.getAnonymousElementByAttribute(item, "anonid", "remove-btn");
+    isnot(button, null, "Should have a remove button");
+    ok(!button.disabled, "Button should not be disabled");
 
-      EventUtils.synthesizeMouseAtCenter(button, { }, gManagerWindow);
+    EventUtils.synthesizeMouseAtCenter(button, { }, gManagerWindow);
 
-      // Force XBL to apply
-      item.clientTop;
+    // Force XBL to apply
+    item.clientTop;
 
-      is(item.getAttribute("pending"), "uninstall", "Add-on should be uninstalling");
-      ok(aAddon.pendingOperations & AddonManager.PENDING_UNINSTALL, "Add-on should be pending uninstall");
-      ok(!aAddon.isActive, "Add-on should be inactive");
+    is(item.getAttribute("pending"), "uninstall", "Add-on should be uninstalling");
+    ok(aAddon.pendingOperations & AddonManager.PENDING_UNINSTALL, "Add-on should be pending uninstall");
+    ok(!aAddon.isActive, "Add-on should be inactive");
 
-      button = gDocument.getAnonymousElementByAttribute(item, "anonid", "undo-btn");
-      isnot(button, null, "Should have an undo button");
+    button = gDocument.getAnonymousElementByAttribute(item, "anonid", "undo-btn");
+    isnot(button, null, "Should have an undo button");
 
-      item = get_item_in_list(ID2, list);
-      isnot(item, null, "Should have found the add-on in the list");
+    item = get_item_in_list(ID2, list);
+    isnot(item, null, "Should have found the add-on in the list");
 
-      button = gDocument.getAnonymousElementByAttribute(item, "anonid", "remove-btn");
-      isnot(button, null, "Should have a remove button");
-      ok(!button.disabled, "Button should not be disabled");
+    button = gDocument.getAnonymousElementByAttribute(item, "anonid", "remove-btn");
+    isnot(button, null, "Should have a remove button");
+    ok(!button.disabled, "Button should not be disabled");
 
-      EventUtils.synthesizeMouseAtCenter(button, { }, gManagerWindow);
+    EventUtils.synthesizeMouseAtCenter(button, { }, gManagerWindow);
 
-      gCategoryUtilities.openType("plugin", function() {
-        is(gCategoryUtilities.selectedCategory, "plugin", "View should have changed to extension");
+    gCategoryUtilities.openType("plugin", async function() {
+      is(gCategoryUtilities.selectedCategory, "plugin", "View should have changed to extension");
 
-        AddonManager.getAddonsByIDs([ID, ID2], function([aAddon, aAddon2]) {
-          is(aAddon, null, "Add-on should no longer be installed");
-          is(aAddon2, null, "Second add-on should no longer be installed");
+      let [aAddon, aAddon2] = await AddonManager.getAddonsByIDs([ID, ID2]);
+      is(aAddon, null, "Add-on should no longer be installed");
+      is(aAddon2, null, "Second add-on should no longer be installed");
 
-          gCategoryUtilities.openType("extension", function() {
-            is(gCategoryUtilities.selectedCategory, "extension", "View should have changed to extension");
+      gCategoryUtilities.openType("extension", function() {
+        is(gCategoryUtilities.selectedCategory, "extension", "View should have changed to extension");
 
-            var item = get_item_in_list(ID, list);
-            is(item, null, "Should not have found the add-on in the list");
-            item = get_item_in_list(ID2, list);
-            is(item, null, "Should not have found the second add-on in the list");
+        var item = get_item_in_list(ID, list);
+        is(item, null, "Should not have found the add-on in the list");
+        item = get_item_in_list(ID2, list);
+        is(item, null, "Should not have found the second add-on in the list");
 
-            run_next_test();
-          });
-        });
+        run_next_test();
       });
     });
   });
 });
 
 // Tests that closing the manager from the list view finalises the uninstall of
 // multiple restartless add-ons
 add_test(function() {
   var ID = "addon4@tests.mozilla.org";
   var ID2 = "addon8@tests.mozilla.org";
   var list = gDocument.getElementById("addon-list");
 
   // Select the extensions category
-  gCategoryUtilities.openType("extension", function() {
+  gCategoryUtilities.openType("extension", async function() {
     is(gCategoryUtilities.selectedCategory, "extension", "View should have changed to extension");
 
-    AddonManager.getAddonByID(ID, function(aAddon) {
-      ok(aAddon.isActive, "Add-on should be active");
-      ok(!(aAddon.operationsRequiringRestart & AddonManager.OP_NEEDS_RESTART_UNINSTALL), "Add-on should not require a restart to uninstall");
-      ok(!(aAddon.pendingOperations & AddonManager.PENDING_UNINSTALL), "Add-on should not be pending uninstall");
+    let aAddon = await AddonManager.getAddonByID(ID);
+    ok(aAddon.isActive, "Add-on should be active");
+    ok(!(aAddon.operationsRequiringRestart & AddonManager.OP_NEEDS_RESTART_UNINSTALL), "Add-on should not require a restart to uninstall");
+    ok(!(aAddon.pendingOperations & AddonManager.PENDING_UNINSTALL), "Add-on should not be pending uninstall");
 
-      var item = get_item_in_list(ID, list);
-      isnot(item, null, "Should have found the add-on in the list");
+    var item = get_item_in_list(ID, list);
+    isnot(item, null, "Should have found the add-on in the list");
 
-      var button = gDocument.getAnonymousElementByAttribute(item, "anonid", "remove-btn");
-      isnot(button, null, "Should have a remove button");
-      ok(!button.disabled, "Button should not be disabled");
-
-      EventUtils.synthesizeMouseAtCenter(button, { }, gManagerWindow);
+    var button = gDocument.getAnonymousElementByAttribute(item, "anonid", "remove-btn");
+    isnot(button, null, "Should have a remove button");
+    ok(!button.disabled, "Button should not be disabled");
 
-      // Force XBL to apply
-      item.clientTop;
+    EventUtils.synthesizeMouseAtCenter(button, { }, gManagerWindow);
 
-      is(item.getAttribute("pending"), "uninstall", "Add-on should be uninstalling");
+    // Force XBL to apply
+    item.clientTop;
 
-      ok(aAddon.pendingOperations & AddonManager.PENDING_UNINSTALL, "Add-on should be pending uninstall");
-      ok(!aAddon.isActive, "Add-on should be inactive");
+    is(item.getAttribute("pending"), "uninstall", "Add-on should be uninstalling");
 
-      button = gDocument.getAnonymousElementByAttribute(item, "anonid", "undo-btn");
-      isnot(button, null, "Should have an undo button");
+    ok(aAddon.pendingOperations & AddonManager.PENDING_UNINSTALL, "Add-on should be pending uninstall");
+    ok(!aAddon.isActive, "Add-on should be inactive");
 
-      item = get_item_in_list(ID2, list);
-      isnot(item, null, "Should have found the add-on in the list");
+    button = gDocument.getAnonymousElementByAttribute(item, "anonid", "undo-btn");
+    isnot(button, null, "Should have an undo button");
 
-      button = gDocument.getAnonymousElementByAttribute(item, "anonid", "remove-btn");
-      isnot(button, null, "Should have a remove button");
-      ok(!button.disabled, "Button should not be disabled");
+    item = get_item_in_list(ID2, list);
+    isnot(item, null, "Should have found the add-on in the list");
+
+    button = gDocument.getAnonymousElementByAttribute(item, "anonid", "remove-btn");
+    isnot(button, null, "Should have a remove button");
+    ok(!button.disabled, "Button should not be disabled");
 
-      EventUtils.synthesizeMouseAtCenter(button, { }, gManagerWindow);
+    EventUtils.synthesizeMouseAtCenter(button, { }, gManagerWindow);
 
-      close_manager(gManagerWindow, function() {
-        AddonManager.getAddonsByIDs([ID, ID2], function([aAddon, aAddon2]) {
-          is(aAddon, null, "Add-on should no longer be installed");
-          is(aAddon2, null, "Second add-on should no longer be installed");
+    close_manager(gManagerWindow, async function() {
+      let [aAddon, aAddon2] = await AddonManager.getAddonsByIDs([ID, ID2]);
+      is(aAddon, null, "Add-on should no longer be installed");
+      is(aAddon2, null, "Second add-on should no longer be installed");
 
-          open_manager(null, function(aWindow) {
-            gManagerWindow = aWindow;
-            gDocument = gManagerWindow.document;
-            gCategoryUtilities = new CategoryUtilities(gManagerWindow);
-            var list = gDocument.getElementById("addon-list");
-
-            is(gCategoryUtilities.selectedCategory, "extension", "View should have changed to extension");
+      open_manager(null, function(aWindow) {
+        gManagerWindow = aWindow;
+        gDocument = gManagerWindow.document;
+        gCategoryUtilities = new CategoryUtilities(gManagerWindow);
+        var list = gDocument.getElementById("addon-list");
 
-            var item = get_item_in_list(ID, list);
-            is(item, null, "Should not have found the add-on in the list");
-            item = get_item_in_list(ID2, list);
-            is(item, null, "Should not have found the second add-on in the list");
+        is(gCategoryUtilities.selectedCategory, "extension", "View should have changed to extension");
 
-            run_next_test();
-          });
-        });
+        var item = get_item_in_list(ID, list);
+        is(item, null, "Should not have found the add-on in the list");
+        item = get_item_in_list(ID2, list);
+        is(item, null, "Should not have found the second add-on in the list");
+
+        run_next_test();
       });
     });
   });
 });
--- a/toolkit/mozapps/extensions/test/browser/browser_update.js
+++ b/toolkit/mozapps/extensions/test/browser/browser_update.js
@@ -12,43 +12,38 @@ function test() {
     ["extensions.checkUpdateSecurity", false],
     ["xpinstall.signatures.required", false]
   ]});
 
   run_next_test();
 }
 
 // Install a first version
-add_test(function() {
-  AddonManager.getInstallForURL(TESTROOT + "addons/browser_update1_1.xpi",
-                                function(aInstall) {
-    aInstall.install();
-  }, "application/x-xpinstall");
+add_test(async function() {
+  let aInstall = await AddonManager.getInstallForURL(TESTROOT + "addons/browser_update1_1.xpi", null, "application/x-xpinstall");
+  aInstall.install();
 
   Services.ppmm.addMessageListener("my-addon-1", function messageListener() {
     Services.ppmm.removeMessageListener("my-addon-1", messageListener);
     ok(true, "first version sent frame script message");
     run_next_test();
   });
 });
 
 // Update to a second version and verify that content gets updated
-add_test(function() {
-  AddonManager.getInstallForURL(TESTROOT + "addons/browser_update1_2.xpi",
-                                function(aInstall) {
-    aInstall.install();
-  }, "application/x-xpinstall");
+add_test(async function() {
+  let aInstall = await AddonManager.getInstallForURL(TESTROOT + "addons/browser_update1_2.xpi", null, "application/x-xpinstall");
+  aInstall.install();
 
   Services.ppmm.addMessageListener("my-addon-2", function messageListener() {
     Services.ppmm.removeMessageListener("my-addon-2", messageListener);
     ok(true, "second version sent frame script message");
     run_next_test();
   });
 });
 
 // Finally, cleanup things
-add_test(function() {
-  AddonManager.getAddonByID("update1@tests.mozilla.org", function(aAddon) {
-    aAddon.uninstall();
+add_test(async function() {
+  let aAddon = await AddonManager.getAddonByID("update1@tests.mozilla.org");
+  aAddon.uninstall();
 
-    finish();
-  });
+  finish();
 });
--- a/toolkit/mozapps/extensions/test/browser/head.js
+++ b/toolkit/mozapps/extensions/test/browser/head.js
@@ -509,24 +509,23 @@ function promiseAddonsByIDs(aIDs) {
   });
 }
 /**
  * Install an add-on and call a callback when complete.
  *
  * The callback will receive the Addon for the installed add-on.
  */
 function install_addon(path, cb, pathPrefix = TESTROOT) {
-  let p = new Promise((resolve, reject) => {
-    AddonManager.getInstallForURL(pathPrefix + path, (install) => {
-      install.addListener({
-        onInstallEnded: () => resolve(install.addon),
-      });
+  let p = new Promise(async (resolve, reject) => {
+    let install = await AddonManager.getInstallForURL(pathPrefix + path, null, "application/x-xpinstall");
+    install.addListener({
+      onInstallEnded: () => resolve(install.addon),
+    });
 
-      install.install();
-    }, "application/x-xpinstall");
+    install.install();
   });
 
   return log_callback(p, cb);
 }
 
 function CategoryUtilities(aManagerWindow) {
   this.window = aManagerWindow;
 
--- a/toolkit/mozapps/extensions/test/mochitest/test_bug687194.html
+++ b/toolkit/mozapps/extensions/test/mochitest/test_bug687194.html
@@ -39,41 +39,40 @@
         }
 
         message.target.sendAsyncMessage("test687194:resolveChromeURI:Answer",
                                         { threw, result });
       });
     }
 
     let test;
-    function* testStructure(mm) {
+    async function* testStructure(mm) {
       let lastResult;
 
       mm.addMessageListener("test687194:resolveChromeURI:Answer", SpecialPowers.wrapCallback(function(msg) {
         test.next(msg.data);
       }));
 
       mm.sendAsyncMessage("test687194:resolveChromeURI",
                           { URI: "chrome://bug687194/content/e10sbug.js" });
       lastResult = yield;
       is(lastResult.threw, true, "URI shouldn't resolve to begin with");
 
       let { AddonManager } = SpecialPowers.Cu.import("resource://gre/modules/AddonManager.jsm", {});
       const INSTALL_URI =
         "http://mochi.test:8888/tests/toolkit/mozapps/extensions/test/mochitest/file_bug687194.xpi";
-      AddonManager.getInstallForURL(INSTALL_URI, (install) => {
-        install = SpecialPowers.wrap(install);
-        install.addListener(SpecialPowers.wrapCallbackObject({
-          /* eslint no-shadow: 0 */
-          onInstallEnded(install, addon) {
-            SimpleTest.executeSoon(() => test.next(addon));
-          }
-        }));
-        install.install();
-      }, "application/x-xpinstall");
+      let install = await AddonManager.getInstallForURL(INSTALL_URI, null, "application/x-xpinstall");
+      install = SpecialPowers.wrap(install);
+      install.addListener(SpecialPowers.wrapCallbackObject({
+        /* eslint no-shadow: 0 */
+        onInstallEnded(install, addon) {
+          SimpleTest.executeSoon(() => test.next(addon));
+        }
+      }));
+      install.install();
 
       let addon = SpecialPowers.wrap(yield);
 
       mm.sendAsyncMessage("test687194:resolveChromeURI",
                           { URI: "chrome://bug687194/content/e10sbug.js" });
       lastResult = yield;
       is(lastResult.threw, false, "able to resolve after the installation");
 
--- a/toolkit/mozapps/extensions/test/xpcshell/test_LightweightThemeManager.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_LightweightThemeManager.js
@@ -16,17 +16,17 @@ function dummy(id) {
   };
 }
 
 function hasPermission(aAddon, aPerm) {
   var perm = AddonManager["PERM_CAN_" + aPerm.toUpperCase()];
   return !!(aAddon.permissions & perm);
 }
 
-function run_test() {
+async function run_test() {
   createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1.9");
   startupManager();
 
   Services.prefs.setIntPref("lightweightThemes.maxUsedThemes", 8);
 
   let {LightweightThemeManager: ltm} = ChromeUtils.import("resource://gre/modules/LightweightThemeManager.jsm", {});
 
   Assert.equal(typeof ltm, "object");
@@ -529,58 +529,52 @@ function run_test() {
 
   ltm.addBuiltInTheme(dummy("builtInTheme0"));
   ltm.addBuiltInTheme(dummy("builtInTheme1"));
   Assert.equal([...ltm._builtInThemes].length, 2);
   Assert.equal(ltm.usedThemes.length, 2);
 
   do_test_pending();
 
-  AddonManager.getAddonByID("builtInTheme0@personas.mozilla.org", builtInThemeAddon => {
-    // App specific theme can't be uninstalled or disabled,
-    // but can be enabled (since it isn't already applied).
-    Assert.equal(hasPermission(builtInThemeAddon, "uninstall"), false);
-    Assert.equal(hasPermission(builtInThemeAddon, "disable"), false);
-    Assert.equal(hasPermission(builtInThemeAddon, "enable"), true);
+  let builtInThemeAddon = await AddonManager.getAddonByID("builtInTheme0@personas.mozilla.org");
+  Assert.equal(hasPermission(builtInThemeAddon, "uninstall"), false);
+  Assert.equal(hasPermission(builtInThemeAddon, "disable"), false);
+  Assert.equal(hasPermission(builtInThemeAddon, "enable"), true);
 
-    ltm.currentTheme = dummy("x0");
-    Assert.equal([...ltm._builtInThemes].length, 2);
-    Assert.equal(ltm.usedThemes.length, 3);
-    Assert.equal(ltm.usedThemes[0].id, "x0");
-    Assert.equal(ltm.currentTheme.id, "x0");
-    Assert.equal(ltm.usedThemes[1].id, "builtInTheme0");
-    Assert.equal(ltm.usedThemes[2].id, "builtInTheme1");
+  ltm.currentTheme = dummy("x0");
+  Assert.equal([...ltm._builtInThemes].length, 2);
+  Assert.equal(ltm.usedThemes.length, 3);
+  Assert.equal(ltm.usedThemes[0].id, "x0");
+  Assert.equal(ltm.currentTheme.id, "x0");
+  Assert.equal(ltm.usedThemes[1].id, "builtInTheme0");
+  Assert.equal(ltm.usedThemes[2].id, "builtInTheme1");
 
-    Assert.throws(() => { ltm.addBuiltInTheme(dummy("builtInTheme0")); },
-      "Exception is thrown adding a duplicate theme");
-    Assert.throws(() => { ltm.addBuiltInTheme("not a theme object"); },
-      "Exception is thrown adding an invalid theme");
+  Assert.throws(() => { ltm.addBuiltInTheme(dummy("builtInTheme0")); },
+    "Exception is thrown adding a duplicate theme");
+  Assert.throws(() => { ltm.addBuiltInTheme("not a theme object"); },
+    "Exception is thrown adding an invalid theme");
 
-    AddonManager.getAddonByID("x0@personas.mozilla.org", x0Addon => {
-      // Currently applied (non-app-specific) can be uninstalled or disabled,
-      // but can't be enabled (since it's already applied).
-      Assert.equal(hasPermission(x0Addon, "uninstall"), true);
-      Assert.equal(hasPermission(x0Addon, "disable"), true);
-      Assert.equal(hasPermission(x0Addon, "enable"), false);
+  let x0Addon = await AddonManager.getAddonByID("x0@personas.mozilla.org");
+  Assert.equal(hasPermission(x0Addon, "uninstall"), true);
+  Assert.equal(hasPermission(x0Addon, "disable"), true);
+  Assert.equal(hasPermission(x0Addon, "enable"), false);
 
-      ltm.forgetUsedTheme("x0");
-      Assert.equal(ltm.currentTheme, null);
+  ltm.forgetUsedTheme("x0");
+  Assert.equal(ltm.currentTheme, null);
 
-      // Removing the currently applied app specific theme should unapply it
-      ltm.currentTheme = ltm.getUsedTheme("builtInTheme0");
-      Assert.equal(ltm.currentTheme.id, "builtInTheme0");
-      Assert.ok(ltm.forgetBuiltInTheme("builtInTheme0"));
-      Assert.equal(ltm.currentTheme, null);
+  // Removing the currently applied app specific theme should unapply it
+  ltm.currentTheme = ltm.getUsedTheme("builtInTheme0");
+  Assert.equal(ltm.currentTheme.id, "builtInTheme0");
+  Assert.ok(ltm.forgetBuiltInTheme("builtInTheme0"));
+  Assert.equal(ltm.currentTheme, null);
 
-      Assert.equal([...ltm._builtInThemes].length, 1);
-      Assert.equal(ltm.usedThemes.length, 1);
+  Assert.equal([...ltm._builtInThemes].length, 1);
+  Assert.equal(ltm.usedThemes.length, 1);
 
-      Assert.ok(ltm.forgetBuiltInTheme("builtInTheme1"));
-      Assert.ok(!ltm.forgetBuiltInTheme("not-an-existing-theme-id"));
+  Assert.ok(ltm.forgetBuiltInTheme("builtInTheme1"));
+  Assert.ok(!ltm.forgetBuiltInTheme("not-an-existing-theme-id"));
 
-      Assert.equal([...ltm._builtInThemes].length, 0);
-      Assert.equal(ltm.usedThemes.length, 0);
-      Assert.equal(ltm.currentTheme, null);
+  Assert.equal([...ltm._builtInThemes].length, 0);
+  Assert.equal(ltm.usedThemes.length, 0);
+  Assert.equal(ltm.currentTheme, null);
 
-      do_test_finished();
-    });
-  });
+  do_test_finished();
 }
--- a/toolkit/mozapps/extensions/test/xpcshell/test_backgroundupdate.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_backgroundupdate.js
@@ -24,29 +24,28 @@ function run_test() {
 }
 
 function end_test() {
   do_test_finished();
 }
 
 // Verify that with no add-ons installed the background update notifications get
 // called
-function run_test_1() {
-  AddonManager.getAddonsByTypes(["extension", "theme", "locale"], function(aAddons) {
-    Assert.equal(aAddons.length, 0);
-
-    Services.obs.addObserver(function observer() {
-      Services.obs.removeObserver(observer, "addons-background-update-complete");
+async function run_test_1() {
+  let aAddons = await AddonManager.getAddonsByTypes(["extension", "theme", "locale"]);
+  Assert.equal(aAddons.length, 0);
 
-      executeSoon(run_test_2);
-    }, "addons-background-update-complete");
+  Services.obs.addObserver(function observer() {
+    Services.obs.removeObserver(observer, "addons-background-update-complete");
 
-    // Trigger the background update timer handler
-    gInternalManager.notify(null);
-  });
+    executeSoon(run_test_2);
+  }, "addons-background-update-complete");
+
+  // Trigger the background update timer handler
+  gInternalManager.notify(null);
 }
 
 // Verify that with two add-ons installed both of which claim to have updates
 // available we get the notification after both updates attempted to start
 function run_test_2() {
   writeInstallRDFForExtension({
     id: "addon1@tests.mozilla.org",
     version: "1.0",
--- a/toolkit/mozapps/extensions/test/xpcshell/test_blocklist_metadata_filters.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_blocklist_metadata_filters.js
@@ -60,17 +60,17 @@ function load_blocklist(aFile, aCallback
   blocklist.notify(null);
 }
 
 
 function end_test() {
   do_test_finished();
 }
 
-function run_test() {
+async function run_test() {
   do_test_pending();
 
   createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1");
 
   // Should get blocked by name
   writeInstallRDFForExtension({
     id: "block1@tests.mozilla.org",
     version: "1.0",
@@ -113,33 +113,31 @@ function run_test() {
       id: "xpcshell@tests.mozilla.org",
       minVersion: "1",
       maxVersion: "3"
     }]
   }, profileDir);
 
   startupManager();
 
-  AddonManager.getAddonsByIDs(["block1@tests.mozilla.org",
-                               "block2@tests.mozilla.org",
-                               "block3@tests.mozilla.org"], function([a1, a2, a3]) {
-    Assert.equal(a1.blocklistState, Ci.nsIBlocklistService.STATE_NOT_BLOCKED);
-    Assert.equal(a2.blocklistState, Ci.nsIBlocklistService.STATE_NOT_BLOCKED);
-    Assert.equal(a3.blocklistState, Ci.nsIBlocklistService.STATE_NOT_BLOCKED);
+  let [a1, a2, a3] = await AddonManager.getAddonsByIDs(["block1@tests.mozilla.org",
+                                                        "block2@tests.mozilla.org",
+                                                        "block3@tests.mozilla.org"]);
+  Assert.equal(a1.blocklistState, Ci.nsIBlocklistService.STATE_NOT_BLOCKED);
+  Assert.equal(a2.blocklistState, Ci.nsIBlocklistService.STATE_NOT_BLOCKED);
+  Assert.equal(a3.blocklistState, Ci.nsIBlocklistService.STATE_NOT_BLOCKED);
 
-    run_test_1();
-  });
+  run_test_1();
 }
 
 function run_test_1() {
-  load_blocklist("test_blocklist_metadata_filters_1.xml", function() {
+  load_blocklist("test_blocklist_metadata_filters_1.xml", async function() {
     restartManager();
 
-    AddonManager.getAddonsByIDs(["block1@tests.mozilla.org",
-                                 "block2@tests.mozilla.org",
-                                 "block3@tests.mozilla.org"], function([a1, a2, a3]) {
-      Assert.equal(a1.blocklistState, Ci.nsIBlocklistService.STATE_SOFTBLOCKED);
-      Assert.equal(a2.blocklistState, Ci.nsIBlocklistService.STATE_BLOCKED);
-      Assert.equal(a3.blocklistState, Ci.nsIBlocklistService.STATE_NOT_BLOCKED);
-      end_test();
-    });
+    let [a1, a2, a3] = await AddonManager.getAddonsByIDs(["block1@tests.mozilla.org",
+                                                          "block2@tests.mozilla.org",
+                                                          "block3@tests.mozilla.org"]);
+    Assert.equal(a1.blocklistState, Ci.nsIBlocklistService.STATE_SOFTBLOCKED);
+    Assert.equal(a2.blocklistState, Ci.nsIBlocklistService.STATE_BLOCKED);
+    Assert.equal(a3.blocklistState, Ci.nsIBlocklistService.STATE_NOT_BLOCKED);
+    end_test();
   });
 }
--- a/toolkit/mozapps/extensions/test/xpcshell/test_blocklist_prefs.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_blocklist_prefs.js
@@ -60,17 +60,17 @@ function load_blocklist(aFile, aCallback
                   getService(Ci.nsITimerCallback);
   blocklist.notify(null);
 }
 
 function end_test() {
   do_test_finished();
 }
 
-function run_test() {
+async function run_test() {
   do_test_pending();
 
   createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1");
 
   // Add 2 extensions
   writeInstallRDFForExtension({
     id: "block1@tests.mozilla.org",
     version: "1.0",
@@ -99,42 +99,40 @@ function run_test() {
   Services.prefs.setIntPref("test.blocklist.pref1", 15);
   Services.prefs.setIntPref("test.blocklist.pref2", 15);
   Services.prefs.setBoolPref("test.blocklist.pref3", true);
   Services.prefs.setBoolPref("test.blocklist.pref4", true);
 
   startupManager();
 
   // Before blocklist is loaded.
-  AddonManager.getAddonsByIDs(["block1@tests.mozilla.org",
-                               "block2@tests.mozilla.org"], function([a1, a2]) {
-    Assert.equal(a1.blocklistState, Ci.nsIBlocklistService.STATE_NOT_BLOCKED);
-    Assert.equal(a2.blocklistState, Ci.nsIBlocklistService.STATE_NOT_BLOCKED);
+  let [a1, a2] = await AddonManager.getAddonsByIDs(["block1@tests.mozilla.org",
+                                                    "block2@tests.mozilla.org"]);
+  Assert.equal(a1.blocklistState, Ci.nsIBlocklistService.STATE_NOT_BLOCKED);
+  Assert.equal(a2.blocklistState, Ci.nsIBlocklistService.STATE_NOT_BLOCKED);
 
-    Assert.equal(Services.prefs.getIntPref("test.blocklist.pref1"), 15);
-    Assert.equal(Services.prefs.getIntPref("test.blocklist.pref2"), 15);
-    Assert.equal(Services.prefs.getBoolPref("test.blocklist.pref3"), true);
-    Assert.equal(Services.prefs.getBoolPref("test.blocklist.pref4"), true);
-    run_test_1();
-  });
+  Assert.equal(Services.prefs.getIntPref("test.blocklist.pref1"), 15);
+  Assert.equal(Services.prefs.getIntPref("test.blocklist.pref2"), 15);
+  Assert.equal(Services.prefs.getBoolPref("test.blocklist.pref3"), true);
+  Assert.equal(Services.prefs.getBoolPref("test.blocklist.pref4"), true);
+  run_test_1();
 }
 
 function run_test_1() {
-  load_blocklist("test_blocklist_prefs_1.xml", function() {
+  load_blocklist("test_blocklist_prefs_1.xml", async function() {
     restartManager();
 
     // Blocklist changes should have applied and the prefs must be reset.
-    AddonManager.getAddonsByIDs(["block1@tests.mozilla.org",
-                                 "block2@tests.mozilla.org"], function([a1, a2]) {
-      Assert.notEqual(a1, null);
-      Assert.equal(a1.blocklistState, Ci.nsIBlocklistService.STATE_SOFTBLOCKED);
-      Assert.notEqual(a2, null);
-      Assert.equal(a2.blocklistState, Ci.nsIBlocklistService.STATE_BLOCKED);
+    let [a1, a2] = await AddonManager.getAddonsByIDs(["block1@tests.mozilla.org",
+                                                      "block2@tests.mozilla.org"]);
+    Assert.notEqual(a1, null);
+    Assert.equal(a1.blocklistState, Ci.nsIBlocklistService.STATE_SOFTBLOCKED);
+    Assert.notEqual(a2, null);
+    Assert.equal(a2.blocklistState, Ci.nsIBlocklistService.STATE_BLOCKED);
 
-      // All these prefs must be reset to defaults.
-      Assert.equal(Services.prefs.prefHasUserValue("test.blocklist.pref1"), false);
-      Assert.equal(Services.prefs.prefHasUserValue("test.blocklist.pref2"), false);
-      Assert.equal(Services.prefs.prefHasUserValue("test.blocklist.pref3"), false);
-      Assert.equal(Services.prefs.prefHasUserValue("test.blocklist.pref4"), false);
-      end_test();
-    });
+    // All these prefs must be reset to defaults.
+    Assert.equal(Services.prefs.prefHasUserValue("test.blocklist.pref1"), false);
+    Assert.equal(Services.prefs.prefHasUserValue("test.blocklist.pref2"), false);
+    Assert.equal(Services.prefs.prefHasUserValue("test.blocklist.pref3"), false);
+    Assert.equal(Services.prefs.prefHasUserValue("test.blocklist.pref4"), false);
+    end_test();
   });
 }
--- a/toolkit/mozapps/extensions/test/xpcshell/test_blocklist_regexp.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_blocklist_regexp.js
@@ -65,17 +65,17 @@ function load_blocklist(aFile, aCallback
 }
 
 
 function end_test() {
   do_test_finished();
 }
 
 
-function run_test() {
+async function run_test() {
   do_test_pending();
 
   createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1");
 
   writeInstallRDFForExtension({
     id: "block1@tests.mozilla.org",
     version: "1.0",
     name: "RegExp blocked add-on",
@@ -84,29 +84,25 @@ function run_test() {
       id: "xpcshell@tests.mozilla.org",
       minVersion: "1",
       maxVersion: "3"
     }]
   }, profileDir);
 
   startupManager();
 
-  AddonManager.getAddonsByIDs(["block1@tests.mozilla.org"], function([a1]) {
-    Assert.equal(a1.blocklistState, Ci.nsIBlocklistService.STATE_NOT_BLOCKED);
+  let [a1] = await AddonManager.getAddonsByIDs(["block1@tests.mozilla.org"]);
+  Assert.equal(a1.blocklistState, Ci.nsIBlocklistService.STATE_NOT_BLOCKED);
 
-    run_test_1();
-  });
+  run_test_1();
 }
 
 function run_test_1() {
-  load_blocklist("test_blocklist_regexp_1.xml", function() {
+  load_blocklist("test_blocklist_regexp_1.xml", async function() {
     restartManager();
 
-    AddonManager.getAddonsByIDs(["block1@tests.mozilla.org"], function([a1]) {
-      // Blocklist contains two entries that will match this addon - ensure
-      // that the first one is applied.
-      Assert.notEqual(a1, null);
-      Assert.equal(a1.blocklistState, Ci.nsIBlocklistService.STATE_SOFTBLOCKED);
+    let [a1] = await AddonManager.getAddonsByIDs(["block1@tests.mozilla.org"]);
+    Assert.notEqual(a1, null);
+    Assert.equal(a1.blocklistState, Ci.nsIBlocklistService.STATE_SOFTBLOCKED);
 
-      end_test();
-    });
+    end_test();
   });
 }
--- a/toolkit/mozapps/extensions/test/xpcshell/test_bootstrap_globals.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_bootstrap_globals.js
@@ -8,30 +8,29 @@ ChromeUtils.import("resource://gre/modul
 createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1");
 
 const EXPECTED_GLOBALS = [
   ["Worker", "function"],
   ["ChromeWorker", "function"],
   ["console", "object"]
 ];
 
-function run_test() {
+async function run_test() {
   do_test_pending();
   startupManager();
   let sawGlobals = false;
 
   Services.obs.addObserver(function(subject) {
     subject.wrappedJSObject.expectedGlobals = EXPECTED_GLOBALS;
   }, "bootstrap-request-globals");
 
   Services.obs.addObserver(function({ wrappedJSObject: seenGlobals }) {
     for (let [name, ] of EXPECTED_GLOBALS)
       Assert.ok(seenGlobals.has(name));
 
     sawGlobals = true;
   }, "bootstrap-seen-globals");
 
-  installAllFiles([do_get_addon("bootstrap_globals")], function() {
-    Assert.ok(sawGlobals);
-    shutdownManager();
-    do_test_finished();
-  });
+  await promiseInstallAllFiles([do_get_addon("bootstrap_globals")]);
+  Assert.ok(sawGlobals);
+  shutdownManager();
+  do_test_finished();
 }
--- a/toolkit/mozapps/extensions/test/xpcshell/test_compatoverrides.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_compatoverrides.js
@@ -329,87 +329,84 @@ function run_test() {
 
   AddonManagerInternal.backgroundUpdateCheck().then(run_test_1);
 }
 
 function end_test() {
   gServer.stop(do_test_finished);
 }
 
-function check_compat_status(aCallback) {
-  AddonManager.getAddonsByIDs(["addon1@tests.mozilla.org",
-                               "addon2@tests.mozilla.org",
-                               "addon3@tests.mozilla.org",
-                               "addon4@tests.mozilla.org",
-                               "addon5@tests.mozilla.org",
-                               "addon6@tests.mozilla.org",
-                               "addon7@tests.mozilla.org",
-                               "addon8@tests.mozilla.org",
-                               "addon9@tests.mozilla.org"],
-                              function([a1, a2, a3, a4, a5, a6, a7, a8, a9]) {
-
-    Assert.notEqual(a1, null);
-    Assert.equal(AddonRepository.getCompatibilityOverridesSync(a1.id), null);
-    Assert.ok(a1.isCompatible);
-    Assert.ok(!a1.appDisabled);
+async function check_compat_status(aCallback) {
+  let [a1, a2, a3, a4, a5, a6, a7, a8, a9] = await AddonManager.getAddonsByIDs(["addon1@tests.mozilla.org",
+                                                                                "addon2@tests.mozilla.org",
+                                                                                "addon3@tests.mozilla.org",
+                                                                                "addon4@tests.mozilla.org",
+                                                                                "addon5@tests.mozilla.org",
+                                                                                "addon6@tests.mozilla.org",
+                                                                                "addon7@tests.mozilla.org",
+                                                                                "addon8@tests.mozilla.org",
+                                                                                "addon9@tests.mozilla.org"]);
+  Assert.notEqual(a1, null);
+  Assert.equal(AddonRepository.getCompatibilityOverridesSync(a1.id), null);
+  Assert.ok(a1.isCompatible);
+  Assert.ok(!a1.appDisabled);
 
-    Assert.notEqual(a2, null);
-    Assert.equal(AddonRepository.getCompatibilityOverridesSync(a2.id), null);
-    Assert.ok(a2.isCompatible);
-    Assert.ok(!a2.appDisabled);
+  Assert.notEqual(a2, null);
+  Assert.equal(AddonRepository.getCompatibilityOverridesSync(a2.id), null);
+  Assert.ok(a2.isCompatible);
+  Assert.ok(!a2.appDisabled);
 
-    Assert.notEqual(a3, null);
-    let overrides = AddonRepository.getCompatibilityOverridesSync(a3.id);
-    Assert.notEqual(overrides, null);
-    Assert.equal(overrides.length, 1);
-    Assert.ok(!a3.isCompatible);
-    Assert.ok(a3.appDisabled);
+  Assert.notEqual(a3, null);
+  let overrides = AddonRepository.getCompatibilityOverridesSync(a3.id);
+  Assert.notEqual(overrides, null);
+  Assert.equal(overrides.length, 1);
+  Assert.ok(!a3.isCompatible);
+  Assert.ok(a3.appDisabled);
 
-    Assert.notEqual(a4, null);
-    overrides = AddonRepository.getCompatibilityOverridesSync(a4.id);
-    Assert.notEqual(overrides, null);
-    Assert.equal(overrides.length, 1);
-    Assert.ok(!a4.isCompatible);
-    Assert.ok(a4.appDisabled);
+  Assert.notEqual(a4, null);
+  overrides = AddonRepository.getCompatibilityOverridesSync(a4.id);
+  Assert.notEqual(overrides, null);
+  Assert.equal(overrides.length, 1);
+  Assert.ok(!a4.isCompatible);
+  Assert.ok(a4.appDisabled);
 
-    Assert.notEqual(a5, null);
-    Assert.equal(AddonRepository.getCompatibilityOverridesSync(a5.id), null);
-    Assert.ok(a5.isCompatible);
-    Assert.ok(!a5.appDisabled);
+  Assert.notEqual(a5, null);
+  Assert.equal(AddonRepository.getCompatibilityOverridesSync(a5.id), null);
+  Assert.ok(a5.isCompatible);
+  Assert.ok(!a5.appDisabled);
 
-    Assert.notEqual(a6, null);
-    overrides = AddonRepository.getCompatibilityOverridesSync(a6.id);
-    Assert.notEqual(overrides, null);
-    Assert.equal(overrides.length, 1);
-    Assert.ok(a6.isCompatible);
-    Assert.ok(!a6.appDisabled);
+  Assert.notEqual(a6, null);
+  overrides = AddonRepository.getCompatibilityOverridesSync(a6.id);
+  Assert.notEqual(overrides, null);
+  Assert.equal(overrides.length, 1);
+  Assert.ok(a6.isCompatible);
+  Assert.ok(!a6.appDisabled);
 
-    Assert.notEqual(a7, null);
-    overrides = AddonRepository.getCompatibilityOverridesSync(a7.id);
-    Assert.notEqual(overrides, null);
-    Assert.equal(overrides.length, 1);
-    Assert.ok(a7.isCompatible);
-    Assert.ok(!a7.appDisabled);
+  Assert.notEqual(a7, null);
+  overrides = AddonRepository.getCompatibilityOverridesSync(a7.id);
+  Assert.notEqual(overrides, null);
+  Assert.equal(overrides.length, 1);
+  Assert.ok(a7.isCompatible);
+  Assert.ok(!a7.appDisabled);
 
-    Assert.notEqual(a8, null);
-    overrides = AddonRepository.getCompatibilityOverridesSync(a8.id);
-    Assert.notEqual(overrides, null);
-    Assert.equal(overrides.length, 3);
-    Assert.ok(!a8.isCompatible);
-    Assert.ok(a8.appDisabled);
+  Assert.notEqual(a8, null);
+  overrides = AddonRepository.getCompatibilityOverridesSync(a8.id);
+  Assert.notEqual(overrides, null);
+  Assert.equal(overrides.length, 3);
+  Assert.ok(!a8.isCompatible);
+  Assert.ok(a8.appDisabled);
 
-    Assert.notEqual(a9, null);
-    overrides = AddonRepository.getCompatibilityOverridesSync(a9.id);
-    Assert.notEqual(overrides, null);
-    Assert.equal(overrides.length, 1);
-    Assert.ok(!a9.isCompatible);
-    Assert.ok(a9.appDisabled);
+  Assert.notEqual(a9, null);
+  overrides = AddonRepository.getCompatibilityOverridesSync(a9.id);
+  Assert.notEqual(overrides, null);
+  Assert.equal(overrides.length, 1);
+  Assert.ok(!a9.isCompatible);
+  Assert.ok(a9.appDisabled);
 
-    executeSoon(aCallback);
-  });
+  executeSoon(aCallback);
 }
 
 function run_test_1() {
   info("Run test 1");
   check_compat_status(run_test_2);
 }
 
 function run_test_2() {
--- a/toolkit/mozapps/extensions/test/xpcshell/test_corruptfile.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_corruptfile.js
@@ -15,69 +15,65 @@ function run_test() {
   if (TEST_UNPACKED)
     run_test_unpacked();
   else
     run_test_packed();
 }
 
 // When installing packed we won't detect corruption in the XPI until we attempt
 // to load bootstrap.js so everything will look normal from the outside.
-function run_test_packed() {
+async function run_test_packed() {
   do_test_pending();
 
   prepare_test({
     "corrupt@tests.mozilla.org": [
       ["onInstalling", false],
       ["onInstalled", false]
     ]
   }, [
     "onNewInstall",
     "onInstallStarted",
     "onInstallEnded"
   ]);
 
-  installAllFiles([do_get_file("data/corruptfile.xpi")], function() {
-    ensure_test_completed();
+  await promiseInstallAllFiles([do_get_file("data/corruptfile.xpi")]);
+  ensure_test_completed();
 
-    AddonManager.getAddonByID("corrupt@tests.mozilla.org", function(addon) {
-      Assert.notEqual(addon, null);
+  let addon = await AddonManager.getAddonByID("corrupt@tests.mozilla.org");
+  Assert.notEqual(addon, null);
 
-      do_test_finished();
-    });
-  });
+  do_test_finished();
 }
 
 // When extracting the corruption will be detected and the add-on fails to
 // install
-function run_test_unpacked() {
+async function run_test_unpacked() {
   do_test_pending();
 
   prepare_test({
     "corrupt@tests.mozilla.org": [
       ["onInstalling", false],
       "onOperationCancelled"
     ]
   }, [
     "onNewInstall",
     "onInstallStarted",
     "onInstallFailed"
   ]);
 
-  installAllFiles([do_get_file("data/corruptfile.xpi")], function() {
-    ensure_test_completed();
+  await promiseInstallAllFiles([do_get_file("data/corruptfile.xpi")]);
+  ensure_test_completed();
 
-    // Check the add-on directory isn't left over
-    var addonDir = profileDir.clone();
-    addonDir.append("corrupt@tests.mozilla.org");
-    pathShouldntExist(addonDir);
+  // Check the add-on directory isn't left over
+  var addonDir = profileDir.clone();
+  addonDir.append("corrupt@tests.mozilla.org");
+  pathShouldntExist(addonDir);
 
-    // Check the staging directory isn't left over
-    var stageDir = profileDir.clone();
-    stageDir.append("staged");
-    pathShouldntExist(stageDir);
+  // Check the staging directory isn't left over
+  var stageDir = profileDir.clone();
+  stageDir.append("staged");
+  pathShouldntExist(stageDir);
 
-    AddonManager.getAddonByID("corrupt@tests.mozilla.org", function(addon) {
-      Assert.equal(addon, null);
+  let addon = await AddonManager.getAddonByID("corrupt@tests.mozilla.org");
+  Assert.equal(addon, null);
 
-      do_test_finished();
-    });
-  });
+  do_test_finished();
 }
--- a/toolkit/mozapps/extensions/test/xpcshell/test_distribution.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_distribution.js
@@ -75,199 +75,187 @@ function setOldModificationTime() {
 function run_test() {
   do_test_pending();
 
   run_test_1();
 }
 
 // Tests that on the first startup the add-on gets installed, with now as the
 // profile modifiedTime.
-function run_test_1() {
+async function run_test_1() {
   let extension = writeInstallRDFForExtension(addon1_1, distroDir);
   setExtensionModifiedTime(extension, Date.now() - MAKE_FILE_OLD_DIFFERENCE);
 
   startupManager();
 
-  AddonManager.getAddonByID("addon1@tests.mozilla.org", function(a1) {
-    Assert.notEqual(a1, null);
-    Assert.equal(a1.version, "1.0");
-    Assert.ok(a1.isActive);
-    Assert.equal(a1.scope, AddonManager.SCOPE_PROFILE);
-    Assert.ok(!a1.foreignInstall);
+  let a1 = await AddonManager.getAddonByID("addon1@tests.mozilla.org");
+  Assert.notEqual(a1, null);
+  Assert.equal(a1.version, "1.0");
+  Assert.ok(a1.isActive);
+  Assert.equal(a1.scope, AddonManager.SCOPE_PROFILE);
+  Assert.ok(!a1.foreignInstall);
 
-    // Modification time should be updated when the addon is copied to the
-    // profile.
-    let testURI = a1.getResourceURI(TEST_UNPACKED ? "install.rdf" : "");
-    let testFile = testURI.QueryInterface(Ci.nsIFileURL).file;
+  // Modification time should be updated when the addon is copied to the
+  // profile.
+  let testURI = a1.getResourceURI(TEST_UNPACKED ? "install.rdf" : "");
+  let testFile = testURI.QueryInterface(Ci.nsIFileURL).file;
 
-    Assert.ok(testFile.exists());
-    let difference = testFile.lastModifiedTime - Date.now();
-    Assert.ok(Math.abs(difference) < MAX_TIME_DIFFERENCE);
+  Assert.ok(testFile.exists());
+  let difference = testFile.lastModifiedTime - Date.now();
+  Assert.ok(Math.abs(difference) < MAX_TIME_DIFFERENCE);
 
-    executeSoon(run_test_2);
-  });
+  executeSoon(run_test_2);
 }
 
 // Tests that starting with a newer version in the distribution dir doesn't
 // install it yet
-function run_test_2() {
+async function run_test_2() {
   setOldModificationTime();
 
   writeInstallRDFForExtension(addon1_2, distroDir);
 
   restartManager();
 
-  AddonManager.getAddonByID("addon1@tests.mozilla.org", function(a1) {
-    Assert.notEqual(a1, null);
-    Assert.equal(a1.version, "1.0");
-    Assert.ok(a1.isActive);
-    Assert.equal(a1.scope, AddonManager.SCOPE_PROFILE);
+  let a1 = await AddonManager.getAddonByID("addon1@tests.mozilla.org");
+  Assert.notEqual(a1, null);
+  Assert.equal(a1.version, "1.0");
+  Assert.ok(a1.isActive);
+  Assert.equal(a1.scope, AddonManager.SCOPE_PROFILE);
 
-    executeSoon(run_test_3);
-  });
+  executeSoon(run_test_3);
 }
 
 // Test that an app upgrade installs the newer version
-function run_test_3() {
+async function run_test_3() {
   restartManager("2");
 
-  AddonManager.getAddonByID("addon1@tests.mozilla.org", function(a1) {
-    Assert.notEqual(a1, null);
-    Assert.equal(a1.version, "2.0");
-    Assert.ok(a1.isActive);
-    Assert.equal(a1.scope, AddonManager.SCOPE_PROFILE);
-    Assert.ok(!a1.foreignInstall);
+  let a1 = await AddonManager.getAddonByID("addon1@tests.mozilla.org");
+  Assert.notEqual(a1, null);
+  Assert.equal(a1.version, "2.0");
+  Assert.ok(a1.isActive);
+  Assert.equal(a1.scope, AddonManager.SCOPE_PROFILE);
+  Assert.ok(!a1.foreignInstall);
 
-    executeSoon(run_test_4);
-  });
+  executeSoon(run_test_4);
 }
 
 // Test that an app upgrade doesn't downgrade the extension
-function run_test_4() {
+async function run_test_4() {
   setOldModificationTime();
 
   writeInstallRDFForExtension(addon1_1, distroDir);
 
   restartManager("3");
 
-  AddonManager.getAddonByID("addon1@tests.mozilla.org", function(a1) {
-    Assert.notEqual(a1, null);
-    Assert.equal(a1.version, "2.0");
-    Assert.ok(a1.isActive);
-    Assert.equal(a1.scope, AddonManager.SCOPE_PROFILE);
+  let a1 = await AddonManager.getAddonByID("addon1@tests.mozilla.org");
+  Assert.notEqual(a1, null);
+  Assert.equal(a1.version, "2.0");
+  Assert.ok(a1.isActive);
+  Assert.equal(a1.scope, AddonManager.SCOPE_PROFILE);
 
-    executeSoon(run_test_5);
-  });
+  executeSoon(run_test_5);
 }
 
 // Tests that after uninstalling a restart doesn't re-install the extension
-function run_test_5() {
-  AddonManager.getAddonByID("addon1@tests.mozilla.org", callback_soon(function(a1) {
-    a1.uninstall();
-
-    restartManager();
+async function run_test_5() {
+  let a1 = await AddonManager.getAddonByID("addon1@tests.mozilla.org");
+  a1.uninstall();
 
-    AddonManager.getAddonByID("addon1@tests.mozilla.org", function(a1_2) {
-      Assert.equal(a1_2, null);
+  restartManager();
 
-      executeSoon(run_test_6);
-    });
-  }));
+  let a1_2 = await AddonManager.getAddonByID("addon1@tests.mozilla.org");
+  Assert.equal(a1_2, null);
+
+  executeSoon(run_test_6);
 }
 
 // Tests that upgrading the application still doesn't re-install the uninstalled
 // extension
-function run_test_6() {
+async function run_test_6() {
   restartManager("4");
 
-  AddonManager.getAddonByID("addon1@tests.mozilla.org", function(a1) {
-    Assert.equal(a1, null);
+  let a1 = await AddonManager.getAddonByID("addon1@tests.mozilla.org");
+  Assert.equal(a1, null);
 
-    executeSoon(run_test_7);
-  });
+  executeSoon(run_test_7);
 }
 
 // Tests that a pending install of a newer version of a distributed add-on
 // at app change still gets applied
-function run_test_7() {
+async function run_test_7() {
   Services.prefs.clearUserPref("extensions.installedDistroAddon.addon1@tests.mozilla.org");
 
-  installAllFiles([do_get_addon("test_distribution1_2")], function() {
-    restartManager(2);
+  await promiseInstallAllFiles([do_get_addon("test_distribution1_2")]);
+  restartManager(2);
 
-    AddonManager.getAddonByID("addon1@tests.mozilla.org", function(a1) {
-      Assert.notEqual(a1, null);
-      Assert.equal(a1.version, "2.0");
-      Assert.ok(a1.isActive);
-      Assert.equal(a1.scope, AddonManager.SCOPE_PROFILE);
+  let a1 = await AddonManager.getAddonByID("addon1@tests.mozilla.org");
+  Assert.notEqual(a1, null);
+  Assert.equal(a1.version, "2.0");
+  Assert.ok(a1.isActive);
+  Assert.equal(a1.scope, AddonManager.SCOPE_PROFILE);
 
-      a1.uninstall();
-      executeSoon(run_test_8);
-    });
-  });
+  a1.uninstall();
+  executeSoon(run_test_8);
 }
 
 // Tests that a pending install of a older version of a distributed add-on
 // at app change gets replaced by the distributed version
-function run_test_8() {
+async function run_test_8() {
   restartManager();
 
   writeInstallRDFForExtension(addon1_3, distroDir);
 
-  installAllFiles([do_get_addon("test_distribution1_2")], function() {
-    restartManager(3);
+  await promiseInstallAllFiles([do_get_addon("test_distribution1_2")]);
+  restartManager(3);
 
-    AddonManager.getAddonByID("addon1@tests.mozilla.org", function(a1) {
-      Assert.notEqual(a1, null);
-      Assert.equal(a1.version, "3.0");
-      Assert.ok(a1.isActive);
-      Assert.equal(a1.scope, AddonManager.SCOPE_PROFILE);
+  let a1 = await AddonManager.getAddonByID("addon1@tests.mozilla.org");
+  Assert.notEqual(a1, null);
+  Assert.equal(a1.version, "3.0");
+  Assert.ok(a1.isActive);
+  Assert.equal(a1.scope, AddonManager.SCOPE_PROFILE);
 
-      a1.uninstall();
-      executeSoon(run_test_9);
-    });
-  });
+  a1.uninstall();
+  executeSoon(run_test_9);
 }
 
 // Tests that bootstrapped add-ons distributed start up correctly, also that
 // add-ons with multiple directories get copied fully
-function run_test_9() {
+async function run_test_9() {
   restartManager();
 
   // Copy the test add-on to the distro dir
   let addon = do_get_file("data/test_distribution2_2");
   addon.copyTo(distroDir, "addon2@tests.mozilla.org");
 
   restartManager("5");
 
-  AddonManager.getAddonByID("addon2@tests.mozilla.org", function(a2) {
-    Assert.notEqual(a2, null);
-    Assert.ok(a2.isActive);
+  let a2 = await AddonManager.getAddonByID("addon2@tests.mozilla.org");
+  Assert.notEqual(a2, null);
+  Assert.ok(a2.isActive);
 
-    Assert.equal(getInstalledVersion(), 2);
-    Assert.equal(getActiveVersion(), 2);
+  Assert.equal(getInstalledVersion(), 2);
+  Assert.equal(getActiveVersion(), 2);
 
-    Assert.ok(a2.hasResource("bootstrap.js"));
-    Assert.ok(a2.hasResource("subdir/dummy.txt"));
-    Assert.ok(a2.hasResource("subdir/subdir2/dummy2.txt"));
+  Assert.ok(a2.hasResource("bootstrap.js"));
+  Assert.ok(a2.hasResource("subdir/dummy.txt"));
+  Assert.ok(a2.hasResource("subdir/subdir2/dummy2.txt"));
 
-    // Currently installs are unpacked if the source is a directory regardless
-    // of the install.rdf property or the global preference
+  // Currently installs are unpacked if the source is a directory regardless
+  // of the install.rdf property or the global preference
 
-    let addonDir = profileDir.clone();
-    addonDir.append("addon2@tests.mozilla.org");
-    Assert.ok(addonDir.exists());
-    Assert.ok(addonDir.isDirectory());
-    addonDir.append("subdir");
-    Assert.ok(addonDir.exists());
-    Assert.ok(addonDir.isDirectory());
-    addonDir.append("subdir2");
-    Assert.ok(addonDir.exists());
-    Assert.ok(addonDir.isDirectory());
-    addonDir.append("dummy2.txt");
-    Assert.ok(addonDir.exists());
-    Assert.ok(addonDir.isFile());
+  let addonDir = profileDir.clone();
+  addonDir.append("addon2@tests.mozilla.org");
+  Assert.ok(addonDir.exists());
+  Assert.ok(addonDir.isDirectory());
+  addonDir.append("subdir");
+  Assert.ok(addonDir.exists());
+  Assert.ok(addonDir.isDirectory());
+  addonDir.append("subdir2");
+  Assert.ok(addonDir.exists());
+  Assert.ok(addonDir.isDirectory());
+  addonDir.append("dummy2.txt");
+  Assert.ok(addonDir.exists());
+  Assert.ok(addonDir.isFile());
 
-    a2.uninstall();
+  a2.uninstall();
 
-    executeSoon(do_test_finished);
-  });
+  executeSoon(do_test_finished);
 }
--- a/toolkit/mozapps/extensions/test/xpcshell/test_duplicateplugins.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_duplicateplugins.js
@@ -111,71 +111,67 @@ function run_test() {
 
 function found_plugin(aNum, aId) {
   if (gPluginIDs[aNum])
     do_throw("Found duplicate of plugin " + aNum);
   gPluginIDs[aNum] = aId;
 }
 
 // Test that the plugins were coalesced and all appear in the returned list
-function run_test_1() {
-  AddonManager.getAddonsByTypes(["plugin"], function(aAddons) {
-    Assert.equal(aAddons.length, 5);
-    aAddons.forEach(function(aAddon) {
-      if (aAddon.name == "Duplicate Plugin 1") {
-        found_plugin(0, aAddon.id);
-        Assert.equal(aAddon.description, "A duplicate plugin");
-      } else if (aAddon.name == "Duplicate Plugin 2") {
-        found_plugin(1, aAddon.id);
-        Assert.equal(aAddon.description, "Another duplicate plugin");
-      } else if (aAddon.name == "Another Non-duplicate Plugin") {
-        found_plugin(5, aAddon.id);
-        Assert.equal(aAddon.description, "Not a duplicate plugin");
-      } else if (aAddon.name == "Non-duplicate Plugin") {
-        if (aAddon.description == "Not a duplicate plugin")
-          found_plugin(3, aAddon.id);
-        else if (aAddon.description == "Not a duplicate because the descriptions are different")
-          found_plugin(4, aAddon.id);
-        else
-          do_throw("Found unexpected plugin with description " + aAddon.description);
-      } else {
-        do_throw("Found unexpected plugin " + aAddon.name);
-      }
-    });
+async function run_test_1() {
+  let aAddons = await AddonManager.getAddonsByTypes(["plugin"]);
+  Assert.equal(aAddons.length, 5);
+  aAddons.forEach(function(aAddon) {
+    if (aAddon.name == "Duplicate Plugin 1") {
+      found_plugin(0, aAddon.id);
+      Assert.equal(aAddon.description, "A duplicate plugin");
+    } else if (aAddon.name == "Duplicate Plugin 2") {
+      found_plugin(1, aAddon.id);
+      Assert.equal(aAddon.description, "Another duplicate plugin");
+    } else if (aAddon.name == "Another Non-duplicate Plugin") {
+      found_plugin(5, aAddon.id);
+      Assert.equal(aAddon.description, "Not a duplicate plugin");
+    } else if (aAddon.name == "Non-duplicate Plugin") {
+      if (aAddon.description == "Not a duplicate plugin")
+        found_plugin(3, aAddon.id);
+      else if (aAddon.description == "Not a duplicate because the descriptions are different")
+        found_plugin(4, aAddon.id);
+      else
+        do_throw("Found unexpected plugin with description " + aAddon.description);
+    } else {
+      do_throw("Found unexpected plugin " + aAddon.name);
+    }
+  });
 
-    run_test_2();
-  });
+  run_test_2();
 }
 
 // Test that disabling a coalesced plugin disables all its tags
-function run_test_2() {
-  AddonManager.getAddonByID(gPluginIDs[0], function(p) {
-    Assert.ok(!p.userDisabled);
-    p.userDisabled = true;
-    Assert.ok(PLUGINS[0].disabled);
-    Assert.ok(PLUGINS[1].disabled);
+async function run_test_2() {
+  let p = await AddonManager.getAddonByID(gPluginIDs[0]);
+  Assert.ok(!p.userDisabled);
+  p.userDisabled = true;
+  Assert.ok(PLUGINS[0].disabled);
+  Assert.ok(PLUGINS[1].disabled);
 
-    executeSoon(run_test_3);
-  });
+  executeSoon(run_test_3);
 }
 
 // Test that IDs persist across restart
-function run_test_3() {
+async function run_test_3() {
   restartManager();
 
-  AddonManager.getAddonByID(gPluginIDs[0], callback_soon(function(p) {
-    Assert.notEqual(p, null);
-    Assert.equal(p.name, "Duplicate Plugin 1");
-    Assert.equal(p.description, "A duplicate plugin");
-
-    // Reorder the plugins and restart again
-    [PLUGINS[0], PLUGINS[1]] = [PLUGINS[1], PLUGINS[0]];
-    restartManager();
+  let p = await AddonManager.getAddonByID(gPluginIDs[0]);
+  Assert.notEqual(p, null);
+  Assert.equal(p.name, "Duplicate Plugin 1");
+  Assert.equal(p.description, "A duplicate plugin");
 
-    AddonManager.getAddonByID(gPluginIDs[0], function(p_2) {
-      Assert.notEqual(p_2, null);
-      Assert.equal(p_2.name, "Duplicate Plugin 1");
-      Assert.equal(p_2.description, "A duplicate plugin");
+  // Reorder the plugins and restart again
+  [PLUGINS[0], PLUGINS[1]] = [PLUGINS[1], PLUGINS[0]];
+  restartManager();
 
-      executeSoon(do_test_finished);
-    });
-  }));
+  let p_2 = await AddonManager.getAddonByID(gPluginIDs[0]);
+  Assert.notEqual(p_2, null);
+  Assert.equal(p_2.name, "Duplicate Plugin 1");
+  Assert.equal(p_2.description, "A duplicate plugin");
+
+  executeSoon(do_test_finished);
 }
--- a/toolkit/mozapps/extensions/test/xpcshell/test_error.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_error.js
@@ -14,77 +14,71 @@ function run_test() {
 
   startupManager();
 
   do_test_pending();
   run_test_1();
 }
 
 // Checks that a local file validates ok
-function run_test_1() {
-  AddonManager.getInstallForFile(do_get_file("data/unsigned.xpi"), function(install) {
-    Assert.notEqual(install, null);
-    Assert.equal(install.state, AddonManager.STATE_DOWNLOADED);
-    Assert.equal(install.error, 0);
+async function run_test_1() {
+  let install = await AddonManager.getInstallForFile(do_get_file("data/unsigned.xpi"));
+  Assert.notEqual(install, null);
+  Assert.equal(install.state, AddonManager.STATE_DOWNLOADED);
+  Assert.equal(install.error, 0);
 
-    install.cancel();
+  install.cancel();
 
-    run_test_2();
-  });
+  run_test_2();
 }
 
 // Checks that a corrupt file shows an error
-function run_test_2() {
-  AddonManager.getInstallForFile(do_get_file("data/corrupt.xpi"), function(install) {
-    Assert.notEqual(install, null);
-    Assert.equal(install.state, AddonManager.STATE_DOWNLOAD_FAILED);
-    Assert.equal(install.error, AddonManager.ERROR_CORRUPT_FILE);
+async function run_test_2() {
+  let install = await AddonManager.getInstallForFile(do_get_file("data/corrupt.xpi"));
+  Assert.notEqual(install, null);
+  Assert.equal(install.state, AddonManager.STATE_DOWNLOAD_FAILED);
+  Assert.equal(install.error, AddonManager.ERROR_CORRUPT_FILE);
 
-    run_test_3();
-  });
+  run_test_3();
 }
 
 // Checks that an empty file shows an error
-function run_test_3() {
-  AddonManager.getInstallForFile(do_get_file("data/empty.xpi"), function(install) {
-    Assert.notEqual(install, null);
-    Assert.equal(install.state, AddonManager.STATE_DOWNLOAD_FAILED);
-    Assert.equal(install.error, AddonManager.ERROR_CORRUPT_FILE);
+async function run_test_3() {
+  let install = await AddonManager.getInstallForFile(do_get_file("data/empty.xpi"));
+  Assert.notEqual(install, null);
+  Assert.equal(install.state, AddonManager.STATE_DOWNLOAD_FAILED);
+  Assert.equal(install.error, AddonManager.ERROR_CORRUPT_FILE);
 
-    run_test_4();
-  });
+  run_test_4();
 }
 
 // Checks that a file that doesn't match its hash shows an error
-function run_test_4() {
+async function run_test_4() {
   let url = Services.io.newFileURI(do_get_file("data/unsigned.xpi")).spec;
-  AddonManager.getInstallForURL(url, function(install) {
-    Assert.notEqual(install, null);
-    Assert.equal(install.state, AddonManager.STATE_DOWNLOAD_FAILED);
-    Assert.equal(install.error, AddonManager.ERROR_INCORRECT_HASH);
+  let install = await AddonManager.getInstallForURL(url, null, "application/x-xpinstall", "sha1:foo");
+  Assert.notEqual(install, null);
+  Assert.equal(install.state, AddonManager.STATE_DOWNLOAD_FAILED);
+  Assert.equal(install.error, AddonManager.ERROR_INCORRECT_HASH);
 
-    run_test_5();
-  }, "application/x-xpinstall", "sha1:foo");
+  run_test_5();
 }
 
 // Checks that a file that doesn't exist shows an error
-function run_test_5() {
+async function run_test_5() {
   let file = do_get_file("data");
   file.append("missing.xpi");
-  AddonManager.getInstallForFile(file, function(install) {
-    Assert.notEqual(install, null);
-    Assert.equal(install.state, AddonManager.STATE_DOWNLOAD_FAILED);
-    Assert.equal(install.error, AddonManager.ERROR_NETWORK_FAILURE);
+  let install = await AddonManager.getInstallForFile(file);
+  Assert.notEqual(install, null);
+  Assert.equal(install.state, AddonManager.STATE_DOWNLOAD_FAILED);
+  Assert.equal(install.error, AddonManager.ERROR_NETWORK_FAILURE);
 
-    run_test_6();
-  });
+  run_test_6();
 }
 
 // Checks that an add-on with an illegal ID shows an error
-function run_test_6() {
-  AddonManager.getInstallForFile(do_get_addon("test_bug567173"), function(install) {
-    Assert.notEqual(install, null);
-    Assert.equal(install.state, AddonManager.STATE_DOWNLOAD_FAILED);
-    Assert.equal(install.error, AddonManager.ERROR_CORRUPT_FILE);
+async function run_test_6() {
+  let install = await AddonManager.getInstallForFile(do_get_addon("test_bug567173"));
+  Assert.notEqual(install, null);
+  Assert.equal(install.state, AddonManager.STATE_DOWNLOAD_FAILED);
+  Assert.equal(install.error, AddonManager.ERROR_CORRUPT_FILE);
 
-    executeSoon(do_test_finished);
-  });
+  executeSoon(do_test_finished);
 }
--- a/toolkit/mozapps/extensions/test/xpcshell/test_general.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_general.js
@@ -4,54 +4,49 @@
 
 // This just verifies that the EM can actually startup and shutdown a few times
 // without any errors
 
 // We have to look up how many add-ons are present since there will be plugins
 // etc. detected
 var gCount;
 
-function run_test() {
+async function run_test() {
   do_test_pending();
   createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1.9.2");
 
   startupManager();
-  AddonManager.getAddonsByTypes(null, function(list) {
-    gCount = list.length;
+  let list = await AddonManager.getAddonsByTypes(null);
+  gCount = list.length;
 
-    executeSoon(run_test_1);
-  });
+  executeSoon(run_test_1);
 }
 
-function run_test_1() {
+async function run_test_1() {
   restartManager();
 
-  AddonManager.getAddonsByTypes(null, function(addons) {
-    Assert.equal(gCount, addons.length);
+  let addons = await AddonManager.getAddonsByTypes(null);
+  Assert.equal(gCount, addons.length);
 
-    AddonManager.getAddonsWithOperationsByTypes(null, function(pendingAddons) {
-      Assert.equal(0, pendingAddons.length);
+  let pendingAddons = await AddonManager.getAddonsWithOperationsByTypes(null);
+  Assert.equal(0, pendingAddons.length);
 
-      executeSoon(run_test_2);
-    });
-  });
+  executeSoon(run_test_2);
 }
 
-function run_test_2() {
+async function run_test_2() {
   shutdownManager();
 
   startupManager(false);
 
-  AddonManager.getAddonsByTypes(null, function(addons) {
-    Assert.equal(gCount, addons.length);
+  let addons = await AddonManager.getAddonsByTypes(null);
+  Assert.equal(gCount, addons.length);
 
-    executeSoon(run_test_3);
-  });
+  executeSoon(run_test_3);
 }
 
-function run_test_3() {
+async function run_test_3() {
   restartManager();
 
-  AddonManager.getAddonsByTypes(null, callback_soon(function(addons) {
-    Assert.equal(gCount, addons.length);
-    do_test_finished();
-  }));
+  let addons = await AddonManager.getAddonsByTypes(null);
+  Assert.equal(gCount, addons.length);
+  do_test_finished();
 }
--- a/toolkit/mozapps/extensions/test/xpcshell/test_getresource.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_getresource.js
@@ -4,91 +4,85 @@
 
 // install.rdf size, icon.png size, subfile.txt size
 const ADDON_SIZE = 672 + 15 + 26;
 
 // This verifies the functionality of getResourceURI
 // There are two cases - with a filename it returns an nsIFileURL to the filename
 // and with no parameters, it returns an nsIFileURL to the root of the addon
 
-function run_test() {
+async function run_test() {
   do_test_pending();
   createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1");
 
   startupManager();
 
-  AddonManager.getInstallForFile(do_get_addon("test_getresource"), function(aInstall) {
-    Assert.ok(aInstall.addon.hasResource("install.rdf"));
-    Assert.equal(aInstall.addon.getResourceURI().spec, aInstall.sourceURI.spec);
+  let aInstall = await AddonManager.getInstallForFile(do_get_addon("test_getresource"));
+  Assert.ok(aInstall.addon.hasResource("install.rdf"));
+  Assert.equal(aInstall.addon.getResourceURI().spec, aInstall.sourceURI.spec);
 
-    Assert.ok(aInstall.addon.hasResource("icon.png"));
-    Assert.equal(aInstall.addon.getResourceURI("icon.png").spec,
-                 "jar:" + aInstall.sourceURI.spec + "!/icon.png");
+  Assert.ok(aInstall.addon.hasResource("icon.png"));
+  Assert.equal(aInstall.addon.getResourceURI("icon.png").spec,
+               "jar:" + aInstall.sourceURI.spec + "!/icon.png");
 
-    Assert.ok(!aInstall.addon.hasResource("missing.txt"));
+  Assert.ok(!aInstall.addon.hasResource("missing.txt"));
 
-    Assert.ok(aInstall.addon.hasResource("subdir/subfile.txt"));
-    Assert.equal(aInstall.addon.getResourceURI("subdir/subfile.txt").spec,
-                 "jar:" + aInstall.sourceURI.spec + "!/subdir/subfile.txt");
+  Assert.ok(aInstall.addon.hasResource("subdir/subfile.txt"));
+  Assert.equal(aInstall.addon.getResourceURI("subdir/subfile.txt").spec,
+               "jar:" + aInstall.sourceURI.spec + "!/subdir/subfile.txt");
 
-    Assert.ok(!aInstall.addon.hasResource("subdir/missing.txt"));
+  Assert.ok(!aInstall.addon.hasResource("subdir/missing.txt"));
 
-    Assert.equal(aInstall.addon.size, ADDON_SIZE);
+  Assert.equal(aInstall.addon.size, ADDON_SIZE);
 
-    completeAllInstalls([aInstall], function() {
-      restartManager();
-      AddonManager.getAddonByID("addon1@tests.mozilla.org", function(a1) {
-        Assert.notEqual(a1, null);
+  await promiseCompleteAllInstalls([aInstall]);
+  restartManager();
+  let a1 = await AddonManager.getAddonByID("addon1@tests.mozilla.org");
+  Assert.notEqual(a1, null);
 
-        let addonDir = gProfD.clone();
-        addonDir.append("extensions");
-        let rootUri = do_get_addon_root_uri(addonDir, "addon1@tests.mozilla.org");
+  let addonDir = gProfD.clone();
+  addonDir.append("extensions");
+  let rootUri = do_get_addon_root_uri(addonDir, "addon1@tests.mozilla.org");
 
-        let uri = a1.getResourceURI("/");
-        Assert.equal(uri.spec, rootUri);
+  let uri = a1.getResourceURI("/");
+  Assert.equal(uri.spec, rootUri);
 
-        let file = rootUri + "install.rdf";
-        Assert.ok(a1.hasResource("install.rdf"));
-        uri = a1.getResourceURI("install.rdf");
-        Assert.equal(uri.spec, file);
+  let file = rootUri + "install.rdf";
+  Assert.ok(a1.hasResource("install.rdf"));
+  uri = a1.getResourceURI("install.rdf");
+  Assert.equal(uri.spec, file);
 
-        file = rootUri + "icon.png";
-        Assert.ok(a1.hasResource("icon.png"));
-        uri = a1.getResourceURI("icon.png");
-        Assert.equal(uri.spec, file);
+  file = rootUri + "icon.png";
+  Assert.ok(a1.hasResource("icon.png"));
+  uri = a1.getResourceURI("icon.png");
+  Assert.equal(uri.spec, file);
 
-        Assert.ok(!a1.hasResource("missing.txt"));
+  Assert.ok(!a1.hasResource("missing.txt"));
 
-        file = rootUri + "subdir/subfile.txt";
-        Assert.ok(a1.hasResource("subdir/subfile.txt"));
-        uri = a1.getResourceURI("subdir/subfile.txt");
-        Assert.equal(uri.spec, file);
+  file = rootUri + "subdir/subfile.txt";
+  Assert.ok(a1.hasResource("subdir/subfile.txt"));
+  uri = a1.getResourceURI("subdir/subfile.txt");
+  Assert.equal(uri.spec, file);
 
-        Assert.ok(!a1.hasResource("subdir/missing.txt"));
+  Assert.ok(!a1.hasResource("subdir/missing.txt"));
 
-        Assert.equal(a1.size, ADDON_SIZE);
+  Assert.equal(a1.size, ADDON_SIZE);
 
-        a1.uninstall();
+  a1.uninstall();
 
-        try {
-          // hasResource should never throw an exception.
-          Assert.ok(!a1.hasResource("icon.png"));
-        } catch (e) {
-          Assert.ok(false);
-        }
-
-        AddonManager.getInstallForFile(do_get_addon("test_getresource"),
-            callback_soon(function(aInstall_2) {
-          Assert.ok(!a1.hasResource("icon.png"));
-          Assert.ok(aInstall_2.addon.hasResource("icon.png"));
+  try {
+    // hasResource should never throw an exception.
+    Assert.ok(!a1.hasResource("icon.png"));
+  } catch (e) {
+    Assert.ok(false);
+  }
 
-          restartManager();
+  let aInstall_2 = await AddonManager.getInstallForFile(do_get_addon("test_getresource"));
+  Assert.ok(!a1.hasResource("icon.png"));
+  Assert.ok(aInstall_2.addon.hasResource("icon.png"));
 
-          AddonManager.getAddonByID("addon1@tests.mozilla.org", function(newa1) {
-            Assert.equal(newa1, null);
+  restartManager();
 
-            executeSoon(do_test_finished);
-          });
-        }));
-      });
-    });
-  });
+  let newa1 = await AddonManager.getAddonByID("addon1@tests.mozilla.org");
+  Assert.equal(newa1, null);
+
+  executeSoon(do_test_finished);
 }
--- a/toolkit/mozapps/extensions/test/xpcshell/test_install_icons.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_install_icons.js
@@ -15,47 +15,43 @@ var icon64_url = "http://localhost:" + g
 function run_test() {
   do_test_pending();
   createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1.9.2");
   startupManager();
 
   test_1();
 }
 
-function test_1() {
-  AddonManager.getInstallForURL(addon_url, function(aInstall) {
-    Assert.equal(aInstall.iconURL, null);
-    Assert.notEqual(aInstall.icons, null);
-    Assert.equal(aInstall.icons[32], undefined);
-    Assert.equal(aInstall.icons[64], undefined);
-    test_2();
-  }, "application/x-xpinstall", null, null, null, null, null);
+async function test_1() {
+  let aInstall = await AddonManager.getInstallForURL(addon_url, null, "application/x-xpinstall", null, null, null, null, null);
+  Assert.equal(aInstall.iconURL, null);
+  Assert.notEqual(aInstall.icons, null);
+  Assert.equal(aInstall.icons[32], undefined);
+  Assert.equal(aInstall.icons[64], undefined);
+  test_2();
 }
 
-function test_2() {
-  AddonManager.getInstallForURL(addon_url, function(aInstall) {
-    Assert.equal(aInstall.iconURL, icon32_url);
-    Assert.notEqual(aInstall.icons, null);
-    Assert.equal(aInstall.icons[32], icon32_url);
-    Assert.equal(aInstall.icons[64], undefined);
-    test_3();
-  }, "application/x-xpinstall", null, null, icon32_url, null, null);
+async function test_2() {
+  let aInstall = await AddonManager.getInstallForURL(addon_url, null, "application/x-xpinstall", null, null, icon32_url, null, null);
+  Assert.equal(aInstall.iconURL, icon32_url);
+  Assert.notEqual(aInstall.icons, null);
+  Assert.equal(aInstall.icons[32], icon32_url);
+  Assert.equal(aInstall.icons[64], undefined);
+  test_3();
 }
 
-function test_3() {
-  AddonManager.getInstallForURL(addon_url, function(aInstall) {
-    Assert.equal(aInstall.iconURL, icon32_url);
-    Assert.notEqual(aInstall.icons, null);
-    Assert.equal(aInstall.icons[32], icon32_url);
-    Assert.equal(aInstall.icons[64], undefined);
-    test_4();
-  }, "application/x-xpinstall", null, null, { "32": icon32_url }, null, null);
+async function test_3() {
+  let aInstall = await AddonManager.getInstallForURL(addon_url, null, "application/x-xpinstall", null, null, { "32": icon32_url }, null, null);
+  Assert.equal(aInstall.iconURL, icon32_url);
+  Assert.notEqual(aInstall.icons, null);
+  Assert.equal(aInstall.icons[32], icon32_url);
+  Assert.equal(aInstall.icons[64], undefined);
+  test_4();
 }
 
-function test_4() {
-  AddonManager.getInstallForURL(addon_url, function(aInstall) {
-    Assert.equal(aInstall.iconURL, icon32_url);
-    Assert.notEqual(aInstall.icons, null);
-    Assert.equal(aInstall.icons[32], icon32_url);
-    Assert.equal(aInstall.icons[64], icon64_url);
-    executeSoon(do_test_finished);
-  }, "application/x-xpinstall", null, null, { "32": icon32_url, "64": icon64_url }, null, null);
+async function test_4() {
+  let aInstall = await AddonManager.getInstallForURL(addon_url, null, "application/x-xpinstall", null, null, { "32": icon32_url, "64": icon64_url }, null, null);
+  Assert.equal(aInstall.iconURL, icon32_url);
+  Assert.notEqual(aInstall.icons, null);
+  Assert.equal(aInstall.icons[32], icon32_url);
+  Assert.equal(aInstall.icons[64], icon64_url);
+  executeSoon(do_test_finished);
 }
--- a/toolkit/mozapps/extensions/test/xpcshell/test_locale.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_locale.js
@@ -10,134 +10,126 @@ function run_test() {
   Services.locale.setRequestedLocales(["fr-FR"]);
 
   startupManager();
 
   run_test_1();
 }
 
 // Tests that the localized properties are visible before installation
-function run_test_1() {
-  AddonManager.getInstallForFile(do_get_addon("test_locale"), function(install) {
-    Assert.equal(install.addon.name, "fr-FR Name");
-    Assert.equal(install.addon.description, "fr-FR Description");
+async function run_test_1() {
+  let install = await AddonManager.getInstallForFile(do_get_addon("test_locale"));
+  Assert.equal(install.addon.name, "fr-FR Name");
+  Assert.equal(install.addon.description, "fr-FR Description");
 
-    prepare_test({
-      "addon1@tests.mozilla.org": [
-        ["onInstalling", false],
-        ["onInstalled", false],
-      ]
-    }, [
-      "onInstallStarted",
-      "onInstallEnded",
-    ], callback_soon(run_test_2));
-    install.install();
-  });
+  prepare_test({
+    "addon1@tests.mozilla.org": [
+      ["onInstalling", false],
+      ["onInstalled", false],
+    ]
+  }, [
+    "onInstallStarted",
+    "onInstallEnded",
+  ], callback_soon(run_test_2));
+  install.install();
 }
 
 // Tests that the localized properties are visible after installation
-function run_test_2() {
+async function run_test_2() {
   restartManager();
 
-  AddonManager.getAddonByID("addon1@tests.mozilla.org", function(addon) {
-    Assert.notEqual(addon, null);
+  let addon = await AddonManager.getAddonByID("addon1@tests.mozilla.org");
+  Assert.notEqual(addon, null);
 
-    Assert.equal(addon.name, "fr-FR Name");
-    Assert.equal(addon.description, "fr-FR Description");
+  Assert.equal(addon.name, "fr-FR Name");
+  Assert.equal(addon.description, "fr-FR Description");
 
-    addon.userDisabled = true;
-    executeSoon(run_test_3);
-  });
+  addon.userDisabled = true;
+  executeSoon(run_test_3);
 }
 
 // Test that the localized properties are still there when disabled.
-function run_test_3() {
+async function run_test_3() {
   restartManager();
 
-  AddonManager.getAddonByID("addon1@tests.mozilla.org", function(addon) {
-    Assert.notEqual(addon, null);
-    Assert.equal(addon.name, "fr-FR Name");
+  let addon = await AddonManager.getAddonByID("addon1@tests.mozilla.org");
+  Assert.notEqual(addon, null);
+  Assert.equal(addon.name, "fr-FR Name");
 
-    executeSoon(run_test_4);
-  });
+  executeSoon(run_test_4);
 }
 
 // Localised preference values should be ignored when the add-on is disabled
-function run_test_4() {
+async function run_test_4() {
   Services.prefs.setCharPref("extensions.addon1@tests.mozilla.org.name", "Name from prefs");
   Services.prefs.setCharPref("extensions.addon1@tests.mozilla.org.contributor.1", "Contributor 1");
   Services.prefs.setCharPref("extensions.addon1@tests.mozilla.org.contributor.2", "Contributor 2");
   restartManager();
 
-  AddonManager.getAddonByID("addon1@tests.mozilla.org", function(addon) {
-    Assert.notEqual(addon, null);
-    Assert.equal(addon.name, "fr-FR Name");
-    let contributors = addon.contributors;
-    Assert.equal(contributors.length, 3);
-    Assert.equal(contributors[0], "Fr Contributor 1");
-    Assert.equal(contributors[1], "Fr Contributor 2");
-    Assert.equal(contributors[2], "Fr Contributor 3");
+  let addon = await AddonManager.getAddonByID("addon1@tests.mozilla.org");
+  Assert.notEqual(addon, null);
+  Assert.equal(addon.name, "fr-FR Name");
+  let contributors = addon.contributors;
+  Assert.equal(contributors.length, 3);
+  Assert.equal(contributors[0], "Fr Contributor 1");
+  Assert.equal(contributors[1], "Fr Contributor 2");
+  Assert.equal(contributors[2], "Fr Contributor 3");
 
-    executeSoon(run_test_5);
-  });
+  executeSoon(run_test_5);
 }
 
 // Test that changing locale works
-function run_test_5() {
+async function run_test_5() {
   Services.locale.setRequestedLocales(["de-DE"]);
   restartManager();
 
-  AddonManager.getAddonByID("addon1@tests.mozilla.org", function(addon) {
-    Assert.notEqual(addon, null);
+  let addon = await AddonManager.getAddonByID("addon1@tests.mozilla.org");
+  Assert.notEqual(addon, null);
 
-    Assert.equal(addon.name, "de-DE Name");
-    Assert.equal(addon.description, null);
+  Assert.equal(addon.name, "de-DE Name");
+  Assert.equal(addon.description, null);
 
-    executeSoon(run_test_6);
-  });
+  executeSoon(run_test_6);
 }
 
 // Test that missing locales use the fallbacks
-function run_test_6() {
+async function run_test_6() {
   Services.locale.setRequestedLocales(["nl-NL"]);
   restartManager();
 
-  AddonManager.getAddonByID("addon1@tests.mozilla.org", callback_soon(function(addon) {
-    Assert.notEqual(addon, null);
+  let addon = await AddonManager.getAddonByID("addon1@tests.mozilla.org");
+  Assert.notEqual(addon, null);
 
-    Assert.equal(addon.name, "Fallback Name");
-    Assert.equal(addon.description, "Fallback Description");
+  Assert.equal(addon.name, "Fallback Name");
+  Assert.equal(addon.description, "Fallback Description");
 
-    addon.userDisabled = false;
-    executeSoon(run_test_7);
-  }));
+  addon.userDisabled = false;
+  executeSoon(run_test_7);
 }
 
 // Test that the prefs will override the fallbacks
-function run_test_7() {
+async function run_test_7() {
   restartManager();
 
-  AddonManager.getAddonByID("addon1@tests.mozilla.org", function(addon) {
-    Assert.notEqual(addon, null);
+  let addon = await AddonManager.getAddonByID("addon1@tests.mozilla.org");
+  Assert.notEqual(addon, null);
 
-    Assert.equal(addon.name, "Name from prefs");
+  Assert.equal(addon.name, "Name from prefs");
 
-    executeSoon(run_test_8);
-  });
+  executeSoon(run_test_8);
 }
 
 // Test that the prefs will override localized values from the manifest
-function run_test_8() {
+async function run_test_8() {
   Services.locale.setRequestedLocales(["fr-FR"]);
   restartManager();
 
-  AddonManager.getAddonByID("addon1@tests.mozilla.org", function(addon) {
-    Assert.notEqual(addon, null);
+  let addon = await AddonManager.getAddonByID("addon1@tests.mozilla.org");
+  Assert.notEqual(addon, null);
 
-    Assert.equal(addon.name, "Name from prefs");
-    let contributors = addon.contributors;
-    Assert.equal(contributors.length, 2);
-    Assert.equal(contributors[0], "Contributor 1");
-    Assert.equal(contributors[1], "Contributor 2");
+  Assert.equal(addon.name, "Name from prefs");
+  let contributors = addon.contributors;
+  Assert.equal(contributors.length, 2);
+  Assert.equal(contributors[0], "Contributor 1");
+  Assert.equal(contributors[1], "Contributor 2");
 
-    executeSoon(do_test_finished);
-  });
+  executeSoon(do_test_finished);
 }
--- a/toolkit/mozapps/extensions/test/xpcshell/test_onPropertyChanged_appDisabled.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_onPropertyChanged_appDisabled.js
@@ -1,15 +1,15 @@
 /* Any copyright is dedicated to the Public Domain.
    http://creativecommons.org/publicdomain/zero/1.0/ */
 
 const profileDir = gProfD.clone();
 profileDir.append("extensions");
 
-function run_test() {
+async function run_test() {
   do_test_pending();
   createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1.9.2");
 
   writeInstallRDFForExtension({
     id: "addon1@tests.mozilla.org",
     version: "1.0",
     name: "Test 1",
     bootstrap: true,
@@ -19,49 +19,46 @@ function run_test() {
       maxVersion: "0.2"
     }]
   }, profileDir);
 
   startupManager();
 
   AddonManager.strictCompatibility = false;
 
-  AddonManager.getAddonByID("addon1@tests.mozilla.org", function(aAddon) {
-    Assert.notEqual(aAddon, null);
-    aAddon.userDisabled = true;
-    executeSoon(run_test_1);
-  });
+  let aAddon = await AddonManager.getAddonByID("addon1@tests.mozilla.org");
+  Assert.notEqual(aAddon, null);
+  aAddon.userDisabled = true;
+  executeSoon(run_test_1);
 }
 
-function run_test_1() {
+async function run_test_1() {
   restartManager();
-  AddonManager.getAddonByID("addon1@tests.mozilla.org", function(aAddon) {
-    Assert.notEqual(aAddon, null);
-    Assert.ok(aAddon.userDisabled);
-    Assert.ok(!aAddon.isActive);
-    Assert.ok(!aAddon.appDisabled);
+  let aAddon = await AddonManager.getAddonByID("addon1@tests.mozilla.org");
+  Assert.notEqual(aAddon, null);
+  Assert.ok(aAddon.userDisabled);
+  Assert.ok(!aAddon.isActive);
+  Assert.ok(!aAddon.appDisabled);
 
-    prepare_test({
-      "addon1@tests.mozilla.org": [
-        ["onPropertyChanged", ["appDisabled"]]
-      ]
-    }, [], run_test_2);
+  prepare_test({
+    "addon1@tests.mozilla.org": [
+      ["onPropertyChanged", ["appDisabled"]]
+    ]
+  }, [], run_test_2);
 
-    AddonManager.strictCompatibility = true;
-  });
+  AddonManager.strictCompatibility = true;
 }
 
-function run_test_2() {
-  AddonManager.getAddonByID("addon1@tests.mozilla.org", function(aAddon) {
-    Assert.notEqual(aAddon, null);
-    Assert.ok(aAddon.userDisabled);
-    Assert.ok(!aAddon.isActive);
-    Assert.ok(aAddon.appDisabled);
+async function run_test_2() {
+  let aAddon = await AddonManager.getAddonByID("addon1@tests.mozilla.org");
+  Assert.notEqual(aAddon, null);
+  Assert.ok(aAddon.userDisabled);
+  Assert.ok(!aAddon.isActive);
+  Assert.ok(aAddon.appDisabled);
 
-    prepare_test({
-      "addon1@tests.mozilla.org": [
-        ["onPropertyChanged", ["appDisabled"]]
-      ]
-    }, [], callback_soon(do_test_finished));
+  prepare_test({
+    "addon1@tests.mozilla.org": [
+      ["onPropertyChanged", ["appDisabled"]]
+    ]
+  }, [], callback_soon(do_test_finished));
 
-    AddonManager.strictCompatibility = false;
-  });
+  AddonManager.strictCompatibility = false;
 }
--- a/toolkit/mozapps/extensions/test/xpcshell/test_pluginchange.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_pluginchange.js
@@ -71,57 +71,55 @@ function end_test() {
 
 function sortAddons(addons) {
   addons.sort(function(a, b) {
     return a.name.localeCompare(b.name);
   });
 }
 
 // Basic check that the mock object works
-function run_test_1() {
-  AddonManager.getAddonsByTypes(["plugin"], function(addons) {
-    sortAddons(addons);
+async function run_test_1() {
+  let addons = await AddonManager.getAddonsByTypes(["plugin"]);
+  sortAddons(addons);
 
-    Assert.equal(addons.length, 2);
+  Assert.equal(addons.length, 2);
 
-    Assert.equal(addons[0].name, "Flash");
-    Assert.ok(!addons[0].userDisabled);
-    Assert.equal(addons[1].name, "Java");
-    Assert.ok(!addons[1].userDisabled);
+  Assert.equal(addons[0].name, "Flash");
+  Assert.ok(!addons[0].userDisabled);
+  Assert.equal(addons[1].name, "Java");
+  Assert.ok(!addons[1].userDisabled);
 
-    run_test_2();
-  });
+  run_test_2();
 }
 
 // No change to the list should not trigger any events or changes in the API
-function run_test_2() {
+async function run_test_2() {
   // Reorder the list a bit
   let tag = PLUGINS[0];
   PLUGINS[0] = PLUGINS[2];
   PLUGINS[2] = PLUGINS[1];
   PLUGINS[1] = tag;
 
   Services.obs.notifyObservers(null, LIST_UPDATED_TOPIC);
 
-  AddonManager.getAddonsByTypes(["plugin"], function(addons) {
-    sortAddons(addons);
+  let addons = await AddonManager.getAddonsByTypes(["plugin"]);
+  sortAddons(addons);
 
-    Assert.equal(addons.length, 2);
+  Assert.equal(addons.length, 2);
 
-    Assert.equal(addons[0].name, "Flash");
-    Assert.ok(!addons[0].userDisabled);
-    Assert.equal(addons[1].name, "Java");
-    Assert.ok(!addons[1].userDisabled);
+  Assert.equal(addons[0].name, "Flash");
+  Assert.ok(!addons[0].userDisabled);
+  Assert.equal(addons[1].name, "Java");
+  Assert.ok(!addons[1].userDisabled);
 
-    run_test_3();
-  });
+  run_test_3();
 }
 
 // Tests that a newly detected plugin shows up in the API and sends out events
-function run_test_3() {
+async function run_test_3() {
   let tag = new PluginTag("Quicktime", "A mock Quicktime plugin");
   PLUGINS.push(tag);
   let id = tag.name + tag.description;
 
   let test_params = {};
   test_params[id] = [
     ["onInstalling", false],
     "onInstalled"
@@ -130,87 +128,84 @@ function run_test_3() {
   prepare_test(test_params, [
     "onExternalInstall"
   ]);
 
   Services.obs.notifyObservers(null, LIST_UPDATED_TOPIC);
 
   ensure_test_completed();
 
-  AddonManager.getAddonsByTypes(["plugin"], function(addons) {
-    sortAddons(addons);
+  let addons = await AddonManager.getAddonsByTypes(["plugin"]);
+  sortAddons(addons);
 
-    Assert.equal(addons.length, 3);
+  Assert.equal(addons.length, 3);
 
-    Assert.equal(addons[0].name, "Flash");
-    Assert.ok(!addons[0].userDisabled);
-    Assert.equal(addons[1].name, "Java");
-    Assert.ok(!addons[1].userDisabled);
-    Assert.equal(addons[2].name, "Quicktime");
-    Assert.ok(!addons[2].userDisabled);
+  Assert.equal(addons[0].name, "Flash");
+  Assert.ok(!addons[0].userDisabled);
+  Assert.equal(addons[1].name, "Java");
+  Assert.ok(!addons[1].userDisabled);
+  Assert.equal(addons[2].name, "Quicktime");
+  Assert.ok(!addons[2].userDisabled);
 
-    run_test_4();
-  });
+  run_test_4();
 }
 
 // Tests that a removed plugin disappears from in the API and sends out events
-function run_test_4() {
+async function run_test_4() {
   let tag = PLUGINS.splice(1, 1)[0];
   let id = tag.name + tag.description;
 
   let test_params = {};
   test_params[id] = [
     ["onUninstalling", false],
     "onUninstalled"
   ];
 
   prepare_test(test_params);
 
   Services.obs.notifyObservers(null, LIST_UPDATED_TOPIC);
 
   ensure_test_completed();
 
-  AddonManager.getAddonsByTypes(["plugin"], function(addons) {
-    sortAddons(addons);
+  let addons = await AddonManager.getAddonsByTypes(["plugin"]);
+  sortAddons(addons);
 
-    Assert.equal(addons.length, 2);
+  Assert.equal(addons.length, 2);
 
-    Assert.equal(addons[0].name, "Flash");
-    Assert.ok(!addons[0].userDisabled);
-    Assert.equal(addons[1].name, "Quicktime");
-    Assert.ok(!addons[1].userDisabled);
+  Assert.equal(addons[0].name, "Flash");
+  Assert.ok(!addons[0].userDisabled);
+  Assert.equal(addons[1].name, "Quicktime");
+  Assert.ok(!addons[1].userDisabled);
 
-    run_test_5();
-  });
+  run_test_5();
 }
 
 // Removing part of the flash plugin should have no effect
-function run_test_5() {
+async function run_test_5() {
   PLUGINS.splice(0, 1);
 
   Services.obs.notifyObservers(null, LIST_UPDATED_TOPIC);
 
   ensure_test_completed();
 
-  AddonManager.getAddonsByTypes(["plugin"], function(addons) {
-    sortAddons(addons);
+  let addons = await AddonManager.getAddonsByTypes(["plugin"]);
+  sortAddons(addons);
 
-    Assert.equal(addons.length, 2);
+  Assert.equal(addons.length, 2);
 
-    Assert.equal(addons[0].name, "Flash");
-    Assert.ok(!addons[0].userDisabled);
-    Assert.equal(addons[1].name, "Quicktime");
-    Assert.ok(!addons[1].userDisabled);
+  Assert.equal(addons[0].name, "Flash");
+  Assert.ok(!addons[0].userDisabled);
+  Assert.equal(addons[1].name, "Quicktime");
+  Assert.ok(!addons[1].userDisabled);
 
-    run_test_6();
-  });
+  run_test_6();
 }
 
 // Replacing flash should be detected
-function run_test_6() {
+async function run_test_6() {
   let oldTag = PLUGINS.splice(0, 1)[0];
   let newTag = new PluginTag("Flash 2", "A new crash-free Flash!");
   newTag.disabled = true;
   PLUGINS.push(newTag);
 
   let test_params = {};
   test_params[oldTag.name + oldTag.description] = [
     ["onUninstalling", false],
@@ -224,33 +219,32 @@ function run_test_6() {
   prepare_test(test_params, [
     "onExternalInstall"
   ]);
 
   Services.obs.notifyObservers(null, LIST_UPDATED_TOPIC);
 
   ensure_test_completed();
 
-  AddonManager.getAddonsByTypes(["plugin"], function(addons) {
-    sortAddons(addons);
+  let addons = await AddonManager.getAddonsByTypes(["plugin"]);
+  sortAddons(addons);
 
-    Assert.equal(addons.length, 2);
+  Assert.equal(addons.length, 2);
 
-    Assert.equal(addons[0].name, "Flash 2");
-    Assert.ok(addons[0].userDisabled);
-    Assert.equal(addons[1].name, "Quicktime");
-    Assert.ok(!addons[1].userDisabled);
+  Assert.equal(addons[0].name, "Flash 2");
+  Assert.ok(addons[0].userDisabled);
+  Assert.equal(addons[1].name, "Quicktime");
+  Assert.ok(!addons[1].userDisabled);
 
-    run_test_7();
-  });
+  run_test_7();
 }
 
 // If new tags are detected and the disabled state changes then we should send
 // out appropriate notifications
-function run_test_7() {
+async function run_test_7() {
   PLUGINS[0] = new PluginTag("Quicktime", "A mock Quicktime plugin");
   PLUGINS[0].disabled = true;
   PLUGINS[1] = new PluginTag("Flash 2", "A new crash-free Flash!");
 
   let test_params = {};
   test_params[PLUGINS[0].name + PLUGINS[0].description] = [
     ["onDisabling", false],
     "onDisabled"
@@ -261,21 +255,20 @@ function run_test_7() {
   ];
 
   prepare_test(test_params);
 
   Services.obs.notifyObservers(null, LIST_UPDATED_TOPIC);
 
   ensure_test_completed();
 
-  AddonManager.getAddonsByTypes(["plugin"], function(addons) {
-    sortAddons(addons);
+  let addons = await AddonManager.getAddonsByTypes(["plugin"]);
+  sortAddons(addons);
 
-    Assert.equal(addons.length, 2);
+  Assert.equal(addons.length, 2);
 
-    Assert.equal(addons[0].name, "Flash 2");
-    Assert.ok(!addons[0].userDisabled);
-    Assert.equal(addons[1].name, "Quicktime");
-    Assert.ok(addons[1].userDisabled);
+  Assert.equal(addons[0].name, "Flash 2");
+  Assert.ok(!addons[0].userDisabled);
+  Assert.equal(addons[1].name, "Quicktime");
+  Assert.ok(addons[1].userDisabled);
 
-    end_test();
-  });
+  end_test();
 }
--- a/toolkit/mozapps/extensions/test/xpcshell/test_plugins.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_plugins.js
@@ -89,122 +89,117 @@ function getPluginLastModifiedTime(aPlug
     }
   } catch (e) {
   }
 
   return aPluginFile.lastModifiedTime;
 }
 
 // Tests that the test plugin exists
-function run_test_1() {
+async function run_test_1() {
   var testPlugin = get_test_plugin();
   Assert.notEqual(testPlugin, null);
 
-  AddonManager.getAddonsByTypes(["plugin"], function(addons) {
-    Assert.ok(addons.length > 0);
+  let addons = await AddonManager.getAddonsByTypes(["plugin"]);
+  Assert.ok(addons.length > 0);
 
-    addons.forEach(function(p) {
-      if (p.description == TEST_PLUGIN_DESCRIPTION)
-        gID = p.id;
-    });
+  addons.forEach(function(p) {
+    if (p.description == TEST_PLUGIN_DESCRIPTION)
+      gID = p.id;
+  });
 
-    Assert.notEqual(gID, null);
+  Assert.notEqual(gID, null);
 
-    AddonManager.getAddonByID(gID, function(p) {
-      Assert.notEqual(p, null);
-      Assert.equal(p.name, "Shockwave Flash");
-      Assert.equal(p.description, TEST_PLUGIN_DESCRIPTION);
-      Assert.equal(p.creator, null);
-      Assert.equal(p.version, "1.0.0.0");
-      Assert.equal(p.type, "plugin");
-      Assert.equal(p.userDisabled, "askToActivate");
-      Assert.ok(!p.appDisabled);
-      Assert.ok(p.isActive);
-      Assert.ok(p.isCompatible);
-      Assert.ok(p.providesUpdatesSecurely);
-      Assert.equal(p.blocklistState, 0);
-      Assert.equal(p.permissions, AddonManager.PERM_CAN_DISABLE | AddonManager.PERM_CAN_ENABLE);
-      Assert.equal(p.pendingOperations, 0);
-      Assert.ok(p.size > 0);
-      Assert.equal(p.size, getFileSize(testPlugin));
-      Assert.ok(p.updateDate > 0);
-      Assert.ok("isCompatibleWith" in p);
-      Assert.ok("findUpdates" in p);
+  let p = await AddonManager.getAddonByID(gID);
+  Assert.notEqual(p, null);
+  Assert.equal(p.name, "Shockwave Flash");
+  Assert.equal(p.description, TEST_PLUGIN_DESCRIPTION);
+  Assert.equal(p.creator, null);
+  Assert.equal(p.version, "1.0.0.0");
+  Assert.equal(p.type, "plugin");
+  Assert.equal(p.userDisabled, "askToActivate");
+  Assert.ok(!p.appDisabled);
+  Assert.ok(p.isActive);
+  Assert.ok(p.isCompatible);
+  Assert.ok(p.providesUpdatesSecurely);
+  Assert.equal(p.blocklistState, 0);
+  Assert.equal(p.permissions, AddonManager.PERM_CAN_DISABLE | AddonManager.PERM_CAN_ENABLE);
+  Assert.equal(p.pendingOperations, 0);
+  Assert.ok(p.size > 0);
+  Assert.equal(p.size, getFileSize(testPlugin));
+  Assert.ok(p.updateDate > 0);
+  Assert.ok("isCompatibleWith" in p);
+  Assert.ok("findUpdates" in p);
 
-      let lastModifiedTime = getPluginLastModifiedTime(testPlugin);
-      Assert.equal(p.updateDate.getTime(), lastModifiedTime);
-      Assert.equal(p.installDate.getTime(), lastModifiedTime);
+  let lastModifiedTime = getPluginLastModifiedTime(testPlugin);
+  Assert.equal(p.updateDate.getTime(), lastModifiedTime);
+  Assert.equal(p.installDate.getTime(), lastModifiedTime);
 
-      run_test_2(p);
-    });
-  });
+  run_test_2(p);
 }
 
 // Tests that disabling a plugin works
-function run_test_2(p) {
+async function run_test_2(p) {
   let test = {};
   test[gID] = [
     ["onDisabling", false],
     "onDisabled",
     ["onPropertyChanged", ["userDisabled"]]
   ];
   prepare_test(test);
 
   p.userDisabled = true;
 
   ensure_test_completed();
 
   Assert.ok(p.userDisabled);
   Assert.ok(!p.appDisabled);
   Assert.ok(!p.isActive);
 
-  AddonManager.getAddonByID(gID, function(p2) {
-    Assert.notEqual(p2, null);
-    Assert.ok(p2.userDisabled);
-    Assert.ok(!p2.appDisabled);
-    Assert.ok(!p2.isActive);
-    Assert.equal(p2.name, "Shockwave Flash");
+  let p2 = await AddonManager.getAddonByID(gID);
+  Assert.notEqual(p2, null);
+  Assert.ok(p2.userDisabled);
+  Assert.ok(!p2.appDisabled);
+  Assert.ok(!p2.isActive);
+  Assert.equal(p2.name, "Shockwave Flash");
 
-    run_test_3(p2);
-  });
+  run_test_3(p2);
 }
 
 // Tests that enabling a plugin works
-function run_test_3(p) {
+async function run_test_3(p) {
   let test = {};
   test[gID] = [
     ["onEnabling", false],
     "onEnabled"
   ];
   prepare_test(test);
 
   p.userDisabled = false;
 
   ensure_test_completed();
 
   Assert.ok(!p.userDisabled);
   Assert.ok(!p.appDisabled);
   Assert.ok(p.isActive);
 
-  AddonManager.getAddonByID(gID, function(p2) {
-    Assert.notEqual(p2, null);
-    Assert.ok(!p2.userDisabled);
-    Assert.ok(!p2.appDisabled);
-    Assert.ok(p2.isActive);
-    Assert.equal(p2.name, "Shockwave Flash");
+  let p2 = await AddonManager.getAddonByID(gID);
+  Assert.notEqual(p2, null);
+  Assert.ok(!p2.userDisabled);
+  Assert.ok(!p2.appDisabled);
+  Assert.ok(p2.isActive);
+  Assert.equal(p2.name, "Shockwave Flash");
 
-    executeSoon(run_test_4);
-  });
+  executeSoon(run_test_4);
 }
 
 // Verify that after a restart the test plugin has the same ID
-function run_test_4() {
+async function run_test_4() {
   restartManager();
 
-  AddonManager.getAddonByID(gID, function(p) {
-    Assert.notEqual(p, null);
-    Assert.equal(p.name, "Shockwave Flash");
+  let p = await AddonManager.getAddonByID(gID);
+  Assert.notEqual(p, null);
+  Assert.equal(p.name, "Shockwave Flash");
 
-    Services.prefs.clearUserPref("plugins.click_to_play");
+  Services.prefs.clearUserPref("plugins.click_to_play");
 
-    executeSoon(do_test_finished);
-  });
+  executeSoon(do_test_finished);
 }
--- a/toolkit/mozapps/extensions/test/xpcshell/test_safemode.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_safemode.js
@@ -22,95 +22,91 @@ var addon1 = {
 };
 
 const profileDir = gProfD.clone();
 profileDir.append("extensions");
 
 var gIconURL = null;
 
 // Sets up the profile by installing an add-on.
-function run_test() {
+async function run_test() {
   do_test_pending();
   createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1.9.2");
   gAppInfo.inSafeMode = true;
 
   startupManager();
 
-  AddonManager.getAddonByID("addon1@tests.mozilla.org", callback_soon(async function(a1) {
-    Assert.equal(a1, null);
-    do_check_not_in_crash_annotation(addon1.id, addon1.version);
+  let a1 = await AddonManager.getAddonByID("addon1@tests.mozilla.org");
+  Assert.equal(a1, null);
+  do_check_not_in_crash_annotation(addon1.id, addon1.version);
 
-    writeInstallRDFForExtension(addon1, profileDir, addon1.id, "icon.png");
-    gIconURL = do_get_addon_root_uri(profileDir.clone(), addon1.id) + "icon.png";
+  writeInstallRDFForExtension(addon1, profileDir, addon1.id, "icon.png");
+  gIconURL = do_get_addon_root_uri(profileDir.clone(), addon1.id) + "icon.png";
 
-    await promiseRestartManager();
+  await promiseRestartManager();
 
-    AddonManager.getAddonByID("addon1@tests.mozilla.org", function(newa1) {
-      Assert.notEqual(newa1, null);
-      Assert.ok(!newa1.isActive);
-      Assert.ok(!newa1.userDisabled);
-      Assert.equal(newa1.aboutURL, null);
-      Assert.equal(newa1.optionsURL, null);
-      Assert.equal(newa1.iconURL, gIconURL);
-      Assert.ok(isExtensionInBootstrappedList(profileDir, newa1.id));
-      Assert.ok(hasFlag(newa1.permissions, AddonManager.PERM_CAN_DISABLE));
-      Assert.ok(!hasFlag(newa1.permissions, AddonManager.PERM_CAN_ENABLE));
-      Assert.equal(newa1.operationsRequiringRestart, AddonManager.OP_NEEDS_RESTART_NONE);
-      do_check_not_in_crash_annotation(addon1.id, addon1.version);
+  let newa1 = await AddonManager.getAddonByID("addon1@tests.mozilla.org");
+  Assert.notEqual(newa1, null);
+  Assert.ok(!newa1.isActive);
+  Assert.ok(!newa1.userDisabled);
+  Assert.equal(newa1.aboutURL, null);
+  Assert.equal(newa1.optionsURL, null);
+  Assert.equal(newa1.iconURL, gIconURL);
+  Assert.ok(isExtensionInBootstrappedList(profileDir, newa1.id));
+  Assert.ok(hasFlag(newa1.permissions, AddonManager.PERM_CAN_DISABLE));
+  Assert.ok(!hasFlag(newa1.permissions, AddonManager.PERM_CAN_ENABLE));
+  Assert.equal(newa1.operationsRequiringRestart, AddonManager.OP_NEEDS_RESTART_NONE);
+  do_check_not_in_crash_annotation(addon1.id, addon1.version);
 
-      run_test_1();
-    });
-  }));
+  run_test_1();
 }
 
 // Disabling an add-on should work
-function run_test_1() {
+async function run_test_1() {
   prepare_test({
     "addon1@tests.mozilla.org": [
       ["onDisabling", false],
       "onDisabled"
     ]
   });
 
-  AddonManager.getAddonByID("addon1@tests.mozilla.org", function(a1) {
-    Assert.ok(!hasFlag(a1.operationsRequiringRestart,
-                       AddonManager.OP_NEEDS_RESTART_DISABLE));
-    a1.userDisabled = true;
-    Assert.ok(!a1.isActive);
-    Assert.equal(a1.aboutURL, null);
-    Assert.equal(a1.optionsURL, null);
-    Assert.equal(a1.iconURL, gIconURL);
-    Assert.ok(!hasFlag(a1.permissions, AddonManager.PERM_CAN_DISABLE));
-    Assert.ok(hasFlag(a1.permissions, AddonManager.PERM_CAN_ENABLE));
-    Assert.equal(a1.operationsRequiringRestart, AddonManager.OP_NEEDS_RESTART_NONE);
-    do_check_not_in_crash_annotation(addon1.id, addon1.version);
+  let a1 = await AddonManager.getAddonByID("addon1@tests.mozilla.org");
+  Assert.ok(!hasFlag(a1.operationsRequiringRestart,
+                     AddonManager.OP_NEEDS_RESTART_DISABLE));
+  a1.userDisabled = true;
+  Assert.ok(!a1.isActive);
+  Assert.equal(a1.aboutURL, null);
+  Assert.equal(a1.optionsURL, null);
+  Assert.equal(a1.iconURL, gIconURL);
+  Assert.ok(!hasFlag(a1.permissions, AddonManager.PERM_CAN_DISABLE));
+  Assert.ok(hasFlag(a1.permissions, AddonManager.PERM_CAN_ENABLE));
+  Assert.equal(a1.operationsRequiringRestart, AddonManager.OP_NEEDS_RESTART_NONE);
+  do_check_not_in_crash_annotation(addon1.id, addon1.version);
 
-    ensure_test_completed();
+  ensure_test_completed();
 
-    run_test_2();
-  });
+  run_test_2();
 }
 
 // Enabling an add-on should happen without restart but not become active.
-function run_test_2() {
+async function run_test_2() {
   prepare_test({
     "addon1@tests.mozilla.org": [
       ["onEnabling", false],
       "onEnabled"
     ]
   });
 
-  AddonManager.getAddonByID("addon1@tests.mozilla.org", function(a1) {
-    a1.userDisabled = false;
-    Assert.ok(!a1.isActive);
-    Assert.equal(a1.aboutURL, null);
-    Assert.equal(a1.optionsURL, null);
-    Assert.equal(a1.iconURL, gIconURL);
-    Assert.ok(hasFlag(a1.permissions, AddonManager.PERM_CAN_DISABLE));
-    Assert.ok(!hasFlag(a1.permissions, AddonManager.PERM_CAN_ENABLE));
-    Assert.equal(a1.operationsRequiringRestart, AddonManager.OP_NEEDS_RESTART_NONE);
-    do_check_not_in_crash_annotation(addon1.id, addon1.version);
+  let a1 = await AddonManager.getAddonByID("addon1@tests.mozilla.org");
+  a1.userDisabled = false;
+  Assert.ok(!a1.isActive);
+  Assert.equal(a1.aboutURL, null);
+  Assert.equal(a1.optionsURL, null);
+  Assert.equal(a1.iconURL, gIconURL);
+  Assert.ok(hasFlag(a1.permissions, AddonManager.PERM_CAN_DISABLE));
+  Assert.ok(!hasFlag(a1.permissions, AddonManager.PERM_CAN_ENABLE));
+  Assert.equal(a1.operationsRequiringRestart, AddonManager.OP_NEEDS_RESTART_NONE);
+  do_check_not_in_crash_annotation(addon1.id, addon1.version);
 
-    ensure_test_completed();
+  ensure_test_completed();
 
-    executeSoon(do_test_finished);
-  });
+  executeSoon(do_test_finished);
 }
--- a/toolkit/mozapps/extensions/test/xpcshell/test_sourceURI.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_sourceURI.js
@@ -30,17 +30,17 @@ function backgroundUpdate(aCallback) {
   Services.obs.addObserver(function observer() {
     Services.obs.removeObserver(observer, "addons-background-update-complete");
     aCallback();
   }, "addons-background-update-complete");
 
   AddonManagerPrivate.backgroundUpdateCheck();
 }
 
-function run_test() {
+async function run_test() {
   do_test_pending();
 
   const GETADDONS_RESPONSE = {
     page_size: 25,
     next: null,
     previous: null,
     results: [
       {
@@ -76,25 +76,23 @@ function run_test() {
   Services.prefs.setCharPref(PREF_GETADDONS_BYIDS, `${BASE_URL}/addons.json`);
   Services.prefs.setCharPref(PREF_COMPAT_OVERRIDES, `${BASE_URL}/compat.json`);
   Services.prefs.setBoolPref(PREF_GETADDONS_CACHE_ENABLED, true);
 
   createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1");
   writeInstallRDFForExtension(addon, profileDir);
   startupManager();
 
-  AddonManager.getAddonByID("addon@tests.mozilla.org", function(a) {
-    Assert.notEqual(a, null);
-    Assert.equal(a.sourceURI, null);
+  let a = await AddonManager.getAddonByID("addon@tests.mozilla.org");
+  Assert.notEqual(a, null);
+  Assert.equal(a.sourceURI, null);
 
-    backgroundUpdate(function() {
-      restartManager();
+  backgroundUpdate(async function() {
+    restartManager();
 
-      AddonManager.getAddonByID("addon@tests.mozilla.org", function(a2) {
-        Assert.notEqual(a2, null);
-        Assert.notEqual(a2.sourceURI, null);
-        Assert.equal(a2.sourceURI.spec, "http://www.example.com/testaddon.xpi");
+    let a2 = await AddonManager.getAddonByID("addon@tests.mozilla.org");
+    Assert.notEqual(a2, null);
+    Assert.notEqual(a2.sourceURI, null);
+    Assert.equal(a2.sourceURI.spec, "http://www.example.com/testaddon.xpi");
 
-        do_test_finished();
-      });
-    });
+    do_test_finished();
   });
 }
--- a/toolkit/mozapps/extensions/test/xpcshell/test_startup.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_startup.js
@@ -118,17 +118,17 @@ userDir.append(gAppInfo.ID);
 registerDirectory("XREUSysExt", userDir.parent);
 
 const profileDir = gProfD.clone();
 profileDir.append("extensions");
 
 var gCachePurged = false;
 
 // Set up the profile
-function run_test() {
+async function run_test() {
   do_test_pending("test_startup main");
 
   Services.obs.addObserver({
     observe(aSubject, aTopic, aData) {
       gCachePurged = true;
     }
   }, "startupcache-invalidate");
 
@@ -138,36 +138,31 @@ function run_test() {
   check_startup_changes(AddonManager.STARTUP_CHANGE_UNINSTALLED, []);
   check_startup_changes(AddonManager.STARTUP_CHANGE_DISABLED, []);
   check_startup_changes(AddonManager.STARTUP_CHANGE_ENABLED, []);
 
   Assert.ok(!gExtensionsJSON.exists());
 
   Assert.ok(!gAddonStartup.exists());
 
-  AddonManager.getAddonsByIDs(["addon1@tests.mozilla.org",
-                               "addon2@tests.mozilla.org",
-                               "addon3@tests.mozilla.org",
-                               "addon4@tests.mozilla.org",
-                               "addon5@tests.mozilla.org",
-                               "addon6@tests.mozilla.org",
-                               "addon7@tests.mozilla.org"],
-                               function([a1, a2, a3, a4, a5, a6, a7]) {
+  let [a1, a2, a3, a4, a5] = await AddonManager.getAddonsByIDs(["addon1@tests.mozilla.org",
+                                                                "addon2@tests.mozilla.org",
+                                                                "addon3@tests.mozilla.org",
+                                                                "addon4@tests.mozilla.org",
+                                                                "addon5@tests.mozilla.org"]);
+  Assert.equal(a1, null);
+  do_check_not_in_crash_annotation(addon1.id, addon1.version);
+  Assert.equal(a2, null);
+  do_check_not_in_crash_annotation(addon2.id, addon2.version);
+  Assert.equal(a3, null);
+  do_check_not_in_crash_annotation(addon3.id, addon3.version);
+  Assert.equal(a4, null);
+  Assert.equal(a5, null);
 
-    Assert.equal(a1, null);
-    do_check_not_in_crash_annotation(addon1.id, addon1.version);
-    Assert.equal(a2, null);
-    do_check_not_in_crash_annotation(addon2.id, addon2.version);
-    Assert.equal(a3, null);
-    do_check_not_in_crash_annotation(addon3.id, addon3.version);
-    Assert.equal(a4, null);
-    Assert.equal(a5, null);
-
-    executeSoon(run_test_1);
-  });
+  executeSoon(run_test_1);
 }
 
 function end_test() {
   do_test_finished("test_startup main");
 }
 
 // Try to install all the items into the profile
 async function run_test_1() {
@@ -192,103 +187,99 @@ async function run_test_1() {
   check_startup_changes(AddonManager.STARTUP_CHANGE_UNINSTALLED, []);
   check_startup_changes(AddonManager.STARTUP_CHANGE_DISABLED, []);
   check_startup_changes(AddonManager.STARTUP_CHANGE_ENABLED, []);
   Assert.ok(gCachePurged);
 
   info("Checking for " + gAddonStartup.path);
   Assert.ok(gAddonStartup.exists());
 
-  AddonManager.getAddonsByIDs(["addon1@tests.mozilla.org",
-                               "addon2@tests.mozilla.org",
-                               "addon3@tests.mozilla.org",
-                               "addon4@tests.mozilla.org",
-                               "addon5@tests.mozilla.org",
-                               "addon6@tests.mozilla.org",
-                               "addon7@tests.mozilla.org"],
-                               function([a1, a2, a3, a4, a5, a6, a7]) {
+  let [a1, a2, a3, a4, a5, a6, a7] = await AddonManager.getAddonsByIDs(["addon1@tests.mozilla.org",
+                                                                        "addon2@tests.mozilla.org",
+                                                                        "addon3@tests.mozilla.org",
+                                                                        "addon4@tests.mozilla.org",
+                                                                        "addon5@tests.mozilla.org",
+                                                                        "addon6@tests.mozilla.org",
+                                                                        "addon7@tests.mozilla.org"]);
+  Assert.notEqual(a1, null);
+  Assert.equal(a1.id, "addon1@tests.mozilla.org");
+  Assert.notEqual(a1.syncGUID, null);
+  Assert.ok(a1.syncGUID.length >= 9);
+  Assert.equal(a1.version, "1.0");
+  Assert.equal(a1.name, "Test 1");
+  Assert.ok(isExtensionInBootstrappedList(profileDir, a1.id));
+  Assert.ok(hasFlag(a1.permissions, AddonManager.PERM_CAN_UNINSTALL));
+  Assert.ok(hasFlag(a1.permissions, AddonManager.PERM_CAN_UPGRADE));
+  do_check_in_crash_annotation(addon1.id, addon1.version);
+  Assert.equal(a1.scope, AddonManager.SCOPE_PROFILE);
+  Assert.equal(a1.sourceURI, null);
+  Assert.ok(a1.foreignInstall);
+  Assert.ok(!a1.userDisabled);
+  Assert.ok(a1.seen);
 
-    Assert.notEqual(a1, null);
-    Assert.equal(a1.id, "addon1@tests.mozilla.org");
-    Assert.notEqual(a1.syncGUID, null);
-    Assert.ok(a1.syncGUID.length >= 9);
-    Assert.equal(a1.version, "1.0");
-    Assert.equal(a1.name, "Test 1");
-    Assert.ok(isExtensionInBootstrappedList(profileDir, a1.id));
-    Assert.ok(hasFlag(a1.permissions, AddonManager.PERM_CAN_UNINSTALL));
-    Assert.ok(hasFlag(a1.permissions, AddonManager.PERM_CAN_UPGRADE));
-    do_check_in_crash_annotation(addon1.id, addon1.version);
-    Assert.equal(a1.scope, AddonManager.SCOPE_PROFILE);
-    Assert.equal(a1.sourceURI, null);
-    Assert.ok(a1.foreignInstall);
-    Assert.ok(!a1.userDisabled);
-    Assert.ok(a1.seen);
-
-    Assert.notEqual(a2, null);
-    Assert.equal(a2.id, "addon2@tests.mozilla.org");
-    Assert.notEqual(a2.syncGUID, null);
-    Assert.ok(a2.syncGUID.length >= 9);
-    Assert.equal(a2.version, "2.0");
-    Assert.equal(a2.name, "Test 2");
-    Assert.ok(isExtensionInBootstrappedList(profileDir, a2.id));
-    Assert.ok(hasFlag(a2.permissions, AddonManager.PERM_CAN_UNINSTALL));
-    Assert.ok(hasFlag(a2.permissions, AddonManager.PERM_CAN_UPGRADE));
-    do_check_in_crash_annotation(addon2.id, addon2.version);
-    Assert.equal(a2.scope, AddonManager.SCOPE_PROFILE);
-    Assert.equal(a2.sourceURI, null);
-    Assert.ok(a2.foreignInstall);
-    Assert.ok(!a1.userDisabled);
-    Assert.ok(a1.seen);
+  Assert.notEqual(a2, null);
+  Assert.equal(a2.id, "addon2@tests.mozilla.org");
+  Assert.notEqual(a2.syncGUID, null);
+  Assert.ok(a2.syncGUID.length >= 9);
+  Assert.equal(a2.version, "2.0");
+  Assert.equal(a2.name, "Test 2");
+  Assert.ok(isExtensionInBootstrappedList(profileDir, a2.id));
+  Assert.ok(hasFlag(a2.permissions, AddonManager.PERM_CAN_UNINSTALL));
+  Assert.ok(hasFlag(a2.permissions, AddonManager.PERM_CAN_UPGRADE));
+  do_check_in_crash_annotation(addon2.id, addon2.version);
+  Assert.equal(a2.scope, AddonManager.SCOPE_PROFILE);
+  Assert.equal(a2.sourceURI, null);
+  Assert.ok(a2.foreignInstall);
+  Assert.ok(!a1.userDisabled);
+  Assert.ok(a1.seen);
 
-    Assert.notEqual(a3, null);
-    Assert.equal(a3.id, "addon3@tests.mozilla.org");
-    Assert.notEqual(a3.syncGUID, null);
-    Assert.ok(a3.syncGUID.length >= 9);
-    Assert.equal(a3.version, "3.0");
-    Assert.equal(a3.name, "Test 3");
-    Assert.ok(isExtensionInBootstrappedList(profileDir, a3.id));
-    Assert.ok(hasFlag(a3.permissions, AddonManager.PERM_CAN_UNINSTALL));
-    Assert.ok(hasFlag(a3.permissions, AddonManager.PERM_CAN_UPGRADE));
-    do_check_in_crash_annotation(addon3.id, addon3.version);
-    Assert.equal(a3.scope, AddonManager.SCOPE_PROFILE);
-    Assert.equal(a3.sourceURI, null);
-    Assert.ok(a3.foreignInstall);
-    Assert.ok(!a1.userDisabled);
-    Assert.ok(a1.seen);
+  Assert.notEqual(a3, null);
+  Assert.equal(a3.id, "addon3@tests.mozilla.org");
+  Assert.notEqual(a3.syncGUID, null);
+  Assert.ok(a3.syncGUID.length >= 9);
+  Assert.equal(a3.version, "3.0");
+  Assert.equal(a3.name, "Test 3");
+  Assert.ok(isExtensionInBootstrappedList(profileDir, a3.id));
+  Assert.ok(hasFlag(a3.permissions, AddonManager.PERM_CAN_UNINSTALL));
+  Assert.ok(hasFlag(a3.permissions, AddonManager.PERM_CAN_UPGRADE));
+  do_check_in_crash_annotation(addon3.id, addon3.version);
+  Assert.equal(a3.scope, AddonManager.SCOPE_PROFILE);
+  Assert.equal(a3.sourceURI, null);
+  Assert.ok(a3.foreignInstall);
+  Assert.ok(!a1.userDisabled);
+  Assert.ok(a1.seen);
 
-    Assert.equal(a4, null);
-    Assert.ok(!isExtensionInBootstrappedList(profileDir, "addon4@tests.mozilla.org"));
-    dest = profileDir.clone();
-    dest.append(do_get_expected_addon_name("addon4@tests.mozilla.org"));
-    Assert.ok(!dest.exists());
+  Assert.equal(a4, null);
+  Assert.ok(!isExtensionInBootstrappedList(profileDir, "addon4@tests.mozilla.org"));
+  dest = profileDir.clone();
+  dest.append(do_get_expected_addon_name("addon4@tests.mozilla.org"));
+  Assert.ok(!dest.exists());
 
-    Assert.equal(a5, null);
-    Assert.ok(!isExtensionInBootstrappedList(profileDir, "addon5@tests.mozilla.org"));
-    dest = profileDir.clone();
-    dest.append(do_get_expected_addon_name("addon5@tests.mozilla.org"));
-    Assert.ok(!dest.exists());
-
-    Assert.equal(a6, null);
-    Assert.ok(!isExtensionInBootstrappedList(profileDir, "addon6@tests.mozilla.org"));
-    dest = profileDir.clone();
-    dest.append(do_get_expected_addon_name("addon6@tests.mozilla.org"));
-    Assert.ok(!dest.exists());
+  Assert.equal(a5, null);
+  Assert.ok(!isExtensionInBootstrappedList(profileDir, "addon5@tests.mozilla.org"));
+  dest = profileDir.clone();
+  dest.append(do_get_expected_addon_name("addon5@tests.mozilla.org"));
+  Assert.ok(!dest.exists());
 
-    Assert.equal(a7, null);
-    Assert.ok(!isExtensionInBootstrappedList(profileDir, "addon7@tests.mozilla.org"));
-    dest = profileDir.clone();
-    dest.append(do_get_expected_addon_name("addon7@tests.mozilla.org"));
-    Assert.ok(!dest.exists());
+  Assert.equal(a6, null);
+  Assert.ok(!isExtensionInBootstrappedList(profileDir, "addon6@tests.mozilla.org"));
+  dest = profileDir.clone();
+  dest.append(do_get_expected_addon_name("addon6@tests.mozilla.org"));
+  Assert.ok(!dest.exists());
 
-    AddonManager.getAddonsByTypes(["extension"], function(extensionAddons) {
-      Assert.equal(extensionAddons.length, 3);
+  Assert.equal(a7, null);
+  Assert.ok(!isExtensionInBootstrappedList(profileDir, "addon7@tests.mozilla.org"));
+  dest = profileDir.clone();
+  dest.append(do_get_expected_addon_name("addon7@tests.mozilla.org"));
+  Assert.ok(!dest.exists());
 
-      executeSoon(run_test_2);
-    });
-  });
+  let extensionAddons = await AddonManager.getAddonsByTypes(["extension"]);
+  Assert.equal(extensionAddons.length, 3);
+
+  executeSoon(run_test_2);
 }
 
 // Test that modified items are detected and items in other install locations
 // are ignored
 async function run_test_2() {
   await promiseShutdownManager();
 
   addon1.version = "1.1";
@@ -310,58 +301,55 @@ async function run_test_2() {
   check_startup_changes(AddonManager.STARTUP_CHANGE_CHANGED, ["addon2@tests.mozilla.org"]);
   check_startup_changes(AddonManager.STARTUP_CHANGE_UNINSTALLED, ["addon3@tests.mozilla.org"]);
   check_startup_changes(AddonManager.STARTUP_CHANGE_DISABLED, []);
   check_startup_changes(AddonManager.STARTUP_CHANGE_ENABLED, []);
   Assert.ok(gCachePurged);
 
   Assert.ok(gAddonStartup.exists());
 
-  AddonManager.getAddonsByIDs(["addon1@tests.mozilla.org",
-                               "addon2@tests.mozilla.org",
-                               "addon3@tests.mozilla.org",
-                               "addon4@tests.mozilla.org",
-                               "addon5@tests.mozilla.org"],
-                               function([a1, a2, a3, a4, a5]) {
-
-    Assert.notEqual(a1, null);
-    Assert.equal(a1.id, "addon1@tests.mozilla.org");
-    Assert.equal(a1.version, "1.0");
-    Assert.ok(isExtensionInBootstrappedList(profileDir, a1.id));
-    Assert.ok(!isExtensionInBootstrappedList(userDir, a1.id));
-    Assert.ok(hasFlag(a1.permissions, AddonManager.PERM_CAN_UNINSTALL));
-    Assert.ok(hasFlag(a1.permissions, AddonManager.PERM_CAN_UPGRADE));
-    do_check_in_crash_annotation(addon1.id, a1.version);
-    Assert.equal(a1.scope, AddonManager.SCOPE_PROFILE);
-    Assert.ok(a1.foreignInstall);
+  let [a1, a2, a3, a4, a5] = await AddonManager.getAddonsByIDs(["addon1@tests.mozilla.org",
+                                                                "addon2@tests.mozilla.org",
+                                                                "addon3@tests.mozilla.org",
+                                                                "addon4@tests.mozilla.org",
+                                                                "addon5@tests.mozilla.org"]);
+  Assert.notEqual(a1, null);
+  Assert.equal(a1.id, "addon1@tests.mozilla.org");
+  Assert.equal(a1.version, "1.0");
+  Assert.ok(isExtensionInBootstrappedList(profileDir, a1.id));
+  Assert.ok(!isExtensionInBootstrappedList(userDir, a1.id));
+  Assert.ok(hasFlag(a1.permissions, AddonManager.PERM_CAN_UNINSTALL));
+  Assert.ok(hasFlag(a1.permissions, AddonManager.PERM_CAN_UPGRADE));
+  do_check_in_crash_annotation(addon1.id, a1.version);
+  Assert.equal(a1.scope, AddonManager.SCOPE_PROFILE);
+  Assert.ok(a1.foreignInstall);
 
-    Assert.notEqual(a2, null);
-    Assert.equal(a2.id, "addon2@tests.mozilla.org");
-    Assert.equal(a2.version, "2.1");
-    Assert.ok(isExtensionInBootstrappedList(profileDir, a2.id));
-    Assert.ok(!isExtensionInBootstrappedList(userDir, a2.id));
-    Assert.ok(!isExtensionInBootstrappedList(globalDir, a2.id));
-    Assert.ok(hasFlag(a2.permissions, AddonManager.PERM_CAN_UNINSTALL));
-    Assert.ok(hasFlag(a2.permissions, AddonManager.PERM_CAN_UPGRADE));
-    do_check_in_crash_annotation(addon2.id, a2.version);
-    Assert.equal(a2.scope, AddonManager.SCOPE_PROFILE);
-    Assert.ok(a2.foreignInstall);
+  Assert.notEqual(a2, null);
+  Assert.equal(a2.id, "addon2@tests.mozilla.org");
+  Assert.equal(a2.version, "2.1");
+  Assert.ok(isExtensionInBootstrappedList(profileDir, a2.id));
+  Assert.ok(!isExtensionInBootstrappedList(userDir, a2.id));
+  Assert.ok(!isExtensionInBootstrappedList(globalDir, a2.id));
+  Assert.ok(hasFlag(a2.permissions, AddonManager.PERM_CAN_UNINSTALL));
+  Assert.ok(hasFlag(a2.permissions, AddonManager.PERM_CAN_UPGRADE));
+  do_check_in_crash_annotation(addon2.id, a2.version);
+  Assert.equal(a2.scope, AddonManager.SCOPE_PROFILE);
+  Assert.ok(a2.foreignInstall);
 
-    Assert.equal(a3, null);
-    Assert.ok(!isExtensionInBootstrappedList(profileDir, "addon3@tests.mozilla.org"));
-    do_check_not_in_crash_annotation(addon3.id, addon3.version);
+  Assert.equal(a3, null);
+  Assert.ok(!isExtensionInBootstrappedList(profileDir, "addon3@tests.mozilla.org"));
+  do_check_not_in_crash_annotation(addon3.id, addon3.version);
 
-    Assert.equal(a4, null);
-    Assert.ok(!isExtensionInBootstrappedList(profileDir, "addon4@tests.mozilla.org"));
+  Assert.equal(a4, null);
+  Assert.ok(!isExtensionInBootstrappedList(profileDir, "addon4@tests.mozilla.org"));
 
-    Assert.equal(a5, null);
-    Assert.ok(!isExtensionInBootstrappedList(profileDir, "addon5@tests.mozilla.org"));
+  Assert.equal(a5, null);
+  Assert.ok(!isExtensionInBootstrappedList(profileDir, "addon5@tests.mozilla.org"));
 
-    executeSoon(run_test_3);
-  });
+  executeSoon(run_test_3);
 }
 
 // Check that removing items from the profile reveals their hidden versions.
 async function run_test_3() {
   await promiseShutdownManager();
 
   var dest = profileDir.clone();
   dest.append(do_get_expected_addon_name("addon1@tests.mozilla.org"));
@@ -377,191 +365,170 @@ async function run_test_3() {
   check_startup_changes(AddonManager.STARTUP_CHANGE_INSTALLED, []);
   check_startup_changes(AddonManager.STARTUP_CHANGE_CHANGED, ["addon1@tests.mozilla.org",
                                     "addon2@tests.mozilla.org"]);
   check_startup_changes(AddonManager.STARTUP_CHANGE_UNINSTALLED, []);
   check_startup_changes(AddonManager.STARTUP_CHANGE_DISABLED, []);
   check_startup_changes(AddonManager.STARTUP_CHANGE_ENABLED, []);
   Assert.ok(gCachePurged);
 
-  AddonManager.getAddonsByIDs(["addon1@tests.mozilla.org",
-                               "addon2@tests.mozilla.org",
-                               "addon3@tests.mozilla.org",
-                               "addon4@tests.mozilla.org",
-                               "addon5@tests.mozilla.org"],
-                               function([a1, a2, a3, a4, a5]) {
-
-    Assert.notEqual(a1, null);
-    Assert.equal(a1.id, "addon1@tests.mozilla.org");
-    Assert.equal(a1.version, "1.1");
-    Assert.ok(!isExtensionInBootstrappedList(profileDir, a1.id));
-    Assert.ok(isExtensionInBootstrappedList(userDir, a1.id));
-    Assert.ok(!hasFlag(a1.permissions, AddonManager.PERM_CAN_UNINSTALL));
-    Assert.ok(!hasFlag(a1.permissions, AddonManager.PERM_CAN_UPGRADE));
-    do_check_in_crash_annotation(addon1.id, a1.version);
-    Assert.equal(a1.scope, AddonManager.SCOPE_USER);
+  let [a1, a2, a3, a4, a5] = await AddonManager.getAddonsByIDs(["addon1@tests.mozilla.org",
+                                                                "addon2@tests.mozilla.org",
+                                                                "addon3@tests.mozilla.org",
+                                                                "addon4@tests.mozilla.org",
+                                                                "addon5@tests.mozilla.org"]);
+  Assert.notEqual(a1, null);
+  Assert.equal(a1.id, "addon1@tests.mozilla.org");
+  Assert.equal(a1.version, "1.1");
+  Assert.ok(!isExtensionInBootstrappedList(profileDir, a1.id));
+  Assert.ok(isExtensionInBootstrappedList(userDir, a1.id));
+  Assert.ok(!hasFlag(a1.permissions, AddonManager.PERM_CAN_UNINSTALL));
+  Assert.ok(!hasFlag(a1.permissions, AddonManager.PERM_CAN_UPGRADE));
+  do_check_in_crash_annotation(addon1.id, a1.version);
+  Assert.equal(a1.scope, AddonManager.SCOPE_USER);
 
-    Assert.notEqual(a2, null);
-    Assert.equal(a2.id, "addon2@tests.mozilla.org");
-    Assert.equal(a2.version, "2.3");
-    Assert.ok(!isExtensionInBootstrappedList(profileDir, a2.id));
-    Assert.ok(isExtensionInBootstrappedList(userDir, a2.id));
-    Assert.ok(!isExtensionInBootstrappedList(globalDir, a2.id));
-    Assert.ok(!hasFlag(a2.permissions, AddonManager.PERM_CAN_UNINSTALL));
-    Assert.ok(!hasFlag(a2.permissions, AddonManager.PERM_CAN_UPGRADE));
-    do_check_in_crash_annotation(addon2.id, a2.version);
-    Assert.equal(a2.scope, AddonManager.SCOPE_USER);
+  Assert.notEqual(a2, null);
+  Assert.equal(a2.id, "addon2@tests.mozilla.org");
+  Assert.equal(a2.version, "2.3");
+  Assert.ok(!isExtensionInBootstrappedList(profileDir, a2.id));
+  Assert.ok(isExtensionInBootstrappedList(userDir, a2.id));
+  Assert.ok(!isExtensionInBootstrappedList(globalDir, a2.id));
+  Assert.ok(!hasFlag(a2.permissions, AddonManager.PERM_CAN_UNINSTALL));
+  Assert.ok(!hasFlag(a2.permissions, AddonManager.PERM_CAN_UPGRADE));
+  do_check_in_crash_annotation(addon2.id, a2.version);
+  Assert.equal(a2.scope, AddonManager.SCOPE_USER);
 
-    Assert.equal(a3, null);
-    Assert.ok(!isExtensionInBootstrappedList(profileDir, "addon3@tests.mozilla.org"));
+  Assert.equal(a3, null);
+  Assert.ok(!isExtensionInBootstrappedList(profileDir, "addon3@tests.mozilla.org"));
 
-    Assert.equal(a4, null);
-    Assert.ok(!isExtensionInBootstrappedList(profileDir, "addon4@tests.mozilla.org"));
+  Assert.equal(a4, null);
+  Assert.ok(!isExtensionInBootstrappedList(profileDir, "addon4@tests.mozilla.org"));
 
-    Assert.equal(a5, null);
-    Assert.ok(!isExtensionInBootstrappedList(profileDir, "addon5@tests.mozilla.org"));
+  Assert.equal(a5, null);
+  Assert.ok(!isExtensionInBootstrappedList(profileDir, "addon5@tests.mozilla.org"));
 
-    dest = profileDir.clone();
-    dest.append(do_get_expected_addon_name("addon4@tests.mozilla.org"));
-    Assert.ok(!dest.exists());
+  dest = profileDir.clone();
+  dest.append(do_get_expected_addon_name("addon4@tests.mozilla.org"));
+  Assert.ok(!dest.exists());
 
-    executeSoon(run_test_4);
-  });
+  executeSoon(run_test_4);
 }
 
 // Test that disabling an install location works
 async function run_test_4() {
   Services.prefs.setIntPref("extensions.enabledScopes", AddonManager.SCOPE_SYSTEM);
 
   gCachePurged = false;
   await promiseRestartManager();
 
   check_startup_changes(AddonManager.STARTUP_CHANGE_INSTALLED, []);
   check_startup_changes(AddonManager.STARTUP_CHANGE_CHANGED, ["addon2@tests.mozilla.org"]);
   check_startup_changes(AddonManager.STARTUP_CHANGE_UNINSTALLED, ["addon1@tests.mozilla.org"]);
   check_startup_changes(AddonManager.STARTUP_CHANGE_DISABLED, []);
   check_startup_changes(AddonManager.STARTUP_CHANGE_ENABLED, []);
   Assert.ok(gCachePurged);
 
-  AddonManager.getAddonsByIDs(["addon1@tests.mozilla.org",
-                               "addon2@tests.mozilla.org",
-                               "addon3@tests.mozilla.org",
-                               "addon4@tests.mozilla.org",
-                               "addon5@tests.mozilla.org"],
-                               function([a1, a2, a3, a4, a5]) {
-
-    Assert.equal(a1, null);
-    Assert.ok(!isExtensionInBootstrappedList(profileDir, "addon1@tests.mozilla.org"));
-    Assert.ok(!isExtensionInBootstrappedList(userDir, "addon1@tests.mozilla.org"));
+  let [a1, a2] = await AddonManager.getAddonsByIDs(["addon1@tests.mozilla.org",
+                                                    "addon2@tests.mozilla.org"]);
+  Assert.equal(a1, null);
+  Assert.ok(!isExtensionInBootstrappedList(profileDir, "addon1@tests.mozilla.org"));
+  Assert.ok(!isExtensionInBootstrappedList(userDir, "addon1@tests.mozilla.org"));
 
-    Assert.notEqual(a2, null);
-    Assert.equal(a2.id, "addon2@tests.mozilla.org");
-    Assert.equal(a2.version, "2.2");
-    Assert.ok(!isExtensionInBootstrappedList(profileDir, a2.id));
-    Assert.ok(!isExtensionInBootstrappedList(userDir, a2.id));
-    Assert.ok(isExtensionInBootstrappedList(globalDir, a2.id));
-    Assert.ok(!hasFlag(a2.permissions, AddonManager.PERM_CAN_UNINSTALL));
-    Assert.ok(!hasFlag(a2.permissions, AddonManager.PERM_CAN_UPGRADE));
-    do_check_in_crash_annotation(addon2.id, a2.version);
-    Assert.equal(a2.scope, AddonManager.SCOPE_SYSTEM);
+  Assert.notEqual(a2, null);
+  Assert.equal(a2.id, "addon2@tests.mozilla.org");
+  Assert.equal(a2.version, "2.2");
+  Assert.ok(!isExtensionInBootstrappedList(profileDir, a2.id));
+  Assert.ok(!isExtensionInBootstrappedList(userDir, a2.id));
+  Assert.ok(isExtensionInBootstrappedList(globalDir, a2.id));
+  Assert.ok(!hasFlag(a2.permissions, AddonManager.PERM_CAN_UNINSTALL));
+  Assert.ok(!hasFlag(a2.permissions, AddonManager.PERM_CAN_UPGRADE));
+  do_check_in_crash_annotation(addon2.id, a2.version);
+  Assert.equal(a2.scope, AddonManager.SCOPE_SYSTEM);
 
-    executeSoon(run_test_5);
-  });
+  executeSoon(run_test_5);
 }
 
 // Switching disabled locations works
 async function run_test_5() {
   Services.prefs.setIntPref("extensions.enabledScopes", AddonManager.SCOPE_USER);
 
   gCachePurged = false;
   await promiseRestartManager();
 
   check_startup_changes(AddonManager.STARTUP_CHANGE_INSTALLED, ["addon1@tests.mozilla.org"]);
   check_startup_changes(AddonManager.STARTUP_CHANGE_CHANGED, ["addon2@tests.mozilla.org"]);
   check_startup_changes(AddonManager.STARTUP_CHANGE_UNINSTALLED, []);
   check_startup_changes(AddonManager.STARTUP_CHANGE_DISABLED, []);
   check_startup_changes(AddonManager.STARTUP_CHANGE_ENABLED, []);
   Assert.ok(gCachePurged);
 
-  AddonManager.getAddonsByIDs(["addon1@tests.mozilla.org",
-                               "addon2@tests.mozilla.org",
-                               "addon3@tests.mozilla.org",
-                               "addon4@tests.mozilla.org",
-                               "addon5@tests.mozilla.org"],
-                               function([a1, a2, a3, a4, a5]) {
+  let [a1, a2] = await AddonManager.getAddonsByIDs(["addon1@tests.mozilla.org",
+                                                    "addon2@tests.mozilla.org"]);
+  Assert.notEqual(a1, null);
+  Assert.equal(a1.id, "addon1@tests.mozilla.org");
+  Assert.equal(a1.version, "1.1");
+  Assert.ok(!isExtensionInBootstrappedList(profileDir, a1.id));
+  Assert.ok(isExtensionInBootstrappedList(userDir, a1.id));
+  Assert.ok(!hasFlag(a1.permissions, AddonManager.PERM_CAN_UNINSTALL));
+  Assert.ok(!hasFlag(a1.permissions, AddonManager.PERM_CAN_UPGRADE));
+  do_check_in_crash_annotation(addon1.id, a1.version);
+  Assert.equal(a1.scope, AddonManager.SCOPE_USER);
 
-    Assert.notEqual(a1, null);
-    Assert.equal(a1.id, "addon1@tests.mozilla.org");
-    Assert.equal(a1.version, "1.1");
-    Assert.ok(!isExtensionInBootstrappedList(profileDir, a1.id));
-    Assert.ok(isExtensionInBootstrappedList(userDir, a1.id));
-    Assert.ok(!hasFlag(a1.permissions, AddonManager.PERM_CAN_UNINSTALL));
-    Assert.ok(!hasFlag(a1.permissions, AddonManager.PERM_CAN_UPGRADE));
-    do_check_in_crash_annotation(addon1.id, a1.version);
-    Assert.equal(a1.scope, AddonManager.SCOPE_USER);
+  Assert.notEqual(a2, null);
+  Assert.equal(a2.id, "addon2@tests.mozilla.org");
+  Assert.equal(a2.version, "2.3");
+  Assert.ok(!isExtensionInBootstrappedList(profileDir, a2.id));
+  Assert.ok(isExtensionInBootstrappedList(userDir, a2.id));
+  Assert.ok(!isExtensionInBootstrappedList(globalDir, a2.id));
+  Assert.ok(!hasFlag(a2.permissions, AddonManager.PERM_CAN_UNINSTALL));
+  Assert.ok(!hasFlag(a2.permissions, AddonManager.PERM_CAN_UPGRADE));
+  do_check_in_crash_annotation(addon2.id, a2.version);
+  Assert.equal(a2.scope, AddonManager.SCOPE_USER);
 
-    Assert.notEqual(a2, null);
-    Assert.equal(a2.id, "addon2@tests.mozilla.org");
-    Assert.equal(a2.version, "2.3");
-    Assert.ok(!isExtensionInBootstrappedList(profileDir, a2.id));
-    Assert.ok(isExtensionInBootstrappedList(userDir, a2.id));
-    Assert.ok(!isExtensionInBootstrappedList(globalDir, a2.id));
-    Assert.ok(!hasFlag(a2.permissions, AddonManager.PERM_CAN_UNINSTALL));
-    Assert.ok(!hasFlag(a2.permissions, AddonManager.PERM_CAN_UPGRADE));
-    do_check_in_crash_annotation(addon2.id, a2.version);
-    Assert.equal(a2.scope, AddonManager.SCOPE_USER);
-
-    executeSoon(run_test_6);
-  });
+  executeSoon(run_test_6);
 }
 
 // Resetting the pref makes everything visible again
 async function run_test_6() {
   Services.prefs.clearUserPref("extensions.enabledScopes");
 
   gCachePurged = false;
   await promiseRestartManager();
 
   check_startup_changes(AddonManager.STARTUP_CHANGE_INSTALLED, []);
   check_startup_changes(AddonManager.STARTUP_CHANGE_CHANGED, []);
   check_startup_changes(AddonManager.STARTUP_CHANGE_UNINSTALLED, []);
   check_startup_changes(AddonManager.STARTUP_CHANGE_DISABLED, []);
   check_startup_changes(AddonManager.STARTUP_CHANGE_ENABLED, []);
   Assert.ok(gCachePurged);
 
-  AddonManager.getAddonsByIDs(["addon1@tests.mozilla.org",
-                               "addon2@tests.mozilla.org",
-                               "addon3@tests.mozilla.org",
-                               "addon4@tests.mozilla.org",
-                               "addon5@tests.mozilla.org"],
-                               function([a1, a2, a3, a4, a5]) {
+  let [a1, a2] = await AddonManager.getAddonsByIDs(["addon1@tests.mozilla.org",
+                                                    "addon2@tests.mozilla.org"]);
+  Assert.notEqual(a1, null);
+  Assert.equal(a1.id, "addon1@tests.mozilla.org");
+  Assert.equal(a1.version, "1.1");
+  Assert.ok(!isExtensionInBootstrappedList(profileDir, a1.id));
+  Assert.ok(isExtensionInBootstrappedList(userDir, a1.id));
+  Assert.ok(!hasFlag(a1.permissions, AddonManager.PERM_CAN_UNINSTALL));
+  Assert.ok(!hasFlag(a1.permissions, AddonManager.PERM_CAN_UPGRADE));
+  do_check_in_crash_annotation(addon1.id, a1.version);
+  Assert.equal(a1.scope, AddonManager.SCOPE_USER);
 
-    Assert.notEqual(a1, null);
-    Assert.equal(a1.id, "addon1@tests.mozilla.org");
-    Assert.equal(a1.version, "1.1");
-    Assert.ok(!isExtensionInBootstrappedList(profileDir, a1.id));
-    Assert.ok(isExtensionInBootstrappedList(userDir, a1.id));
-    Assert.ok(!hasFlag(a1.permissions, AddonManager.PERM_CAN_UNINSTALL));
-    Assert.ok(!hasFlag(a1.permissions, AddonManager.PERM_CAN_UPGRADE));
-    do_check_in_crash_annotation(addon1.id, a1.version);
-    Assert.equal(a1.scope, AddonManager.SCOPE_USER);
+  Assert.notEqual(a2, null);
+  Assert.equal(a2.id, "addon2@tests.mozilla.org");
+  Assert.equal(a2.version, "2.3");
+  Assert.ok(!isExtensionInBootstrappedList(profileDir, a2.id));
+  Assert.ok(isExtensionInBootstrappedList(userDir, a2.id));
+  Assert.ok(!isExtensionInBootstrappedList(globalDir, a2.id));
+  Assert.ok(!hasFlag(a2.permissions, AddonManager.PERM_CAN_UNINSTALL));
+  Assert.ok(!hasFlag(a2.permissions, AddonManager.PERM_CAN_UPGRADE));
+  do_check_in_crash_annotation(addon2.id, a2.version);
+  Assert.equal(a2.scope, AddonManager.SCOPE_USER);
 
-    Assert.notEqual(a2, null);
-    Assert.equal(a2.id, "addon2@tests.mozilla.org");
-    Assert.equal(a2.version, "2.3");
-    Assert.ok(!isExtensionInBootstrappedList(profileDir, a2.id));
-    Assert.ok(isExtensionInBootstrappedList(userDir, a2.id));
-    Assert.ok(!isExtensionInBootstrappedList(globalDir, a2.id));
-    Assert.ok(!hasFlag(a2.permissions, AddonManager.PERM_CAN_UNINSTALL));
-    Assert.ok(!hasFlag(a2.permissions, AddonManager.PERM_CAN_UPGRADE));
-    do_check_in_crash_annotation(addon2.id, a2.version);
-    Assert.equal(a2.scope, AddonManager.SCOPE_USER);
-
-    executeSoon(run_test_7);
-  });
+  executeSoon(run_test_7);
 }
 
 // Check that items in the profile hide the others again.
 async function run_test_7() {
   await promiseShutdownManager();
 
   addon1.version = "1.2";
   writeInstallRDFForExtension(addon1, profileDir);
@@ -575,95 +542,86 @@ async function run_test_7() {
   check_startup_changes(AddonManager.STARTUP_CHANGE_INSTALLED, []);
   check_startup_changes(AddonManager.STARTUP_CHANGE_CHANGED, ["addon1@tests.mozilla.org",
                                     "addon2@tests.mozilla.org"]);
   check_startup_changes(AddonManager.STARTUP_CHANGE_UNINSTALLED, []);
   check_startup_changes(AddonManager.STARTUP_CHANGE_DISABLED, []);
   check_startup_changes(AddonManager.STARTUP_CHANGE_ENABLED, []);
   Assert.ok(gCachePurged);
 
-  AddonManager.getAddonsByIDs(["addon1@tests.mozilla.org",
-                               "addon2@tests.mozilla.org",
-                               "addon3@tests.mozilla.org",
-                               "addon4@tests.mozilla.org",
-                               "addon5@tests.mozilla.org"],
-                               function([a1, a2, a3, a4, a5]) {
-
-    Assert.notEqual(a1, null);
-    Assert.equal(a1.id, "addon1@tests.mozilla.org");
-    Assert.equal(a1.version, "1.2");
-    Assert.ok(isExtensionInBootstrappedList(profileDir, a1.id));
-    Assert.ok(!isExtensionInBootstrappedList(userDir, a1.id));
-    Assert.ok(hasFlag(a1.permissions, AddonManager.PERM_CAN_UNINSTALL));
-    Assert.ok(hasFlag(a1.permissions, AddonManager.PERM_CAN_UPGRADE));
-    do_check_in_crash_annotation(addon1.id, a1.version);
-    Assert.equal(a1.scope, AddonManager.SCOPE_PROFILE);
+  let [a1, a2, a3, a4, a5] = await AddonManager.getAddonsByIDs(["addon1@tests.mozilla.org",
+                                                                "addon2@tests.mozilla.org",
+                                                                "addon3@tests.mozilla.org",
+                                                                "addon4@tests.mozilla.org",
+                                                                "addon5@tests.mozilla.org"]);
+  Assert.notEqual(a1, null);
+  Assert.equal(a1.id, "addon1@tests.mozilla.org");
+  Assert.equal(a1.version, "1.2");
+  Assert.ok(isExtensionInBootstrappedList(profileDir, a1.id));
+  Assert.ok(!isExtensionInBootstrappedList(userDir, a1.id));
+  Assert.ok(hasFlag(a1.permissions, AddonManager.PERM_CAN_UNINSTALL));
+  Assert.ok(hasFlag(a1.permissions, AddonManager.PERM_CAN_UPGRADE));
+  do_check_in_crash_annotation(addon1.id, a1.version);
+  Assert.equal(a1.scope, AddonManager.SCOPE_PROFILE);
 
-    Assert.notEqual(a2, null);
-    Assert.equal(a2.id, "addon2@tests.mozilla.org");
-    Assert.equal(a2.version, "2.2");
-    Assert.ok(!isExtensionInBootstrappedList(profileDir, a2.id));
-    Assert.ok(!isExtensionInBootstrappedList(userDir, a2.id));
-    Assert.ok(isExtensionInBootstrappedList(globalDir, a2.id));
-    Assert.ok(!hasFlag(a2.permissions, AddonManager.PERM_CAN_UNINSTALL));
-    Assert.ok(!hasFlag(a2.permissions, AddonManager.PERM_CAN_UPGRADE));
-    do_check_in_crash_annotation(addon2.id, a2.version);
-    Assert.equal(a2.scope, AddonManager.SCOPE_SYSTEM);
+  Assert.notEqual(a2, null);
+  Assert.equal(a2.id, "addon2@tests.mozilla.org");
+  Assert.equal(a2.version, "2.2");
+  Assert.ok(!isExtensionInBootstrappedList(profileDir, a2.id));
+  Assert.ok(!isExtensionInBootstrappedList(userDir, a2.id));
+  Assert.ok(isExtensionInBootstrappedList(globalDir, a2.id));
+  Assert.ok(!hasFlag(a2.permissions, AddonManager.PERM_CAN_UNINSTALL));
+  Assert.ok(!hasFlag(a2.permissions, AddonManager.PERM_CAN_UPGRADE));
+  do_check_in_crash_annotation(addon2.id, a2.version);
+  Assert.equal(a2.scope, AddonManager.SCOPE_SYSTEM);
 
-    Assert.equal(a3, null);
-    Assert.ok(!isExtensionInBootstrappedList(profileDir, "addon3@tests.mozilla.org"));
-
-    Assert.equal(a4, null);
-    Assert.ok(!isExtensionInBootstrappedList(profileDir, "addon4@tests.mozilla.org"));
+  Assert.equal(a3, null);
+  Assert.ok(!isExtensionInBootstrappedList(profileDir, "addon3@tests.mozilla.org"));
 
-    Assert.equal(a5, null);
-    Assert.ok(!isExtensionInBootstrappedList(profileDir, "addon5@tests.mozilla.org"));
+  Assert.equal(a4, null);
+  Assert.ok(!isExtensionInBootstrappedList(profileDir, "addon4@tests.mozilla.org"));
 
-    executeSoon(run_test_8);
-  });
+  Assert.equal(a5, null);
+  Assert.ok(!isExtensionInBootstrappedList(profileDir, "addon5@tests.mozilla.org"));
+
+  executeSoon(run_test_8);
 }
 
 // Disabling all locations still leaves the profile working
 async function run_test_8() {
   Services.prefs.setIntPref("extensions.enabledScopes", 0);
 
   gCachePurged = false;
   await promiseRestartManager();
 
   check_startup_changes(AddonManager.STARTUP_CHANGE_INSTALLED, []);
   check_startup_changes(AddonManager.STARTUP_CHANGE_CHANGED, []);
   check_startup_changes(AddonManager.STARTUP_CHANGE_UNINSTALLED, ["addon2@tests.mozilla.org"]);
   check_startup_changes(AddonManager.STARTUP_CHANGE_DISABLED, []);
   check_startup_changes(AddonManager.STARTUP_CHANGE_ENABLED, []);
   Assert.ok(gCachePurged);
 
-  AddonManager.getAddonsByIDs(["addon1@tests.mozilla.org",
-                               "addon2@tests.mozilla.org",
-                               "addon3@tests.mozilla.org",
-                               "addon4@tests.mozilla.org",
-                               "addon5@tests.mozilla.org"],
-                               function([a1, a2, a3, a4, a5]) {
+  let [a1, a2] = await AddonManager.getAddonsByIDs(["addon1@tests.mozilla.org",
+                                                    "addon2@tests.mozilla.org"]);
+  Assert.notEqual(a1, null);
+  Assert.equal(a1.id, "addon1@tests.mozilla.org");
+  Assert.equal(a1.version, "1.2");
+  Assert.ok(isExtensionInBootstrappedList(profileDir, a1.id));
+  Assert.ok(!isExtensionInBootstrappedList(userDir, a1.id));
+  Assert.ok(hasFlag(a1.permissions, AddonManager.PERM_CAN_UNINSTALL));
+  Assert.ok(hasFlag(a1.permissions, AddonManager.PERM_CAN_UPGRADE));
+  do_check_in_crash_annotation(addon1.id, a1.version);
+  Assert.equal(a1.scope, AddonManager.SCOPE_PROFILE);
 
-    Assert.notEqual(a1, null);
-    Assert.equal(a1.id, "addon1@tests.mozilla.org");
-    Assert.equal(a1.version, "1.2");
-    Assert.ok(isExtensionInBootstrappedList(profileDir, a1.id));
-    Assert.ok(!isExtensionInBootstrappedList(userDir, a1.id));
-    Assert.ok(hasFlag(a1.permissions, AddonManager.PERM_CAN_UNINSTALL));
-    Assert.ok(hasFlag(a1.permissions, AddonManager.PERM_CAN_UPGRADE));
-    do_check_in_crash_annotation(addon1.id, a1.version);
-    Assert.equal(a1.scope, AddonManager.SCOPE_PROFILE);
+  Assert.equal(a2, null);
+  Assert.ok(!isExtensionInBootstrappedList(profileDir, "addon2@tests.mozilla.org"));
+  Assert.ok(!isExtensionInBootstrappedList(userDir, "addon2@tests.mozilla.org"));
+  Assert.ok(!isExtensionInBootstrappedList(globalDir, "addon2@tests.mozilla.org"));
 
-    Assert.equal(a2, null);
-    Assert.ok(!isExtensionInBootstrappedList(profileDir, "addon2@tests.mozilla.org"));
-    Assert.ok(!isExtensionInBootstrappedList(userDir, "addon2@tests.mozilla.org"));
-    Assert.ok(!isExtensionInBootstrappedList(globalDir, "addon2@tests.mozilla.org"));
-
-    executeSoon(run_test_9);
-  });
+  executeSoon(run_test_9);
 }
 
 // More hiding and revealing
 async function run_test_9() {
   Services.prefs.clearUserPref("extensions.enabledScopes");
 
   await promiseShutdownManager();
 
@@ -681,53 +639,50 @@ async function run_test_9() {
 
   check_startup_changes(AddonManager.STARTUP_CHANGE_INSTALLED, ["addon2@tests.mozilla.org"]);
   check_startup_changes(AddonManager.STARTUP_CHANGE_CHANGED, []);
   check_startup_changes(AddonManager.STARTUP_CHANGE_UNINSTALLED, []);
   check_startup_changes(AddonManager.STARTUP_CHANGE_DISABLED, []);
   check_startup_changes(AddonManager.STARTUP_CHANGE_ENABLED, []);
   Assert.ok(gCachePurged);
 
-  AddonManager.getAddonsByIDs(["addon1@tests.mozilla.org",
-                               "addon2@tests.mozilla.org",
-                               "addon3@tests.mozilla.org",
-                               "addon4@tests.mozilla.org",
-                               "addon5@tests.mozilla.org"],
-                               function([a1, a2, a3, a4, a5]) {
-
-    Assert.notEqual(a1, null);
-    Assert.equal(a1.id, "addon1@tests.mozilla.org");
-    Assert.equal(a1.version, "1.2");
-    Assert.ok(isExtensionInBootstrappedList(profileDir, a1.id));
-    Assert.ok(!isExtensionInBootstrappedList(userDir, a1.id));
-    Assert.ok(hasFlag(a1.permissions, AddonManager.PERM_CAN_UNINSTALL));
-    Assert.ok(hasFlag(a1.permissions, AddonManager.PERM_CAN_UPGRADE));
-    Assert.equal(a1.scope, AddonManager.SCOPE_PROFILE);
+  let [a1, a2, a3, a4, a5] = await AddonManager.getAddonsByIDs(["addon1@tests.mozilla.org",
+                                                                "addon2@tests.mozilla.org",
+                                                                "addon3@tests.mozilla.org",
+                                                                "addon4@tests.mozilla.org",
+                                                                "addon5@tests.mozilla.org"]);
+  Assert.notEqual(a1, null);
+  Assert.equal(a1.id, "addon1@tests.mozilla.org");
+  Assert.equal(a1.version, "1.2");
+  Assert.ok(isExtensionInBootstrappedList(profileDir, a1.id));
+  Assert.ok(!isExtensionInBootstrappedList(userDir, a1.id));
+  Assert.ok(hasFlag(a1.permissions, AddonManager.PERM_CAN_UNINSTALL));
+  Assert.ok(hasFlag(a1.permissions, AddonManager.PERM_CAN_UPGRADE));
+  Assert.equal(a1.scope, AddonManager.SCOPE_PROFILE);
 
-    Assert.notEqual(a2, null);
-    Assert.equal(a2.id, "addon2@tests.mozilla.org");
-    Assert.equal(a2.version, "2.4");
-    Assert.ok(isExtensionInBootstrappedList(profileDir, a2.id));
-    Assert.ok(!isExtensionInBootstrappedList(userDir, a2.id));
-    Assert.ok(!isExtensionInBootstrappedList(globalDir, a2.id));
-    Assert.ok(hasFlag(a2.permissions, AddonManager.PERM_CAN_UNINSTALL));
-    Assert.ok(hasFlag(a2.permissions, AddonManager.PERM_CAN_UPGRADE));
-    Assert.equal(a2.scope, AddonManager.SCOPE_PROFILE);
+  Assert.notEqual(a2, null);
+  Assert.equal(a2.id, "addon2@tests.mozilla.org");
+  Assert.equal(a2.version, "2.4");
+  Assert.ok(isExtensionInBootstrappedList(profileDir, a2.id));
+  Assert.ok(!isExtensionInBootstrappedList(userDir, a2.id));
+  Assert.ok(!isExtensionInBootstrappedList(globalDir, a2.id));
+  Assert.ok(hasFlag(a2.permissions, AddonManager.PERM_CAN_UNINSTALL));
+  Assert.ok(hasFlag(a2.permissions, AddonManager.PERM_CAN_UPGRADE));
+  Assert.equal(a2.scope, AddonManager.SCOPE_PROFILE);
 
-    Assert.equal(a3, null);
-    Assert.ok(!isExtensionInBootstrappedList(profileDir, "addon3@tests.mozilla.org"));
-
-    Assert.equal(a4, null);
-    Assert.ok(!isExtensionInBootstrappedList(profileDir, "addon4@tests.mozilla.org"));
+  Assert.equal(a3, null);
+  Assert.ok(!isExtensionInBootstrappedList(profileDir, "addon3@tests.mozilla.org"));
 
-    Assert.equal(a5, null);
-    Assert.ok(!isExtensionInBootstrappedList(profileDir, "addon5@tests.mozilla.org"));
+  Assert.equal(a4, null);
+  Assert.ok(!isExtensionInBootstrappedList(profileDir, "addon4@tests.mozilla.org"));
 
-    executeSoon(run_test_10);
-  });
+  Assert.equal(a5, null);
+  Assert.ok(!isExtensionInBootstrappedList(profileDir, "addon5@tests.mozilla.org"));
+
+  executeSoon(run_test_10);
 }
 
 // Checks that a removal from one location and an addition in another location
 // for the same item is handled
 async function run_test_10() {
   await promiseShutdownManager();
 
   var dest = profileDir.clone();
@@ -741,53 +696,50 @@ async function run_test_10() {
 
   check_startup_changes(AddonManager.STARTUP_CHANGE_INSTALLED, []);
   check_startup_changes(AddonManager.STARTUP_CHANGE_CHANGED, ["addon1@tests.mozilla.org"]);
   check_startup_changes(AddonManager.STARTUP_CHANGE_UNINSTALLED, []);
   check_startup_changes(AddonManager.STARTUP_CHANGE_DISABLED, []);
   check_startup_changes(AddonManager.STARTUP_CHANGE_ENABLED, []);
   Assert.ok(gCachePurged);
 
-  AddonManager.getAddonsByIDs(["addon1@tests.mozilla.org",
-                               "addon2@tests.mozilla.org",
-                               "addon3@tests.mozilla.org",
-                               "addon4@tests.mozilla.org",
-                               "addon5@tests.mozilla.org"],
-                               function([a1, a2, a3, a4, a5]) {
-
-    Assert.notEqual(a1, null);
-    Assert.equal(a1.id, "addon1@tests.mozilla.org");
-    Assert.equal(a1.version, "1.3");
-    Assert.ok(!isExtensionInBootstrappedList(profileDir, a1.id));
-    Assert.ok(isExtensionInBootstrappedList(userDir, a1.id));
-    Assert.ok(!hasFlag(a1.permissions, AddonManager.PERM_CAN_UNINSTALL));
-    Assert.ok(!hasFlag(a1.permissions, AddonManager.PERM_CAN_UPGRADE));
-    Assert.equal(a1.scope, AddonManager.SCOPE_USER);
+  let [a1, a2, a3, a4, a5] = await AddonManager.getAddonsByIDs(["addon1@tests.mozilla.org",
+                                                                "addon2@tests.mozilla.org",
+                                                                "addon3@tests.mozilla.org",
+                                                                "addon4@tests.mozilla.org",
+                                                                "addon5@tests.mozilla.org"]);
+  Assert.notEqual(a1, null);
+  Assert.equal(a1.id, "addon1@tests.mozilla.org");
+  Assert.equal(a1.version, "1.3");
+  Assert.ok(!isExtensionInBootstrappedList(profileDir, a1.id));
+  Assert.ok(isExtensionInBootstrappedList(userDir, a1.id));
+  Assert.ok(!hasFlag(a1.permissions, AddonManager.PERM_CAN_UNINSTALL));
+  Assert.ok(!hasFlag(a1.permissions, AddonManager.PERM_CAN_UPGRADE));
+  Assert.equal(a1.scope, AddonManager.SCOPE_USER);
 
-    Assert.notEqual(a2, null);
-    Assert.equal(a2.id, "addon2@tests.mozilla.org");
-    Assert.equal(a2.version, "2.4");
-    Assert.ok(isExtensionInBootstrappedList(profileDir, a2.id));
-    Assert.ok(!isExtensionInBootstrappedList(userDir, a2.id));
-    Assert.ok(!isExtensionInBootstrappedList(globalDir, a2.id));
-    Assert.ok(hasFlag(a2.permissions, AddonManager.PERM_CAN_UNINSTALL));
-    Assert.ok(hasFlag(a2.permissions, AddonManager.PERM_CAN_UPGRADE));
-    Assert.equal(a2.scope, AddonManager.SCOPE_PROFILE);
+  Assert.notEqual(a2, null);
+  Assert.equal(a2.id, "addon2@tests.mozilla.org");
+  Assert.equal(a2.version, "2.4");
+  Assert.ok(isExtensionInBootstrappedList(profileDir, a2.id));
+  Assert.ok(!isExtensionInBootstrappedList(userDir, a2.id));
+  Assert.ok(!isExtensionInBootstrappedList(globalDir, a2.id));
+  Assert.ok(hasFlag(a2.permissions, AddonManager.PERM_CAN_UNINSTALL));
+  Assert.ok(hasFlag(a2.permissions, AddonManager.PERM_CAN_UPGRADE));
+  Assert.equal(a2.scope, AddonManager.SCOPE_PROFILE);
 
-    Assert.equal(a3, null);
-    Assert.ok(!isExtensionInBootstrappedList(profileDir, "addon3@tests.mozilla.org"));
-
-    Assert.equal(a4, null);
-    Assert.ok(!isExtensionInBootstrappedList(profileDir, "addon4@tests.mozilla.org"));
+  Assert.equal(a3, null);
+  Assert.ok(!isExtensionInBootstrappedList(profileDir, "addon3@tests.mozilla.org"));
 
-    Assert.equal(a5, null);
-    Assert.ok(!isExtensionInBootstrappedList(profileDir, "addon5@tests.mozilla.org"));
+  Assert.equal(a4, null);
+  Assert.ok(!isExtensionInBootstrappedList(profileDir, "addon4@tests.mozilla.org"));
 
-    executeSoon(run_test_11);
-  });
+  Assert.equal(a5, null);
+  Assert.ok(!isExtensionInBootstrappedList(profileDir, "addon5@tests.mozilla.org"));
+
+  executeSoon(run_test_11);
 }
 
 // This should remove any remaining items
 async function run_test_11() {
   await promiseShutdownManager();
 
   var dest = userDir.clone();
   dest.append(do_get_expected_addon_name("addon1@tests.mozilla.org"));
@@ -802,170 +754,155 @@ async function run_test_11() {
   check_startup_changes(AddonManager.STARTUP_CHANGE_INSTALLED, []);
   check_startup_changes(AddonManager.STARTUP_CHANGE_CHANGED, []);
   check_startup_changes(AddonManager.STARTUP_CHANGE_UNINSTALLED, ["addon1@tests.mozilla.org",
                                         "addon2@tests.mozilla.org"]);
   check_startup_changes(AddonManager.STARTUP_CHANGE_DISABLED, []);
   check_startup_changes(AddonManager.STARTUP_CHANGE_ENABLED, []);
   Assert.ok(gCachePurged);
 
-  AddonManager.getAddonsByIDs(["addon1@tests.mozilla.org",
-                               "addon2@tests.mozilla.org",
-                               "addon3@tests.mozilla.org",
-                               "addon4@tests.mozilla.org",
-                               "addon5@tests.mozilla.org"],
-                               function([a1, a2, a3, a4, a5]) {
+  let [a1, a2, a3, a4, a5] = await AddonManager.getAddonsByIDs(["addon1@tests.mozilla.org",
+                                                                "addon2@tests.mozilla.org",
+                                                                "addon3@tests.mozilla.org",
+                                                                "addon4@tests.mozilla.org",
+                                                                "addon5@tests.mozilla.org"]);
+  Assert.equal(a1, null);
+  Assert.equal(a2, null);
+  Assert.equal(a3, null);
+  Assert.equal(a4, null);
+  Assert.equal(a5, null);
+  Assert.ok(!isExtensionInBootstrappedList(profileDir, "addon1@tests.mozilla.org"));
+  Assert.ok(!isExtensionInBootstrappedList(profileDir, "addon2@tests.mozilla.org"));
+  Assert.ok(!isExtensionInBootstrappedList(profileDir, "addon3@tests.mozilla.org"));
+  Assert.ok(!isExtensionInBootstrappedList(profileDir, "addon4@tests.mozilla.org"));
+  Assert.ok(!isExtensionInBootstrappedList(profileDir, "addon5@tests.mozilla.org"));
+  Assert.ok(!isExtensionInBootstrappedList(userDir, "addon1@tests.mozilla.org"));
+  Assert.ok(!isExtensionInBootstrappedList(userDir, "addon2@tests.mozilla.org"));
+  Assert.ok(!isExtensionInBootstrappedList(userDir, "addon3@tests.mozilla.org"));
+  Assert.ok(!isExtensionInBootstrappedList(userDir, "addon4@tests.mozilla.org"));
+  Assert.ok(!isExtensionInBootstrappedList(userDir, "addon5@tests.mozilla.org"));
+  Assert.ok(!isExtensionInBootstrappedList(globalDir, "addon1@tests.mozilla.org"));
+  Assert.ok(!isExtensionInBootstrappedList(globalDir, "addon2@tests.mozilla.org"));
+  Assert.ok(!isExtensionInBootstrappedList(globalDir, "addon3@tests.mozilla.org"));
+  Assert.ok(!isExtensionInBootstrappedList(globalDir, "addon4@tests.mozilla.org"));
+  Assert.ok(!isExtensionInBootstrappedList(globalDir, "addon5@tests.mozilla.org"));
+  do_check_not_in_crash_annotation(addon1.id, addon1.version);
+  do_check_not_in_crash_annotation(addon2.id, addon2.version);
 
-    Assert.equal(a1, null);
-    Assert.equal(a2, null);
-    Assert.equal(a3, null);
-    Assert.equal(a4, null);
-    Assert.equal(a5, null);
-    Assert.ok(!isExtensionInBootstrappedList(profileDir, "addon1@tests.mozilla.org"));
-    Assert.ok(!isExtensionInBootstrappedList(profileDir, "addon2@tests.mozilla.org"));
-    Assert.ok(!isExtensionInBootstrappedList(profileDir, "addon3@tests.mozilla.org"));
-    Assert.ok(!isExtensionInBootstrappedList(profileDir, "addon4@tests.mozilla.org"));
-    Assert.ok(!isExtensionInBootstrappedList(profileDir, "addon5@tests.mozilla.org"));
-    Assert.ok(!isExtensionInBootstrappedList(userDir, "addon1@tests.mozilla.org"));
-    Assert.ok(!isExtensionInBootstrappedList(userDir, "addon2@tests.mozilla.org"));
-    Assert.ok(!isExtensionInBootstrappedList(userDir, "addon3@tests.mozilla.org"));
-    Assert.ok(!isExtensionInBootstrappedList(userDir, "addon4@tests.mozilla.org"));
-    Assert.ok(!isExtensionInBootstrappedList(userDir, "addon5@tests.mozilla.org"));
-    Assert.ok(!isExtensionInBootstrappedList(globalDir, "addon1@tests.mozilla.org"));
-    Assert.ok(!isExtensionInBootstrappedList(globalDir, "addon2@tests.mozilla.org"));
-    Assert.ok(!isExtensionInBootstrappedList(globalDir, "addon3@tests.mozilla.org"));
-    Assert.ok(!isExtensionInBootstrappedList(globalDir, "addon4@tests.mozilla.org"));
-    Assert.ok(!isExtensionInBootstrappedList(globalDir, "addon5@tests.mozilla.org"));
-    do_check_not_in_crash_annotation(addon1.id, addon1.version);
-    do_check_not_in_crash_annotation(addon2.id, addon2.version);
-
-    executeSoon(run_test_12);
-  });
+  executeSoon(run_test_12);
 }
 
 // Test that auto-disabling for specific scopes works
-function run_test_12() {
+async function run_test_12() {
   Services.prefs.setIntPref("extensions.autoDisableScopes", AddonManager.SCOPE_USER);
 
   shutdownManager();
 
   writeInstallRDFForExtension(addon1, profileDir);
   writeInstallRDFForExtension(addon2, userDir);
   writeInstallRDFForExtension(addon3, globalDir);
 
   startupManager(false);
 
-  AddonManager.getAddonsByIDs(["addon1@tests.mozilla.org",
-                               "addon2@tests.mozilla.org",
-                               "addon3@tests.mozilla.org",
-                               "addon4@tests.mozilla.org",
-                               "addon5@tests.mozilla.org"],
-                               callback_soon(function([a1, a2, a3, a4, a5]) {
-    Assert.notEqual(a1, null);
-    Assert.ok(!a1.userDisabled);
-    Assert.ok(a1.seen);
-    Assert.ok(a1.isActive);
+  let [a1, a2, a3] = await AddonManager.getAddonsByIDs(["addon1@tests.mozilla.org",
+                                                        "addon2@tests.mozilla.org",
+                                                        "addon3@tests.mozilla.org"]);
+  Assert.notEqual(a1, null);
+  Assert.ok(!a1.userDisabled);
+  Assert.ok(a1.seen);
+  Assert.ok(a1.isActive);
 
-    Assert.notEqual(a2, null);
-    Assert.ok(a2.userDisabled);
-    Assert.ok(!a2.seen);
-    Assert.ok(!a2.isActive);
+  Assert.notEqual(a2, null);
+  Assert.ok(a2.userDisabled);
+  Assert.ok(!a2.seen);
+  Assert.ok(!a2.isActive);
 
-    Assert.notEqual(a3, null);
-    Assert.ok(!a3.userDisabled);
-    Assert.ok(a3.seen);
-    Assert.ok(a3.isActive);
+  Assert.notEqual(a3, null);
+  Assert.ok(!a3.userDisabled);
+  Assert.ok(a3.seen);
+  Assert.ok(a3.isActive);
 
-    shutdownManager();
+  shutdownManager();
 
-    var dest = profileDir.clone();
-    dest.append(do_get_expected_addon_name("addon1@tests.mozilla.org"));
-    dest.remove(true);
-    dest = userDir.clone();
-    dest.append(do_get_expected_addon_name("addon2@tests.mozilla.org"));
-    dest.remove(true);
-    dest = globalDir.clone();
-    dest.append(do_get_expected_addon_name("addon3@tests.mozilla.org"));
-    dest.remove(true);
+  var dest = profileDir.clone();
+  dest.append(do_get_expected_addon_name("addon1@tests.mozilla.org"));
+  dest.remove(true);
+  dest = userDir.clone();
+  dest.append(do_get_expected_addon_name("addon2@tests.mozilla.org"));
+  dest.remove(true);
+  dest = globalDir.clone();
+  dest.append(do_get_expected_addon_name("addon3@tests.mozilla.org"));
+  dest.remove(true);
 
-    startupManager(false);
-    shutdownManager();
-
-    Services.prefs.setIntPref("extensions.autoDisableScopes", AddonManager.SCOPE_SYSTEM);
+  startupManager(false);
+  shutdownManager();
 
-    writeInstallRDFForExtension(addon1, profileDir);
-    writeInstallRDFForExtension(addon2, userDir);
-    writeInstallRDFForExtension(addon3, globalDir);
+  Services.prefs.setIntPref("extensions.autoDisableScopes", AddonManager.SCOPE_SYSTEM);
 
-    startupManager(false);
+  writeInstallRDFForExtension(addon1, profileDir);
+  writeInstallRDFForExtension(addon2, userDir);
+  writeInstallRDFForExtension(addon3, globalDir);
+
+  startupManager(false);
 
-    AddonManager.getAddonsByIDs(["addon1@tests.mozilla.org",
-                                 "addon2@tests.mozilla.org",
-                                 "addon3@tests.mozilla.org",
-                                 "addon4@tests.mozilla.org",
-                                 "addon5@tests.mozilla.org"],
-                                 function([a1_2, a2_2, a3_2, a4_2, a5_2]) {
-      Assert.notEqual(a1_2, null);
-      Assert.ok(!a1_2.userDisabled);
-      Assert.ok(a1_2.seen);
-      Assert.ok(a1_2.isActive);
+  let [a1_2, a2_2, a3_2] = await AddonManager.getAddonsByIDs(["addon1@tests.mozilla.org",
+                                                              "addon2@tests.mozilla.org",
+                                                              "addon3@tests.mozilla.org"]);
+  Assert.notEqual(a1_2, null);
+  Assert.ok(!a1_2.userDisabled);
+  Assert.ok(a1_2.seen);
+  Assert.ok(a1_2.isActive);
 
-      Assert.notEqual(a2_2, null);
-      Assert.ok(!a2_2.userDisabled);
-      Assert.ok(a2_2.seen);
-      Assert.ok(a2_2.isActive);
+  Assert.notEqual(a2_2, null);
+  Assert.ok(!a2_2.userDisabled);
+  Assert.ok(a2_2.seen);
+  Assert.ok(a2_2.isActive);
 
-      Assert.notEqual(a3_2, null);
-      Assert.ok(a3_2.userDisabled);
-      Assert.ok(!a3_2.seen);
-      Assert.ok(!a3_2.isActive);
+  Assert.notEqual(a3_2, null);
+  Assert.ok(a3_2.userDisabled);
+  Assert.ok(!a3_2.seen);
+  Assert.ok(!a3_2.isActive);
 
-      shutdownManager();
+  shutdownManager();
 
-      var dest2 = profileDir.clone();
-      dest2.append(do_get_expected_addon_name("addon1@tests.mozilla.org"));
-      dest2.remove(true);
-      dest2 = userDir.clone();
-      dest2.append(do_get_expected_addon_name("addon2@tests.mozilla.org"));
-      dest2.remove(true);
-      dest2 = globalDir.clone();
-      dest2.append(do_get_expected_addon_name("addon3@tests.mozilla.org"));
-      dest2.remove(true);
+  var dest2 = profileDir.clone();
+  dest2.append(do_get_expected_addon_name("addon1@tests.mozilla.org"));
+  dest2.remove(true);
+  dest2 = userDir.clone();
+  dest2.append(do_get_expected_addon_name("addon2@tests.mozilla.org"));
+  dest2.remove(true);
+  dest2 = globalDir.clone();
+  dest2.append(do_get_expected_addon_name("addon3@tests.mozilla.org"));
+  dest2.remove(true);
 
-      startupManager(false);
-      shutdownManager();
+  startupManager(false);
+  shutdownManager();
 
-      Services.prefs.setIntPref("extensions.autoDisableScopes", AddonManager.SCOPE_USER + AddonManager.SCOPE_SYSTEM);
-
-      writeInstallRDFForExtension(addon1, profileDir);
-      writeInstallRDFForExtension(addon2, userDir);
-      writeInstallRDFForExtension(addon3, globalDir);
+  Services.prefs.setIntPref("extensions.autoDisableScopes", AddonManager.SCOPE_USER + AddonManager.SCOPE_SYSTEM);
 
-      startupManager(false);
+  writeInstallRDFForExtension(addon1, profileDir);
+  writeInstallRDFForExtension(addon2, userDir);
+  writeInstallRDFForExtension(addon3, globalDir);
+
+  startupManager(false);
 
-      AddonManager.getAddonsByIDs(["addon1@tests.mozilla.org",
-                                   "addon2@tests.mozilla.org",
-                                   "addon3@tests.mozilla.org",
-                                   "addon4@tests.mozilla.org",
-                                   "addon5@tests.mozilla.org"],
-                                   function([a1_3, a2_3, a3_3, a4_3, a5_3]) {
-        Assert.notEqual(a1_3, null);
-        Assert.ok(!a1_3.userDisabled);
-        Assert.ok(a1_3.seen);
-        Assert.ok(a1_3.isActive);
+  let [a1_3, a2_3, a3_3] = await AddonManager.getAddonsByIDs(["addon1@tests.mozilla.org",
+                                                              "addon2@tests.mozilla.org",
+                                                              "addon3@tests.mozilla.org"]);
+  Assert.notEqual(a1_3, null);
+  Assert.ok(!a1_3.userDisabled);
+  Assert.ok(a1_3.seen);
+  Assert.ok(a1_3.isActive);
 
-        Assert.notEqual(a2_3, null);
-        Assert.ok(a2_3.userDisabled);
-        Assert.ok(!a2_3.seen);
-        Assert.ok(!a2_3.isActive);
+  Assert.notEqual(a2_3, null);
+  Assert.ok(a2_3.userDisabled);
+  Assert.ok(!a2_3.seen);
+  Assert.ok(!a2_3.isActive);
 
-        Assert.notEqual(a3_3, null);
-        Assert.ok(a3_3.userDisabled);
-        Assert.ok(!a3_3.seen);
-        Assert.ok(!a3_3.isActive);
+  Assert.notEqual(a3_3, null);
+  Assert.ok(a3_3.userDisabled);
+  Assert.ok(!a3_3.seen);
+  Assert.ok(!a3_3.isActive);
 
-        shutdownManager();
+  shutdownManager();
 
-        executeSoon(end_test);
-      });
-    });
-  }));
+  executeSoon(end_test);
 }
--- a/toolkit/mozapps/extensions/test/xpcshell/test_syncGUID.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_syncGUID.js
@@ -48,54 +48,49 @@ const ADDONS = [
       maxVersion: "1"}],
   },
 ];
 
 const XPIS = ADDONS.map(addon => createTempXPIFile(addon));
 
 const UUID_PATTERN = /^\{[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\}$/i;
 
-add_test(function test_getter_and_setter() {
+add_test(async function test_getter_and_setter() {
   // Our test add-on requires a restart.
   let listener = {
     onInstallEnded: function onInstallEnded() {
      AddonManager.removeInstallListener(listener);
      // never restart directly inside an onInstallEnded handler!
-     executeSoon(function getter_setter_install_ended() {
+     executeSoon(async function getter_setter_install_ended() {
       restartManager();
 
-      AddonManager.getAddonByID(addonId, function(addon) {
+      let addon = await AddonManager.getAddonByID(addonId);
+      Assert.notEqual(addon, null);
+      Assert.notEqual(addon.syncGUID, null);
+      Assert.ok(UUID_PATTERN.test(addon.syncGUID));
 
-        Assert.notEqual(addon, null);
-        Assert.notEqual(addon.syncGUID, null);
-        Assert.ok(UUID_PATTERN.test(addon.syncGUID));
-
-        let newGUID = "foo";
+      let newGUID = "foo";
 
-        addon.syncGUID = newGUID;
-        Assert.equal(newGUID, addon.syncGUID);
+      addon.syncGUID = newGUID;
+      Assert.equal(newGUID, addon.syncGUID);
 
-        // Verify change made it to DB.
-        AddonManager.getAddonByID(addonId, function(newAddon) {
-          Assert.notEqual(newAddon, null);
-          Assert.equal(newGUID, newAddon.syncGUID);
-        });
+      // Verify change made it to DB.
+      let newAddon = await AddonManager.getAddonByID(addonId);
+      Assert.notEqual(newAddon, null);
+      Assert.equal(newGUID, newAddon.syncGUID);
 
-        run_next_test();
-      });
+      run_next_test();
      });
     }
   };
 
   AddonManager.addInstallListener(listener);
 
-  AddonManager.getInstallForFile(XPIS[0],
-                                 function(install) {
-    install.install();
-  });
+  let install = await AddonManager.getInstallForFile(XPIS[0]);
+  install.install();
 });
 
 add_test(function test_fetch_by_guid_unknown_guid() {
   XPIProvider.getAddonBySyncGUID("XXXX", function(addon) {
     Assert.equal(null, addon);
     run_next_test();
   });
 });
@@ -108,75 +103,69 @@ add_test(function test_error_on_duplicat
   let installCount = 0;
 
   let listener = {
     onInstallEnded: function onInstallEnded() {
       installCount++;
 
       if (installCount == installNames.length) {
        AddonManager.removeInstallListener(listener);
-       executeSoon(function duplicate_syncguid_install_ended() {
+       executeSoon(async function duplicate_syncguid_install_ended() {
         restartManager();
 
-        AddonManager.getAddonsByIDs(installIDs, callback_soon(function(addons) {
-          let initialGUID = addons[1].syncGUID;
+        let addons = await AddonManager.getAddonsByIDs(installIDs);
+        let initialGUID = addons[1].syncGUID;
 
-          try {
-            addons[1].syncGUID = addons[0].syncGUID;
-            do_throw("Should not get here.");
-          } catch (e) {
-            Assert.ok(e.message.startsWith("Addon sync GUID conflict"));
-            restartManager();
+        try {
+          addons[1].syncGUID = addons[0].syncGUID;
+          do_throw("Should not get here.");
+        } catch (e) {
+          Assert.ok(e.message.startsWith("Addon sync GUID conflict"));
+          restartManager();
 
-            AddonManager.getAddonByID(installIDs[1], function(addon) {
-              Assert.equal(initialGUID, addon.syncGUID);
-              run_next_test();
-            });
-          }
-        }));
+          let addon = await AddonManager.getAddonByID(installIDs[1]);
+          Assert.equal(initialGUID, addon.syncGUID);
+          run_next_test();
+        }
        });
       }
     }
   };
 
   AddonManager.addInstallListener(listener);
   let getInstallCB = function(install) { install.install(); };
 
   for (let xpi of XPIS) {
     AddonManager.getInstallForFile(xpi, getInstallCB);
   }
 });
 
-add_test(function test_fetch_by_guid_known_guid() {
-  AddonManager.getAddonByID(addonId, function(addon) {
-    Assert.notEqual(null, addon);
-    Assert.notEqual(null, addon.syncGUID);
-
-    let syncGUID = addon.syncGUID;
+add_test(async function test_fetch_by_guid_known_guid() {
+  let addon = await AddonManager.getAddonByID(addonId);
+  Assert.notEqual(null, addon);
+  Assert.notEqual(null, addon.syncGUID);
 
-    XPIProvider.getAddonBySyncGUID(syncGUID, function(newAddon) {
-      Assert.notEqual(null, newAddon);
-      Assert.equal(syncGUID, newAddon.syncGUID);
+  let syncGUID = addon.syncGUID;
 
-      run_next_test();
-    });
+  XPIProvider.getAddonBySyncGUID(syncGUID, function(newAddon) {
+    Assert.notEqual(null, newAddon);
+    Assert.equal(syncGUID, newAddon.syncGUID);
+
+    run_next_test();
   });
 });
 
-add_test(function test_addon_manager_get_by_sync_guid() {
-  AddonManager.getAddonByID(addonId, function(addon) {
-    Assert.notEqual(null, addon.syncGUID);
+add_test(async function test_addon_manager_get_by_sync_guid() {
+  let addon = await AddonManager.getAddonByID(addonId);
+  Assert.notEqual(null, addon.syncGUID);
 
-    let syncGUID = addon.syncGUID;
+  let syncGUID = addon.syncGUID;
 
-    AddonManager.getAddonBySyncGUID(syncGUID, function(newAddon) {
-      Assert.notEqual(null, newAddon);
-      Assert.equal(addon.id, newAddon.id);
-      Assert.equal(syncGUID, newAddon.syncGUID);
+  let newAddon = await AddonManager.getAddonBySyncGUID(syncGUID);
+  Assert.notEqual(null, newAddon);
+  Assert.equal(addon.id, newAddon.id);
+  Assert.equal(syncGUID, newAddon.syncGUID);
 
-      AddonManager.getAddonBySyncGUID("DOES_NOT_EXIST", function(missing) {
-        Assert.equal(undefined, missing);
+  let missing = await AddonManager.getAddonBySyncGUID("DOES_NOT_EXIST");
+  Assert.equal(undefined, missing);
 
-        run_next_test();
-      });
-    });
-  });
+  run_next_test();
 });
--- a/toolkit/mozapps/extensions/test/xpcshell/test_update_compatmode.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_update_compatmode.js
@@ -78,106 +78,102 @@ function run_test() {
 }
 
 function end_test() {
   do_test_finished();
 }
 
 
 // Strict compatibility checking disabled.
-function run_test_1() {
+async function run_test_1() {
   info("Testing with strict compatibility checking disabled");
   Services.prefs.setBoolPref(PREF_EM_STRICT_COMPATIBILITY, false);
-  AddonManager.getAddonByID("compatmode-normal@tests.mozilla.org", function(addon) {
-    Assert.notEqual(addon, null);
-    addon.findUpdates({
-      onCompatibilityUpdateAvailable() {
-        do_throw("Should have not have seen compatibility information");
-      },
+  let addon = await AddonManager.getAddonByID("compatmode-normal@tests.mozilla.org");
+  Assert.notEqual(addon, null);
+  addon.findUpdates({
+    onCompatibilityUpdateAvailable() {
+      do_throw("Should have not have seen compatibility information");
+    },
 
-      onNoUpdateAvailable() {
-        do_throw("Should have seen an available update");
-      },
+    onNoUpdateAvailable() {
+      do_throw("Should have seen an available update");
+    },
 
-      onUpdateAvailable(unused, install) {
-        Assert.equal(install.version, "2.0");
-      },
+    onUpdateAvailable(unused, install) {
+      Assert.equal(install.version, "2.0");
+    },
 
-      onUpdateFinished() {
-        run_test_2();
-      }
-    }, AddonManager.UPDATE_WHEN_USER_REQUESTED);
-  });
+    onUpdateFinished() {
+      run_test_2();
+    }
+  }, AddonManager.UPDATE_WHEN_USER_REQUESTED);
 }
 
 // Strict compatibility checking enabled.
-function run_test_2() {
+async function run_test_2() {
   info("Testing with strict compatibility checking enabled");
   Services.prefs.setBoolPref(PREF_EM_STRICT_COMPATIBILITY, true);
-  AddonManager.getAddonByID("compatmode-strict@tests.mozilla.org", function(addon) {
-    Assert.notEqual(addon, null);
-    addon.findUpdates({
-      onCompatibilityUpdateAvailable() {
-        do_throw("Should have not have seen compatibility information");
-      },
+  let addon = await AddonManager.getAddonByID("compatmode-strict@tests.mozilla.org");
+  Assert.notEqual(addon, null);
+  addon.findUpdates({
+    onCompatibilityUpdateAvailable() {
+      do_throw("Should have not have seen compatibility information");
+    },
 
-      onNoUpdateAvailable() {
-        do_throw("Should have seen an available update");
-      },
+    onNoUpdateAvailable() {
+      do_throw("Should have seen an available update");
+    },
 
-      onUpdateAvailable(unused, install) {
-        Assert.equal(install.version, "2.0");
-      },
+    onUpdateAvailable(unused, install) {
+      Assert.equal(install.version, "2.0");
+    },
 
-      onUpdateFinished() {
-        run_test_3();
-      }
-    }, AddonManager.UPDATE_WHEN_USER_REQUESTED);
-  });
+    onUpdateFinished() {
+      run_test_3();
+    }
+  }, AddonManager.UPDATE_WHEN_USER_REQUESTED);
 }
 
 // Strict compatibility checking opt-in.
-function run_test_3() {
+async function run_test_3() {
   info("Testing with strict compatibility disabled, but addon opt-in");
   Services.prefs.setBoolPref(PREF_EM_STRICT_COMPATIBILITY, false);
-  AddonManager.getAddonByID("compatmode-strict-optin@tests.mozilla.org", function(addon) {
-    Assert.notEqual(addon, null);
-    addon.findUpdates({
-      onCompatibilityUpdateAvailable() {
-        do_throw("Should have not have seen compatibility information");
-      },
+  let addon = await AddonManager.getAddonByID("compatmode-strict-optin@tests.mozilla.org");
+  Assert.notEqual(addon, null);
+  addon.findUpdates({
+    onCompatibilityUpdateAvailable() {
+      do_throw("Should have not have seen compatibility information");
+    },
 
-      onUpdateAvailable() {
-        do_throw("Should not have seen an available update");
-      },
+    onUpdateAvailable() {
+      do_throw("Should not have seen an available update");
+    },
 
-      onUpdateFinished() {
-        run_test_4();
-      }
-    }, AddonManager.UPDATE_WHEN_USER_REQUESTED);
-  });
+    onUpdateFinished() {
+      run_test_4();
+    }
+  }, AddonManager.UPDATE_WHEN_USER_REQUESTED);
 }
 
 // Compatibility checking disabled.
-function run_test_4() {
+async function run_test_4() {
   info("Testing with all compatibility checking disabled");
   AddonManager.checkCompatibility = false;
-  AddonManager.getAddonByID("compatmode-ignore@tests.mozilla.org", function(addon) {
-    Assert.notEqual(addon, null);
-    addon.findUpdates({
-      onCompatibilityUpdateAvailable() {
-        do_throw("Should have not have seen compatibility information");
-      },
-
-      onNoUpdateAvailable() {
-        do_throw("Should have seen an available update");
-      },
+  let addon = await AddonManager.getAddonByID("compatmode-ignore@tests.mozilla.org");
+  Assert.notEqual(addon, null);
+  addon.findUpdates({
+    onCompatibilityUpdateAvailable() {
+      do_throw("Should have not have seen compatibility information");
+    },
 
-      onUpdateAvailable(unused, install) {
-        Assert.equal(install.version, "2.0");
-      },
+    onNoUpdateAvailable() {
+      do_throw("Should have seen an available update");
+    },
 
-      onUpdateFinished() {
-        end_test();
-      }
-    }, AddonManager.UPDATE_WHEN_USER_REQUESTED);
-  });
+    onUpdateAvailable(unused, install) {
+      Assert.equal(install.version, "2.0");
+    },
+
+    onUpdateFinished() {
+      end_test();
+    }
+  }, AddonManager.UPDATE_WHEN_USER_REQUESTED);
 }
--- a/toolkit/mozapps/extensions/test/xpcshell/test_update_ignorecompat.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_update_ignorecompat.js
@@ -58,41 +58,40 @@ add_test(function() {
                              `http://example.com/data/test_update_compat.json`);
   Services.prefs.setBoolPref(PREF_GETADDONS_CACHE_ENABLED, true);
 
   AddonManagerInternal.backgroundUpdateCheck();
 });
 
 // Test that the update check correctly observes when an addon opts-in to
 // strict compatibility checking.
-add_test(function() {
+add_test(async function() {
   writeInstallRDFForExtension({
     id: "addon11@tests.mozilla.org",
     version: "1.0",
     updateURL: "http://example.com/data/" + updateFile,
     targetApplications: [{
       id: appId,
       minVersion: "0.1",
       maxVersion: "0.2"
     }],
     name: "Test Addon 11",
   }, profileDir);
 
   restartManager();
 
-  AddonManager.getAddonByID("addon11@tests.mozilla.org", function(a11) {
-    Assert.notEqual(a11, null);
+  let a11 = await AddonManager.getAddonByID("addon11@tests.mozilla.org");
+  Assert.notEqual(a11, null);
 
-    a11.findUpdates({
-      onCompatibilityUpdateAvailable() {
-        do_throw("Should not have seen compatibility information");
-      },
+  a11.findUpdates({
+    onCompatibilityUpdateAvailable() {
+      do_throw("Should not have seen compatibility information");
+    },
 
-      onUpdateAvailable() {
-        do_throw("Should not have seen an available update");
-      },
+    onUpdateAvailable() {
+      do_throw("Should not have seen an available update");
+    },
 
-      onUpdateFinished() {
-        run_next_test();
-      }
-    }, AddonManager.UPDATE_WHEN_USER_REQUESTED);
-  });
+    onUpdateFinished() {
+      run_next_test();
+    }
+  }, AddonManager.UPDATE_WHEN_USER_REQUESTED);
 });
--- a/toolkit/mozapps/extensions/test/xpcshell/test_upgrade.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_upgrade.js
@@ -98,37 +98,34 @@ function end_test() {
   }
   executeSoon(do_test_finished);
 }
 
 // Test that the test extensions are all installed
 async function run_test_1() {
   await promiseStartupManager();
 
-  AddonManager.getAddonsByIDs(["addon1@tests.mozilla.org",
-                               "addon2@tests.mozilla.org",
-                               "addon3@tests.mozilla.org",
-                               "addon4@tests.mozilla.org"],
-                               function([a1, a2, a3, a4]) {
-
-    Assert.notEqual(a1, null);
-    Assert.ok(isExtensionInBootstrappedList(profileDir, a1.id));
+  let [a1, a2, a3, a4] = await AddonManager.getAddonsByIDs(["addon1@tests.mozilla.org",
+                                                            "addon2@tests.mozilla.org",
+                                                            "addon3@tests.mozilla.org",
+                                                            "addon4@tests.mozilla.org"]);
+  Assert.notEqual(a1, null);
+  Assert.ok(isExtensionInBootstrappedList(profileDir, a1.id));
 
-    Assert.notEqual(a2, null);
-    Assert.ok(isExtensionInBootstrappedList(profileDir, a2.id));
+  Assert.notEqual(a2, null);
+  Assert.ok(isExtensionInBootstrappedList(profileDir, a2.id));
 
-    Assert.notEqual(a3, null);
-    Assert.ok(!isExtensionInBootstrappedList(profileDir, a3.id));
+  Assert.notEqual(a3, null);
+  Assert.ok(!isExtensionInBootstrappedList(profileDir, a3.id));
 
-    Assert.notEqual(a4, null);
-    Assert.ok(isExtensionInBootstrappedList(globalDir, a4.id));
-    Assert.equal(a4.version, "1.0");
+  Assert.notEqual(a4, null);
+  Assert.ok(isExtensionInBootstrappedList(globalDir, a4.id));
+  Assert.equal(a4.version, "1.0");
 
-    executeSoon(run_test_2);
-  });
+  executeSoon(run_test_2);
 }
 
 // Test that upgrading the application doesn't disable now incompatible add-ons
 async function run_test_2() {
   // Upgrade the extension
   var dest = writeInstallRDFForExtension({
     id: "addon4@tests.mozilla.org",
     version: "2.0",
@@ -138,41 +135,38 @@ async function run_test_2() {
       minVersion: "2",
       maxVersion: "2"
     }],
     name: "Test Addon 4",
   }, globalDir);
   setExtensionModifiedTime(dest, gInstallTime);
 
   await promiseRestartManager("2");
-  AddonManager.getAddonsByIDs(["addon1@tests.mozilla.org",
-                               "addon2@tests.mozilla.org",
-                               "addon3@tests.mozilla.org",
-                               "addon4@tests.mozilla.org"],
-                               function([a1, a2, a3, a4]) {
-
-    Assert.notEqual(a1, null);
-    Assert.ok(isExtensionInBootstrappedList(profileDir, a1.id));
+  let [a1, a2, a3, a4] = await AddonManager.getAddonsByIDs(["addon1@tests.mozilla.org",
+                                                            "addon2@tests.mozilla.org",
+                                                            "addon3@tests.mozilla.org",
+                                                            "addon4@tests.mozilla.org"]);
+  Assert.notEqual(a1, null);
+  Assert.ok(isExtensionInBootstrappedList(profileDir, a1.id));
 
-    Assert.notEqual(a2, null);
-    Assert.ok(isExtensionInBootstrappedList(profileDir, a2.id));
+  Assert.notEqual(a2, null);
+  Assert.ok(isExtensionInBootstrappedList(profileDir, a2.id));
 
-    Assert.notEqual(a3, null);
-    Assert.ok(isExtensionInBootstrappedList(profileDir, a3.id));
+  Assert.notEqual(a3, null);
+  Assert.ok(isExtensionInBootstrappedList(profileDir, a3.id));
 
-    Assert.notEqual(a4, null);
-    Assert.ok(isExtensionInBootstrappedList(globalDir, a4.id));
-    Assert.equal(a4.version, "2.0");
+  Assert.notEqual(a4, null);
+  Assert.ok(isExtensionInBootstrappedList(globalDir, a4.id));
+  Assert.equal(a4.version, "2.0");
 
-    executeSoon(run_test_3);
-  });
+  executeSoon(run_test_3);
 }
 
 // Test that nothing changes when only the build ID changes.
-function run_test_3() {
+async function run_test_3() {
   // Upgrade the extension
   var dest = writeInstallRDFForExtension({
     id: "addon4@tests.mozilla.org",
     version: "3.0",
     bootstrap: true,
     targetApplications: [{
       id: "xpcshell@tests.mozilla.org",
       minVersion: "3",
@@ -182,32 +176,29 @@ function run_test_3() {
   }, globalDir);
   setExtensionModifiedTime(dest, gInstallTime);
 
   // Simulates a simple Build ID change, the platform deletes extensions.ini
   // whenever the application is changed.
   gAddonStartup.remove(true);
   restartManager();
 
-  AddonManager.getAddonsByIDs(["addon1@tests.mozilla.org",
-                               "addon2@tests.mozilla.org",
-                               "addon3@tests.mozilla.org",
-                               "addon4@tests.mozilla.org"],
-                               function([a1, a2, a3, a4]) {
+  let [a1, a2, a3, a4] = await AddonManager.getAddonsByIDs(["addon1@tests.mozilla.org",
+                                                            "addon2@tests.mozilla.org",
+                                                            "addon3@tests.mozilla.org",
+                                                            "addon4@tests.mozilla.org"]);
+  Assert.notEqual(a1, null);
+  Assert.ok(isExtensionInBootstrappedList(profileDir, a1.id));
 
-    Assert.notEqual(a1, null);
-    Assert.ok(isExtensionInBootstrappedList(profileDir, a1.id));
-
-    Assert.notEqual(a2, null);
-    Assert.ok(isExtensionInBootstrappedList(profileDir, a2.id));
+  Assert.notEqual(a2, null);
+  Assert.ok(isExtensionInBootstrappedList(profileDir, a2.id));
 
-    Assert.notEqual(a3, null);
-    Assert.ok(isExtensionInBootstrappedList(profileDir, a3.id));
+  Assert.notEqual(a3, null);
+  Assert.ok(isExtensionInBootstrappedList(profileDir, a3.id));
 
-    Assert.notEqual(a4, null);
-    Assert.ok(isExtensionInBootstrappedList(globalDir, a4.id));
-    Assert.equal(a4.version, "2.0");
+  Assert.notEqual(a4, null);
+  Assert.ok(isExtensionInBootstrappedList(globalDir, a4.id));
+  Assert.equal(a4.version, "2.0");
 
-    shutdownManager();
+  shutdownManager();
 
-    end_test();
-  });
+  end_test();
 }
--- 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,24 +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(resolve => {
-    AddonManager.getAddonByID("restartless-xpi@tests.mozilla.org", result => {
-      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
@@ -491,21 +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(resolve => {
-    AddonManager.getAddonByID("restartless-xpi@tests.mozilla.org", function(result) {
-      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"]
@@ -544,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);
@@ -580,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();
 },
 
@@ -606,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();
 },
 
@@ -659,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);
@@ -708,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);
@@ -782,24 +768,23 @@ add_task(async function() {
   Services.prefs.setBoolPref("extensions.strictCompatibility", true);
   Services.prefs.setBoolPref("extensions.install.requireSecureOrigin", false);
   Services.prefs.setIntPref("security.dialog_enable_delay", 0);
 
   Services.obs.addObserver(XPInstallObserver, "addon-install-started");
   Services.obs.addObserver(XPInstallObserver, "addon-install-blocked");
   Services.obs.addObserver(XPInstallObserver, "addon-install-failed");
 
-  registerCleanupFunction(function() {
+  registerCleanupFunction(async function() {
     // Make sure no more test parts run in case we were timed out
     TESTS = [];
 
-    AddonManager.getAllInstalls(function(aInstalls) {
-      aInstalls.forEach(function(aInstall) {
-        aInstall.cancel();
-      });
+    let aInstalls = await AddonManager.getAllInstalls();
+    aInstalls.forEach(function(aInstall) {
+      aInstall.cancel();
     });
 
     Services.prefs.clearUserPref("extensions.logging.enabled");
     Services.prefs.clearUserPref("extensions.strictCompatibility");
     Services.prefs.clearUserPref("extensions.install.requireSecureOrigin");
     Services.prefs.clearUserPref("security.dialog_enable_delay");
 
     Services.obs.removeObserver(XPInstallObserver, "addon-install-started");
@@ -808,20 +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(resolve => {
-      AddonManager.getAllInstalls(function(aInstalls) {
-        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]();
   }
 });
--- a/toolkit/mozapps/extensions/test/xpinstall/head.js
+++ b/toolkit/mozapps/extensions/test/xpinstall/head.js
@@ -117,39 +117,38 @@ var Harness = {
 
       AddonManager.addInstallListener(this);
 
       Services.wm.addListener(this);
 
       window.addEventListener("popupshown", this);
 
       var self = this;
-      registerCleanupFunction(function() {
+      registerCleanupFunction(async function() {
         Services.prefs.clearUserPref(PREF_LOGGING_ENABLED);
         Services.prefs.clearUserPref(PREF_INSTALL_REQUIRESECUREORIGIN);
         Services.obs.removeObserver(self, "addon-install-started");
         Services.obs.removeObserver(self, "addon-install-disabled");
         // Services.obs.removeObserver(self, "addon-install-cancelled");
         Services.obs.removeObserver(self, "addon-install-origin-blocked");
         Services.obs.removeObserver(self, "addon-install-blocked");
         Services.obs.removeObserver(self, "addon-install-failed");
         Services.obs.removeObserver(self, "addon-install-complete");
 
         AddonManager.removeInstallListener(self);
 
         Services.wm.removeListener(self);
 
         window.removeEventListener("popupshown", self);
 
-        AddonManager.getAllInstalls(function(aInstalls) {
-          is(aInstalls.length, 0, "Should be no active installs at the end of the test");
-          aInstalls.forEach(function(aInstall) {
-            info("Install for " + aInstall.sourceURI + " is in state " + aInstall.state);
-            aInstall.cancel();
-          });
+        let aInstalls = await AddonManager.getAllInstalls();
+        is(aInstalls.length, 0, "Should be no active installs at the end of the test");
+        aInstalls.forEach(function(aInstall) {
+          info("Install for " + aInstall.sourceURI + " is in state " + aInstall.state);
+          aInstall.cancel();
         });
       });
     }
 
     this.installCount = 0;
     this.pendingCount = 0;
     this.runningInstalls = [];
   },