Bug 1252181 - switch browser_ext_runtime_setUninstallURL.js to temporary add-on install r=mossop

MozReview-Commit-ID: JjjR76gkI3M

--HG--
extra : rebase_source : 64e37359e838eafe4ad2a138660f5bcf392fac2a
This commit is contained in:
Andrew Swan 2016-02-29 11:11:45 -08:00
parent a2c5bde688
commit 6bf77c377d
2 changed files with 5 additions and 15 deletions

View File

@ -3,18 +3,6 @@
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() + ")()",
@ -26,9 +14,9 @@ function* makeAndInstallXPI(id, backgroundScript, loadedURL) {
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

View File

@ -3876,6 +3876,8 @@ this.XPIProvider = {
oldAddon ? oldAddon.wrapper : null,
false);
AddonManagerPrivate.callAddonListeners("onInstalled", addon.wrapper);
return addon.wrapper;
}),
/**