--- a/browser/base/content/browser.js
+++ b/browser/base/content/browser.js
@@ -969,17 +969,17 @@ 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, null, mimeType).then(install => {
+ AddonManager.getInstallForURL(aUri.spec, mimeType).then(install => {
AddonManager.installAddonFromWebpage(mimeType, aBrowser, systemPrincipal,
install);
});
return true;
}
} catch (e) {
return false;
}
--- a/browser/base/content/test/general/browser_bug592338.js
+++ b/browser/base/content/test/general/browser_bug592338.js
@@ -98,17 +98,17 @@ async function runNextTest() {
TESTS.shift()();
}
async function test() {
waitForExplicitFinish();
Services.prefs.setBoolPref("extensions.logging.enabled", true);
- let aInstall = await AddonManager.getInstallForURL(TESTROOT + "theme.xpi", null, "application/x-xpinstall");
+ let aInstall = await AddonManager.getInstallForURL(TESTROOT + "theme.xpi", "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();
}
});
--- a/browser/base/content/test/webextensions/head.js
+++ b/browser/base/content/test/webextensions/head.js
@@ -68,17 +68,17 @@ function promiseInstallEvent(addon, even
* @param {string} url
* URL of the .xpi file to install
*
* @returns {Promise}
* Resolves when the extension has been installed with the Addon
* object as the resolution value.
*/
async function promiseInstallAddon(url) {
- let install = await AddonManager.getInstallForURL(url, null, "application/x-xpinstall");
+ let install = await AddonManager.getInstallForURL(url, "application/x-xpinstall");
install.install();
let addon = await new Promise(resolve => {
install.addListener({
onInstallEnded(_install, _addon) {
resolve(_addon);
},
});
--- a/browser/components/enterprisepolicies/Policies.jsm
+++ b/browser/components/enterprisepolicies/Policies.jsm
@@ -409,17 +409,17 @@ var Policies = {
try {
xpiFile.initWithPath(location);
} catch (e) {
log.error(`Invalid extension path location - ${location}`);
continue;
}
url = Services.io.newFileURI(xpiFile).spec;
}
- AddonManager.getInstallForURL(url, null, "application/x-xpinstall").then(install => {
+ AddonManager.getInstallForURL(url, "application/x-xpinstall").then(install => {
if (install.addon && install.addon.appDisabled) {
log.error(`Incompatible add-on - ${location}`);
install.cancel();
return;
}
let listener = {
/* eslint-disable-next-line no-shadow */
onDownloadEnded: (install) => {
--- a/devtools/client/webide/modules/addons.js
+++ b/devtools/client/webide/modules/addons.js
@@ -76,17 +76,17 @@ Addon.prototype = {
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");
+ let install = await AddonManager.getInstallForURL(this.xpiLink, "application/x-xpinstall");
install.addListener(this);
install.install();
}
},
uninstall: async function() {
let addon = await AddonManager.getAddonByID(this.addonID);
addon.uninstall();
--- a/services/sync/modules/addonutils.js
+++ b/services/sync/modules/addonutils.js
@@ -33,23 +33,17 @@ AddonUtilsInternal.prototype = {
this._log.debug("Obtaining install for " + addon.id);
// We should theoretically be able to obtain (and use) addon.install if
// it is available. However, the addon.sourceURI rewriting won't be
// reflected in the AddonInstall, so we can't use it. If we ever get rid
// of sourceURI rewriting, we can avoid having to reconstruct the
// AddonInstall.
return AddonManager.getInstallForURL(
- addon.sourceURI.spec,
- null,
- "application/x-xpinstall",
- undefined,
- addon.name,
- addon.iconURL,
- addon.version
+ addon.sourceURI.spec, "application/x-xpinstall", undefined, addon.name, addon.iconURL, addon.version
);
},
/**
* Installs an add-on from an AddonSearchResult instance.
*
* The options argument defines extra options to control the install.
* Recognized keys in this map are:
--- a/toolkit/components/normandy/lib/Addons.jsm
+++ b/toolkit/components/normandy/lib/Addons.jsm
@@ -57,17 +57,17 @@ var Addons = {
* @async
* @returns {string}
* Add-on ID that was installed
* @throws {string}
* If the add-on can not be installed, or overwriting is disabled and an
* add-on with a matching ID is already installed.
*/
async install(addonUrl, options) {
- const installObj = await AddonManager.getInstallForURL(addonUrl, null, "application/x-xpinstall");
+ const installObj = await AddonManager.getInstallForURL(addonUrl, "application/x-xpinstall");
return this.applyInstall(installObj, options);
},
async applyInstall(addonInstall, {update = false} = {}) {
const result = new Promise((resolve, reject) => addonInstall.addListener({
onInstallStarted(cbInstall) {
if (cbInstall.existingAddon && !update) {
reject(new Error(`
--- a/toolkit/mozapps/extensions/addonManager.js
+++ b/toolkit/mozapps/extensions/addonManager.js
@@ -73,17 +73,17 @@ amManager.prototype = {
installAddonFromWebpage(aMimetype, aBrowser, aInstallingPrincipal,
aUri, aHash, aName, aIcon, aCallback) {
let retval = true;
if (!AddonManager.isInstallAllowed(aMimetype, aInstallingPrincipal)) {
aCallback = null;
retval = false;
}
- AddonManager.getInstallForURL(aUri, null, aMimetype, aHash, aName, aIcon, null, aBrowser).then(aInstall => {
+ AddonManager.getInstallForURL(aUri, aMimetype, aHash, aName, aIcon, null, aBrowser).then(aInstall => {
function callCallback(uri, status) {
try {
aCallback.onInstallEnded(uri, status);
} catch (e) {
Cu.reportError(e);
}
}
--- a/toolkit/mozapps/extensions/content/extensions.js
+++ b/toolkit/mozapps/extensions/content/extensions.js
@@ -3470,17 +3470,17 @@ var gDragDrop = {
} else {
let file = dataTransfer.mozGetDataAt("application/x-moz-file", i);
if (file) {
url = Services.io.newFileURI(file).spec;
}
}
if (url) {
- let install = await AddonManager.getInstallForURL(url, null, "application/x-xpinstall");
+ let install = await AddonManager.getInstallForURL(url, "application/x-xpinstall");
AddonManager.installAddonFromAOM(browser, document.documentURIObject, install);
}
}
}
};
// 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
--- a/toolkit/mozapps/extensions/test/AddonManagerTesting.jsm
+++ b/toolkit/mozapps/extensions/test/AddonManagerTesting.jsm
@@ -84,17 +84,17 @@ var AddonManagerTesting = {
/**
* Install an XPI add-on from a URL.
*
* @return Promise<addon>
*/
installXPIFromURL(url, hash, name, iconURL, version) {
return new Promise(async (resolve, reject) => {
- let install = await AddonManager.getInstallForURL(url, null, "application/x-xpinstall", hash, name, iconURL, version);
+ let install = await AddonManager.getInstallForURL(url, "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) {
--- a/toolkit/mozapps/extensions/test/browser/browser_bug596336.js
+++ b/toolkit/mozapps/extensions/test/browser/browser_bug596336.js
@@ -22,17 +22,17 @@ function get_node(parent, anonid) {
}
function get_class_node(parent, cls) {
return parent.ownerDocument.getAnonymousElementByAttribute(parent, "class", cls);
}
function install_addon(aXpi) {
return new Promise(async resolve => {
- let aInstall = await AddonManager.getInstallForURL(TESTROOT + "addons/" + aXpi + ".xpi", null, "application/x-xpinstall");
+ let aInstall = await AddonManager.getInstallForURL(TESTROOT + "addons/" + aXpi + ".xpi", "application/x-xpinstall");
aInstall.addListener({
onInstallEnded(aInstall) {
resolve();
}
});
aInstall.install();
});
}
--- a/toolkit/mozapps/extensions/test/browser/browser_installssl.js
+++ b/toolkit/mozapps/extensions/test/browser/browser_installssl.js
@@ -75,17 +75,17 @@ 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;
}
- let install = await AddonManager.getInstallForURL(url, null, "application/x-xpinstall");
+ let install = await AddonManager.getInstallForURL(url, "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;
--- a/toolkit/mozapps/extensions/test/browser/browser_update.js
+++ b/toolkit/mozapps/extensions/test/browser/browser_update.js
@@ -13,29 +13,29 @@ function test() {
["xpinstall.signatures.required", false]
]});
run_next_test();
}
// Install a first version
add_test(async function() {
- let aInstall = await AddonManager.getInstallForURL(TESTROOT + "addons/browser_update1_1.xpi", null, "application/x-xpinstall");
+ let aInstall = await AddonManager.getInstallForURL(TESTROOT + "addons/browser_update1_1.xpi", "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(async function() {
- let aInstall = await AddonManager.getInstallForURL(TESTROOT + "addons/browser_update1_2.xpi", null, "application/x-xpinstall");
+ let aInstall = await AddonManager.getInstallForURL(TESTROOT + "addons/browser_update1_2.xpi", "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();
});
});
--- a/toolkit/mozapps/extensions/test/browser/head.js
+++ b/toolkit/mozapps/extensions/test/browser/head.js
@@ -519,17 +519,17 @@ 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(async (resolve, reject) => {
- let install = await AddonManager.getInstallForURL(pathPrefix + path, null, "application/x-xpinstall");
+ let install = await AddonManager.getInstallForURL(pathPrefix + path, "application/x-xpinstall");
install.addListener({
onInstallEnded: () => resolve(install.addon),
});
install.install();
});
return log_callback(p, cb);
--- a/toolkit/mozapps/extensions/test/mochitest/test_bug687194.html
+++ b/toolkit/mozapps/extensions/test/mochitest/test_bug687194.html
@@ -54,17 +54,17 @@
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";
- let install = await AddonManager.getInstallForURL(INSTALL_URI, null, "application/x-xpinstall");
+ let install = await AddonManager.getInstallForURL(INSTALL_URI, "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();
--- a/toolkit/mozapps/extensions/test/xpcshell/test_AddonRepository.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_AddonRepository.js
@@ -180,25 +180,22 @@ add_task(async function setup() {
await promiseStartupManager();
// Install an add-on so can check that it isn't returned in the results
await promiseInstallFile(xpis[0]);
await promiseRestartManager();
// Create an active AddonInstall so can check that it isn't returned in the results
- let install = await AddonManager.getInstallForURL(BASE_URL + INSTALL_URL2,
- undefined,
- "application/x-xpinstall");
+ let install = await AddonManager.getInstallForURL(BASE_URL + INSTALL_URL2, "application/x-xpinstall");
let promise = promiseCompleteInstall(install);
registerCleanupFunction(() => promise);
// Create a non-active AddonInstall so can check that it is returned in the results
- await AddonManager.getInstallForURL(BASE_URL + INSTALL_URL3,
- undefined, "application/x-xpinstall");
+ await AddonManager.getInstallForURL(BASE_URL + INSTALL_URL3, "application/x-xpinstall");
});
// Tests homepageURL and getSearchURL()
add_task(async function test_1() {
function check_urls(aPreference, aGetURL, aTests) {
aTests.forEach(function(aTest) {
Services.prefs.setCharPref(aPreference, aTest.preferenceValue);
Assert.equal(aGetURL(aTest), aTest.expectedURL);
--- a/toolkit/mozapps/extensions/test/xpcshell/test_blocklistchange.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_blocklistchange.js
@@ -624,18 +624,17 @@ function Pbackground_update() {
}
// Manually updates the test add-ons to the given version
function Pmanual_update(aVersion) {
let Pinstalls = [];
for (let name of ["soft1", "soft2", "soft3", "soft4", "hard1", "regexp1"]) {
Pinstalls.push(
AddonManager.getInstallForURL(
- `http://example.com/addons/blocklist_${name}_${aVersion}.xpi`,
- null, "application/x-xpinstall"));
+ `http://example.com/addons/blocklist_${name}_${aVersion}.xpi`, "application/x-xpinstall"));
}
return Promise.all(Pinstalls).then(installs => {
let completePromises = [];
for (let install of installs) {
completePromises.push(new Promise(resolve => {
install.addListener({
onDownloadCancelled: resolve,
--- a/toolkit/mozapps/extensions/test/xpcshell/test_bootstrap.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_bootstrap.js
@@ -1129,17 +1129,17 @@ add_task(async function test_22() {
// Tests that installing from a URL doesn't require a restart
add_task(async function test_23() {
prepare_test({}, [
"onNewInstall"
]);
let url = "http://example.com/addons/test_bootstrap1_1.xpi";
- let install = await AddonManager.getInstallForURL(url, null, "application/x-xpinstall");
+ let install = await AddonManager.getInstallForURL(url, "application/x-xpinstall");
ensure_test_completed();
notEqual(install, null);
await new Promise(resolve => {
prepare_test({}, [
"onDownloadStarted",
--- a/toolkit/mozapps/extensions/test/xpcshell/test_dictionary.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_dictionary.js
@@ -416,18 +416,17 @@ add_task(async function test_17() {
// Tests that installing from a URL doesn't require a restart
add_task(async function test_23() {
prepare_test({ }, [
"onNewInstall"
]);
let url = "http://example.com/addons/test_dictionary.xpi";
- let install = await AddonManager.getInstallForURL(url, null,
- "application/x-xpinstall");
+ let install = await AddonManager.getInstallForURL(url, "application/x-xpinstall");
ensure_test_completed();
notEqual(install, null);
await new Promise(resolve => {
prepare_test({ }, [
"onDownloadStarted",
"onDownloadEnded"
--- a/toolkit/mozapps/extensions/test/xpcshell/test_error.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_error.js
@@ -48,17 +48,17 @@ async function run_test_3() {
Assert.equal(install.error, AddonManager.ERROR_CORRUPT_FILE);
run_test_4();
}
// Checks that a file that doesn't match its hash shows an error
async function run_test_4() {
let url = Services.io.newFileURI(do_get_file("data/unsigned.xpi")).spec;
- let install = await AddonManager.getInstallForURL(url, null, "application/x-xpinstall", "sha1:foo");
+ let install = await AddonManager.getInstallForURL(url, "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();
}
// Checks that a file that doesn't exist shows an error
--- a/toolkit/mozapps/extensions/test/xpcshell/test_filepointer.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_filepointer.js
@@ -121,17 +121,17 @@ add_task(async function test_addon_over_
minVersion: "1",
maxVersion: "1"}],
},
});
testserver.registerFile("/addons/test_filepointer.xpi", xpi);
let url = "http://example.com/addons/test_filepointer.xpi";
- let install = await AddonManager.getInstallForURL(url, undefined, "application/x-xpinstall");
+ let install = await AddonManager.getInstallForURL(url, "application/x-xpinstall");
await new Promise(resolve => {
ensure_test_completed();
prepare_test({
"addon1@tests.mozilla.org": [
["onInstalling", false],
["onInstalled", false],
]
--- a/toolkit/mozapps/extensions/test/xpcshell/test_install.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_install.js
@@ -282,17 +282,17 @@ add_task(async function test_1() {
let { id, version } = a1;
await promiseRestartManager();
do_check_not_in_crash_annotation(id, version);
});
// Tests that an install from a url downloads.
add_task(async function test_2() {
let url = "http://example.com/addons/test_install2_1.xpi";
- let install = await AddonManager.getInstallForURL(url, null, "application/x-xpinstall", null, "Test 2", null, "1.0");
+ let install = await AddonManager.getInstallForURL(url, "application/x-xpinstall", null, "Test 2", null, "1.0");
checkInstall(install, {
version: "1.0",
name: "Test 2",
state: AddonManager.STATE_AVAILABLE,
iconURL: null,
sourceURI: Services.io.newURI(url),
});
@@ -378,17 +378,17 @@ add_task(async function test_2() {
// Tests that installing a new version of an existing add-on works
add_task(async function test_4() {
prepare_test({ }, [
"onNewInstall"
]);
let url = "http://example.com/addons/test_install2_2.xpi";
- let install = await AddonManager.getInstallForURL(url, null, "application/x-xpinstall", null, "Test 3", null, "3.0");
+ let install = await AddonManager.getInstallForURL(url, "application/x-xpinstall", null, "Test 3", null, "3.0");
ensure_test_completed();
checkInstall(install, {
version: "3.0",
name: "Test 3",
state: AddonManager.STATE_AVAILABLE,
existingAddon: null,
});
@@ -466,17 +466,17 @@ add_task(async function test_4() {
add_task(async function test_6() {
await promiseRestartManager();
prepare_test({ }, [
"onNewInstall"
]);
let url = "http://example.com/addons/test_install3.xpi";
- let install = await AddonManager.getInstallForURL(url, null, "application/x-xpinstall", null, "Real Test 4", null, "1.0");
+ let install = await AddonManager.getInstallForURL(url, "application/x-xpinstall", null, "Real Test 4", null, "1.0");
ensure_test_completed();
checkInstall(install, {
version: "1.0",
name: "Real Test 4",
state: AddonManager.STATE_AVAILABLE,
});
@@ -591,17 +591,17 @@ add_task(async function test_8() {
add_task(async function test_9() {
await promiseRestartManager();
prepare_test({ }, [
"onNewInstall"
]);
let url = "http://example.com/addons/test_install3.xpi";
- let install = await AddonManager.getInstallForURL(url, null, "application/x-xpinstall", null, "Real Test 4", null, "1.0");
+ let install = await AddonManager.getInstallForURL(url, "application/x-xpinstall", null, "Real Test 4", null, "1.0");
ensure_test_completed();
checkInstall(install, {
version: "1.0",
name: "Real Test 4",
state: AddonManager.STATE_AVAILABLE,
});
@@ -636,17 +636,17 @@ add_task(async function test_9() {
add_task(async function test_14() {
await promiseRestartManager();
prepare_test({ }, [
"onNewInstall"
]);
let url = "http://example.com/addons/test_install2_1.xpi";
- let install = await AddonManager.getInstallForURL(url, null, "application/x-xpinstall");
+ let install = await AddonManager.getInstallForURL(url, "application/x-xpinstall");
ensure_test_completed();
equal(install.file, null);
install = await new Promise(resolve => {
prepare_test({ }, [
"onDownloadStarted"
], resolve);
@@ -683,17 +683,17 @@ add_task(async function test_14() {
// Checks that cancelling the install from onDownloadEnded actually cancels it
add_task(async function test_15() {
prepare_test({ }, [
"onNewInstall"
]);
let url = "http://example.com/addons/test_install2_1.xpi";
- let install = await AddonManager.getInstallForURL(url, null, "application/x-xpinstall");
+ let install = await AddonManager.getInstallForURL(url, "application/x-xpinstall");
ensure_test_completed();
equal(install.file, null);
await new Promise(resolve => {
prepare_test({ }, [
"onDownloadStarted",
"onDownloadEnded"
@@ -717,17 +717,17 @@ add_task(async function test_15() {
});
});
// Verify that the userDisabled value carries over to the upgrade by default
add_task(async function test_16() {
await promiseRestartManager();
let url = "http://example.com/addons/test_install2_1.xpi";
- let aInstall = await AddonManager.getInstallForURL(url, null, "application/x-xpinstall");
+ let aInstall = await AddonManager.getInstallForURL(url, "application/x-xpinstall");
await new Promise(resolve => {
aInstall.addListener({
onInstallStarted() {
ok(!aInstall.addon.userDisabled);
aInstall.addon.userDisabled = true;
},
onInstallEnded() {
@@ -741,17 +741,17 @@ add_task(async function test_16() {
let a2 = await AddonManager.getAddonByID("addon2@tests.mozilla.org");
checkAddon("addon2@tests.mozilla.org", a2, {
userDisabled: true,
isActive: false,
});
let url_2 = "http://example.com/addons/test_install2_2.xpi";
- let aInstall_2 = await AddonManager.getInstallForURL(url_2, null, "application/x-xpinstall");
+ let aInstall_2 = await AddonManager.getInstallForURL(url_2, "application/x-xpinstall");
await new Promise(resolve => {
aInstall_2.addListener({
onInstallEnded() {
resolve();
}
});
aInstall_2.install();
});
@@ -772,17 +772,17 @@ add_task(async function test_16() {
a2_2.uninstall();
});
// Verify that changing the userDisabled value before onInstallEnded works
add_task(async function test_17() {
await promiseRestartManager();
let url = "http://example.com/addons/test_install2_1.xpi";
- let aInstall = await AddonManager.getInstallForURL(url, null, "application/x-xpinstall");
+ let aInstall = await AddonManager.getInstallForURL(url, "application/x-xpinstall");
await new Promise(resolve => {
aInstall.addListener({
onInstallEnded() {
resolve();
}
});
aInstall.install();
});
@@ -793,17 +793,17 @@ add_task(async function test_17() {
let a2 = await AddonManager.getAddonByID("addon2@tests.mozilla.org");
checkAddon("addon2@tests.mozilla.org", a2, {
userDisabled: false,
isActive: true,
});
let url_2 = "http://example.com/addons/test_install2_2.xpi";
- let aInstall_2 = await AddonManager.getInstallForURL(url_2, null, "application/x-xpinstall");
+ let aInstall_2 = await AddonManager.getInstallForURL(url_2, "application/x-xpinstall");
await new Promise(resolve => {
aInstall_2.addListener({
onInstallStarted() {
ok(!aInstall_2.addon.userDisabled);
aInstall_2.addon.userDisabled = true;
},
@@ -824,17 +824,17 @@ add_task(async function test_17() {
a2_2.uninstall();
});
// Verify that changing the userDisabled value before onInstallEnded works
add_task(async function test_18() {
await promiseRestartManager();
let url = "http://example.com/addons/test_install2_1.xpi";
- let aInstall = await AddonManager.getInstallForURL(url, null, "application/x-xpinstall");
+ let aInstall = await AddonManager.getInstallForURL(url, "application/x-xpinstall");
await new Promise(resolve => {
aInstall.addListener({
onInstallStarted() {
ok(!aInstall.addon.userDisabled);
aInstall.addon.userDisabled = true;
},
onInstallEnded() {
@@ -848,17 +848,17 @@ add_task(async function test_18() {
let a2 = await AddonManager.getAddonByID("addon2@tests.mozilla.org");
checkAddon("addon2@tests.mozilla.org", a2, {
userDisabled: true,
isActive: false,
});
let url_2 = "http://example.com/addons/test_install2_2.xpi";
- let aInstall_2 = await AddonManager.getInstallForURL(url_2, null, "application/x-xpinstall");
+ let aInstall_2 = await AddonManager.getInstallForURL(url_2, "application/x-xpinstall");
await new Promise(resolve => {
aInstall_2.addListener({
onInstallStarted() {
ok(aInstall_2.addon.userDisabled);
aInstall_2.addon.userDisabled = false;
},
onInstallEnded() {
@@ -888,17 +888,17 @@ add_task(async function test_18_1() {
Services.prefs.setCharPref(PREF_GETADDONS_BYIDS,
"http://example.com/data/test_install_addons.json");
Services.prefs.setCharPref(PREF_COMPAT_OVERRIDES,
"http://example.com/data/test_install_compat.json");
Services.prefs.setBoolPref("extensions.addon2@tests.mozilla.org.getAddons.cache.enabled", false);
let url = "http://example.com/addons/test_install2_1.xpi";
- let aInstall = await AddonManager.getInstallForURL(url, null, "application/x-xpinstall");
+ let aInstall = await AddonManager.getInstallForURL(url, "application/x-xpinstall");
let addon = await new Promise(resolve => {
aInstall.addListener({
onInstallEnded(unused, aAddon) {
resolve(aAddon);
}
});
aInstall.install();
@@ -916,17 +916,17 @@ add_task(async function test_18_1() {
// Checks that metadata is downloaded for new installs and is visible before and
// after restart
add_task(async function test_19() {
await promiseRestartManager();
Services.prefs.setBoolPref("extensions.addon2@tests.mozilla.org.getAddons.cache.enabled", true);
let url = "http://example.com/addons/test_install2_1.xpi";
- let aInstall = await AddonManager.getInstallForURL(url, null, "application/x-xpinstall");
+ let aInstall = await AddonManager.getInstallForURL(url, "application/x-xpinstall");
await new Promise(resolve => {
aInstall.addListener({
onInstallEnded(unused, aAddon) {
resolve(aAddon);
}
});
aInstall.install();
});
@@ -942,17 +942,17 @@ add_task(async function test_19() {
a2.uninstall();
});
// Do the same again to make sure it works when the data is already in the cache
add_task(async function test_20() {
await promiseRestartManager();
let url = "http://example.com/addons/test_install2_1.xpi";
- let aInstall = await AddonManager.getInstallForURL(url, null, "application/x-xpinstall");
+ let aInstall = await AddonManager.getInstallForURL(url, "application/x-xpinstall");
await new Promise(resolve => {
aInstall.addListener({
onInstallEnded(unused, aAddon) {
resolve(aAddon);
}
});
aInstall.install();
});
@@ -970,17 +970,17 @@ add_task(async function test_20() {
// Tests that an install can be restarted after being cancelled
add_task(async function test_22() {
prepare_test({ }, [
"onNewInstall"
]);
let url = "http://example.com/addons/test_install3.xpi";
- let aInstall = await AddonManager.getInstallForURL(url, null, "application/x-xpinstall");
+ let aInstall = await AddonManager.getInstallForURL(url, "application/x-xpinstall");
ensure_test_completed();
checkInstall(aInstall, {
state: AddonManager.STATE_AVAILABLE,
});
let install = await new Promise(resolve => {
prepare_test({}, [
@@ -1023,17 +1023,17 @@ add_task(async function test_22() {
// Tests that an install can be restarted after being cancelled when a hash
// was provided
add_task(async function test_23() {
prepare_test({ }, [
"onNewInstall"
]);
let url = "http://example.com/addons/test_install3.xpi";
- let install = await AddonManager.getInstallForURL(url, null, "application/x-xpinstall", do_get_file_hash(XPIS.test_install3));
+ let install = await AddonManager.getInstallForURL(url, "application/x-xpinstall", do_get_file_hash(XPIS.test_install3));
ensure_test_completed();
checkInstall(install, {
state: AddonManager.STATE_AVAILABLE,
});
await new Promise(resolve => {
@@ -1078,17 +1078,17 @@ add_task(async function test_23() {
// Tests that an install with a bad hash can be restarted after it fails, though
// it will only fail again
add_task(async function test_24() {
prepare_test({ }, [
"onNewInstall"
]);
let url = "http://example.com/addons/test_install3.xpi";
- let aInstall = await AddonManager.getInstallForURL(url, null, "application/x-xpinstall", "sha1:foo");
+ let aInstall = await AddonManager.getInstallForURL(url, "application/x-xpinstall", "sha1:foo");
ensure_test_completed();
checkInstall(aInstall, {
state: AddonManager.STATE_AVAILABLE,
});
let install = await new Promise(resolve => {
prepare_test({}, [
@@ -1110,17 +1110,17 @@ add_task(async function test_24() {
// Tests that installs with a hash for a local file work
add_task(async function test_25() {
prepare_test({ }, [
"onNewInstall"
]);
let url = Services.io.newFileURI(XPIS.test_install3).spec;
- let aInstall = await AddonManager.getInstallForURL(url, null, "application/x-xpinstall", do_get_file_hash(XPIS.test_install3));
+ let aInstall = await AddonManager.getInstallForURL(url, "application/x-xpinstall", do_get_file_hash(XPIS.test_install3));
ensure_test_completed();
checkInstall(aInstall, {
state: AddonManager.STATE_DOWNLOADED,
error: 0,
});
prepare_test({ }, [
@@ -1135,17 +1135,17 @@ add_task(async function test_25() {
add_task(async function test_26() {
prepare_test({ }, [
"onNewInstall",
"onDownloadStarted",
"onDownloadCancelled"
]);
let url = "http://example.com/redirect?/addons/test_install1.xpi";
- let aInstall = await AddonManager.getInstallForURL(url, null, "application/x-xpinstall");
+ let aInstall = await AddonManager.getInstallForURL(url, "application/x-xpinstall");
await new Promise(resolve => {
let observerService = Cc["@mozilla.org/network/http-activity-distributor;1"].
getService(Ci.nsIHttpActivityDistributor);
observerService.addObserver({
observeActivity(aChannel, aType, aSubtype, aTimestamp, aSizeData,
aStringData) {
aChannel.QueryInterface(Ci.nsIChannel);
@@ -1178,17 +1178,17 @@ add_task(async function test_26() {
// Tests that an install can be restarted during onDownloadCancelled after being
// cancelled in mid-download
add_task(async function test_27() {
prepare_test({ }, [
"onNewInstall"
]);
let url = "http://example.com/addons/test_install3.xpi";
- let aInstall = await AddonManager.getInstallForURL(url, null, "application/x-xpinstall");
+ let aInstall = await AddonManager.getInstallForURL(url, "application/x-xpinstall");
ensure_test_completed();
checkInstall(aInstall, {
state: AddonManager.STATE_AVAILABLE,
});
aInstall.addListener({
onDownloadProgress() {
@@ -1235,17 +1235,17 @@ add_task(async function test_27() {
add_task(async function test_29() {
Services.prefs.setBoolPref("extensions.getAddons.cache.enabled", true);
prepare_test({ }, [
"onNewInstall"
]);
let url = "http://example.com/addons/test_install6.xpi";
- let install = await AddonManager.getInstallForURL(url, null, "application/x-xpinstall", null, "Addon Test 6", null, "1.0");
+ let install = await AddonManager.getInstallForURL(url, "application/x-xpinstall", null, "Addon Test 6", null, "1.0");
ensure_test_completed();
checkInstall(install, {
version: "1.0",
name: "Addon Test 6",
state: AddonManager.STATE_AVAILABLE,
});
--- a/toolkit/mozapps/extensions/test/xpcshell/test_install_icons.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_install_icons.js
@@ -16,42 +16,42 @@ function run_test() {
do_test_pending();
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1.9.2");
startupManager();
test_1();
}
async function test_1() {
- let aInstall = await AddonManager.getInstallForURL(addon_url, null, "application/x-xpinstall", null, null, null, null, null);
+ let aInstall = await AddonManager.getInstallForURL(addon_url, "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();
}
async function test_2() {
- let aInstall = await AddonManager.getInstallForURL(addon_url, null, "application/x-xpinstall", null, null, icon32_url, null, null);
+ let aInstall = await AddonManager.getInstallForURL(addon_url, "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();
}
async function test_3() {
- let aInstall = await AddonManager.getInstallForURL(addon_url, null, "application/x-xpinstall", null, null, { "32": icon32_url }, null, null);
+ let aInstall = await AddonManager.getInstallForURL(addon_url, "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();
}
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);
+ let aInstall = await AddonManager.getInstallForURL(addon_url, "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_signed_install.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_signed_install.js
@@ -72,17 +72,17 @@ function createBrokenAddonRemove(file) {
zipW.open(brokenFile, FileUtils.MODE_RDWR | FileUtils.MODE_APPEND);
zipW.removeEntry("test.txt", false);
zipW.close();
return brokenFile;
}
function createInstall(url) {
- return AddonManager.getInstallForURL(url, null, "application/x-xpinstall");
+ return AddonManager.getInstallForURL(url, "application/x-xpinstall");
}
function serveUpdateRDF(leafName) {
gServer.registerPathHandler("/update.rdf", function(request, response) {
response.setStatusLine(request.httpVersion, 200, "OK");
response.write(JSON.stringify({
addons: {
[ID]: {
--- a/toolkit/mozapps/extensions/test/xpcshell/test_update.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_update.js
@@ -869,25 +869,25 @@ add_task(async function test_14() {
notEqual(a8, null);
equal(a8.version, "1.0");
a8.uninstall();
});
add_task(async function test_16() {
let url = "http://example.com/addons/test_install2_1.xpi";
- let install = await AddonManager.getInstallForURL(url, null, "application/x-xpinstall");
+ let install = await AddonManager.getInstallForURL(url, "application/x-xpinstall");
await promiseCompleteInstall(install);
let a1 = await AddonManager.getAddonByID("addon2@tests.mozilla.org");
notEqual(a1.syncGUID, null);
let oldGUID = a1.syncGUID;
let url_2 = "http://example.com/addons/test_install2_2.xpi";
- let install_2 = await AddonManager.getInstallForURL(url_2, null, "application/x-xpinstall");
+ let install_2 = await AddonManager.getInstallForURL(url_2, "application/x-xpinstall");
await promiseCompleteInstall(install_2);
let a2 = await AddonManager.getAddonByID("addon2@tests.mozilla.org");
notEqual(a2.syncGUID, null);
equal(oldGUID, a2.syncGUID);
a2.uninstall();
});