Bug 1252181 - switch browser_ext_runtime_setUninstallURL.js to temporary add-on install r=mossop
authorAndrew Swan <aswan@mozilla.com>
Mon, 29 Feb 2016 11:11:45 -0800
changeset 286145 90cef80ab3099df78dca2d48f55fb6bd23db7eaf
parent 286144 195d3130e0bfce13404d16e241373ffde7453854
child 286146 c740c50ee694083a430e98faa37f864b5a539f24
push id30039
push usercbook@mozilla.com
push dateTue, 01 Mar 2016 11:02:11 +0000
treeherdermozilla-central@5cafa6f3019b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmossop
bugs1252181
milestone47.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 1252181 - switch browser_ext_runtime_setUninstallURL.js to temporary add-on install r=mossop MozReview-Commit-ID: JjjR76gkI3M
browser/components/extensions/test/browser/browser_ext_runtime_setUninstallURL.js
toolkit/mozapps/extensions/internal/XPIProvider.jsm
--- a/browser/components/extensions/test/browser/browser_ext_runtime_setUninstallURL.js
+++ b/browser/components/extensions/test/browser/browser_ext_runtime_setUninstallURL.js
@@ -1,39 +1,27 @@
 "use strict";
 
 let {AddonManager} = Components.utils.import("resource://gre/modules/AddonManager.jsm", {});
 let {Extension} = Components.utils.import("resource://gre/modules/Extension.jsm", {});
 
-function install(url) {
-  return new Promise((resolve, reject) => {
-    AddonManager.getInstallForURL(url, (install) => {
-      install.addListener({
-        onInstallEnded: (i, addon) => resolve(addon),
-        onInstallFailed: () => reject(),
-      });
-      install.install();
-    }, "application/x-xpinstall");
-  });
-}
-
 function* makeAndInstallXPI(id, backgroundScript, loadedURL) {
   let xpi = Extension.generateXPI(id, {
     background: "(" + backgroundScript.toString() + ")()",
   });
   SimpleTest.registerCleanupFunction(function cleanupXPI() {
     Services.obs.notifyObservers(xpi, "flush-cache-entry", null);
     xpi.remove(false);
   });
 
   let loadPromise = BrowserTestUtils.waitForNewTab(gBrowser, loadedURL);
 
-  let fileURI = Services.io.newFileURI(xpi);
-  info(`installing ${fileURI.spec}`);
-  let addon = yield install(fileURI.spec);
+
+  info(`installing ${xpi.path}`);
+  let addon = yield AddonManager.installTemporaryAddon(xpi);
   info("installed");
 
   // A WebExtension is started asynchronously, we have our test extension
   // open a new tab to signal that the background script has executed.
   let loadTab = yield loadPromise;
   yield BrowserTestUtils.removeTab(loadTab);
 
   return addon;
--- a/toolkit/mozapps/extensions/internal/XPIProvider.jsm
+++ b/toolkit/mozapps/extensions/internal/XPIProvider.jsm
@@ -3871,16 +3871,18 @@ this.XPIProvider = {
                                            false);
     XPIProvider.callBootstrapMethod(addon, file, "startup",
                                     BOOTSTRAP_REASONS.ADDON_ENABLE);
     AddonManagerPrivate.callInstallListeners("onExternalInstall",
                                              null, addon.wrapper,
                                              oldAddon ? oldAddon.wrapper : null,
                                              false);
     AddonManagerPrivate.callAddonListeners("onInstalled", addon.wrapper);
+
+    return addon.wrapper;
   }),
 
   /**
    * Returns an Addon corresponding to an instance ID.
    * @param aInstanceID
    *        An Addon Instance ID
    * @return {Promise}
    * @resolves The found Addon or null if no such add-on exists.