mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-16 23:05:42 +00:00
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:
parent
a2c5bde688
commit
6bf77c377d
@ -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
|
||||
|
@ -3876,6 +3876,8 @@ this.XPIProvider = {
|
||||
oldAddon ? oldAddon.wrapper : null,
|
||||
false);
|
||||
AddonManagerPrivate.callAddonListeners("onInstalled", addon.wrapper);
|
||||
|
||||
return addon.wrapper;
|
||||
}),
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user