summaryrefslogtreecommitdiffstats
path: root/toolkit/mozapps/extensions/test/xpcshell
diff options
context:
space:
mode:
Diffstat (limited to 'toolkit/mozapps/extensions/test/xpcshell')
-rw-r--r--toolkit/mozapps/extensions/test/xpcshell/.eslintrc.js4
-rw-r--r--toolkit/mozapps/extensions/test/xpcshell/data/signing_checks/langpack_signed.xpibin4452 -> 7593 bytes
-rw-r--r--toolkit/mozapps/extensions/test/xpcshell/data/signing_checks/long.xpibin4761 -> 7872 bytes
-rw-r--r--toolkit/mozapps/extensions/test/xpcshell/data/signing_checks/privileged.xpibin4659 -> 7772 bytes
-rw-r--r--toolkit/mozapps/extensions/test/xpcshell/data/signing_checks/signed1.xpibin4702 -> 7772 bytes
-rw-r--r--toolkit/mozapps/extensions/test/xpcshell/data/signing_checks/signed2.xpibin4697 -> 7766 bytes
-rw-r--r--toolkit/mozapps/extensions/test/xpcshell/data/webext-implicit-id.xpibin4182 -> 21274 bytes
-rw-r--r--toolkit/mozapps/extensions/test/xpcshell/head_addons.js11
-rw-r--r--toolkit/mozapps/extensions/test/xpcshell/head_compat.js2
-rw-r--r--toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_blocklist_appversion.js2
-rw-r--r--toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_blocklist_mlbf.js44
-rw-r--r--toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_blocklist_mlbf_update.js2
-rw-r--r--toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_blocklist_severities.js2
-rw-r--r--toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_blocklistchange.js10
-rw-r--r--toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_gfxBlacklist_Device.js2
-rw-r--r--toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_gfxBlacklist_DriverNew.js2
-rw-r--r--toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_gfxBlacklist_Equal_DriverNew.js2
-rw-r--r--toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_gfxBlacklist_Equal_DriverOld.js2
-rw-r--r--toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_gfxBlacklist_Equal_OK.js2
-rw-r--r--toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_gfxBlacklist_GTE_DriverOld.js2
-rw-r--r--toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_gfxBlacklist_GTE_OK.js2
-rw-r--r--toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_gfxBlacklist_No_Comparison.js2
-rw-r--r--toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_gfxBlacklist_OK.js2
-rw-r--r--toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_gfxBlacklist_OS.js2
-rw-r--r--toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_gfxBlacklist_OSVersion_match.js2
-rw-r--r--toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_gfxBlacklist_OSVersion_mismatch_DriverVersion.js2
-rw-r--r--toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_gfxBlacklist_OSVersion_mismatch_OSVersion.js2
-rw-r--r--toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_gfxBlacklist_Vendor.js2
-rw-r--r--toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_gfxBlacklist_Version.js2
-rw-r--r--toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_gfxBlacklist_prefs.js4
-rw-r--r--toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/xpcshell.toml1
-rw-r--r--toolkit/mozapps/extensions/test/xpcshell/test_AbuseReporter.js6
-rw-r--r--toolkit/mozapps/extensions/test/xpcshell/test_AddonRepository.js2
-rw-r--r--toolkit/mozapps/extensions/test/xpcshell/test_AddonRepository_appIsShuttingDown.js4
-rw-r--r--toolkit/mozapps/extensions/test/xpcshell/test_AddonRepository_cache.js2
-rw-r--r--toolkit/mozapps/extensions/test/xpcshell/test_AddonRepository_cache_locale.js4
-rw-r--r--toolkit/mozapps/extensions/test/xpcshell/test_ProductAddonChecker_signatures.js15
-rw-r--r--toolkit/mozapps/extensions/test/xpcshell/test_addon_manager_telemetry_events.js10
-rw-r--r--toolkit/mozapps/extensions/test/xpcshell/test_delay_update_webextension.js8
-rw-r--r--toolkit/mozapps/extensions/test/xpcshell/test_installOrigins.js16
-rw-r--r--toolkit/mozapps/extensions/test/xpcshell/test_install_cancel.js2
-rw-r--r--toolkit/mozapps/extensions/test/xpcshell/test_provider_markSafe.js2
-rw-r--r--toolkit/mozapps/extensions/test/xpcshell/test_provider_shutdown.js2
-rw-r--r--toolkit/mozapps/extensions/test/xpcshell/test_reload.js4
-rw-r--r--toolkit/mozapps/extensions/test/xpcshell/test_signed_install.js103
-rw-r--r--toolkit/mozapps/extensions/test/xpcshell/test_signed_langpack.js2
-rw-r--r--toolkit/mozapps/extensions/test/xpcshell/test_signed_long.js2
-rw-r--r--toolkit/mozapps/extensions/test/xpcshell/test_signed_verify.js438
-rw-r--r--toolkit/mozapps/extensions/test/xpcshell/test_system_delay_update.js2
-rw-r--r--toolkit/mozapps/extensions/test/xpcshell/test_system_repository.js2
-rw-r--r--toolkit/mozapps/extensions/test/xpcshell/test_system_reset.js4
-rw-r--r--toolkit/mozapps/extensions/test/xpcshell/test_system_update_blank.js2
-rw-r--r--toolkit/mozapps/extensions/test/xpcshell/test_system_update_checkSizeHash.js2
-rw-r--r--toolkit/mozapps/extensions/test/xpcshell/test_system_update_custom.js2
-rw-r--r--toolkit/mozapps/extensions/test/xpcshell/test_system_update_empty.js2
-rw-r--r--toolkit/mozapps/extensions/test/xpcshell/test_system_update_installTelemetryInfo.js2
-rw-r--r--toolkit/mozapps/extensions/test/xpcshell/test_system_update_newset.js2
-rw-r--r--toolkit/mozapps/extensions/test/xpcshell/test_system_update_overlapping.js2
-rw-r--r--toolkit/mozapps/extensions/test/xpcshell/test_system_update_uninstall_check.js2
-rw-r--r--toolkit/mozapps/extensions/test/xpcshell/test_system_update_upgrades.js2
-rw-r--r--toolkit/mozapps/extensions/test/xpcshell/test_system_upgrades.js2
-rw-r--r--toolkit/mozapps/extensions/test/xpcshell/test_temporary.js4
-rw-r--r--toolkit/mozapps/extensions/test/xpcshell/test_update.js41
-rw-r--r--toolkit/mozapps/extensions/test/xpcshell/test_updateCancel.js2
-rw-r--r--toolkit/mozapps/extensions/test/xpcshell/test_update_addontype.js2
-rw-r--r--toolkit/mozapps/extensions/test/xpcshell/test_update_noSystemAddonUpdate.js2
-rw-r--r--toolkit/mozapps/extensions/test/xpcshell/test_updateid.js2
-rw-r--r--toolkit/mozapps/extensions/test/xpcshell/test_updateversion.js2
-rw-r--r--toolkit/mozapps/extensions/test/xpcshell/test_webextension.js67
-rw-r--r--toolkit/mozapps/extensions/test/xpcshell/test_webextension_install.js4
-rw-r--r--toolkit/mozapps/extensions/test/xpcshell/xpcshell.toml7
71 files changed, 716 insertions, 179 deletions
diff --git a/toolkit/mozapps/extensions/test/xpcshell/.eslintrc.js b/toolkit/mozapps/extensions/test/xpcshell/.eslintrc.js
index 8e3971b385..26a3e6177f 100644
--- a/toolkit/mozapps/extensions/test/xpcshell/.eslintrc.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/.eslintrc.js
@@ -4,7 +4,7 @@ module.exports = {
rules: {
"no-unused-vars": [
"error",
- { args: "none", varsIgnorePattern: "^end_test$" },
+ { argsIgnorePattern: "^_", varsIgnorePattern: "^end_test$" },
],
},
overrides: [
@@ -14,7 +14,7 @@ module.exports = {
"no-unused-vars": [
"error",
{
- args: "none",
+ argsIgnorePattern: "^_",
vars: "local",
},
],
diff --git a/toolkit/mozapps/extensions/test/xpcshell/data/signing_checks/langpack_signed.xpi b/toolkit/mozapps/extensions/test/xpcshell/data/signing_checks/langpack_signed.xpi
index f60d00348e..ab7db3926e 100644
--- a/toolkit/mozapps/extensions/test/xpcshell/data/signing_checks/langpack_signed.xpi
+++ b/toolkit/mozapps/extensions/test/xpcshell/data/signing_checks/langpack_signed.xpi
Binary files differ
diff --git a/toolkit/mozapps/extensions/test/xpcshell/data/signing_checks/long.xpi b/toolkit/mozapps/extensions/test/xpcshell/data/signing_checks/long.xpi
index f95f3df91e..78124db3ae 100644
--- a/toolkit/mozapps/extensions/test/xpcshell/data/signing_checks/long.xpi
+++ b/toolkit/mozapps/extensions/test/xpcshell/data/signing_checks/long.xpi
Binary files differ
diff --git a/toolkit/mozapps/extensions/test/xpcshell/data/signing_checks/privileged.xpi b/toolkit/mozapps/extensions/test/xpcshell/data/signing_checks/privileged.xpi
index c22acaacd2..111385485b 100644
--- a/toolkit/mozapps/extensions/test/xpcshell/data/signing_checks/privileged.xpi
+++ b/toolkit/mozapps/extensions/test/xpcshell/data/signing_checks/privileged.xpi
Binary files differ
diff --git a/toolkit/mozapps/extensions/test/xpcshell/data/signing_checks/signed1.xpi b/toolkit/mozapps/extensions/test/xpcshell/data/signing_checks/signed1.xpi
index e2ba7d6fd8..2e9d976a34 100644
--- a/toolkit/mozapps/extensions/test/xpcshell/data/signing_checks/signed1.xpi
+++ b/toolkit/mozapps/extensions/test/xpcshell/data/signing_checks/signed1.xpi
Binary files differ
diff --git a/toolkit/mozapps/extensions/test/xpcshell/data/signing_checks/signed2.xpi b/toolkit/mozapps/extensions/test/xpcshell/data/signing_checks/signed2.xpi
index ccb20796f2..2d6b9c020b 100644
--- a/toolkit/mozapps/extensions/test/xpcshell/data/signing_checks/signed2.xpi
+++ b/toolkit/mozapps/extensions/test/xpcshell/data/signing_checks/signed2.xpi
Binary files differ
diff --git a/toolkit/mozapps/extensions/test/xpcshell/data/webext-implicit-id.xpi b/toolkit/mozapps/extensions/test/xpcshell/data/webext-implicit-id.xpi
index 6b4abaa691..05a5ea2881 100644
--- a/toolkit/mozapps/extensions/test/xpcshell/data/webext-implicit-id.xpi
+++ b/toolkit/mozapps/extensions/test/xpcshell/data/webext-implicit-id.xpi
Binary files differ
diff --git a/toolkit/mozapps/extensions/test/xpcshell/head_addons.js b/toolkit/mozapps/extensions/test/xpcshell/head_addons.js
index 23614cdb2a..2f26d940f0 100644
--- a/toolkit/mozapps/extensions/test/xpcshell/head_addons.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/head_addons.js
@@ -935,7 +935,7 @@ class EventChecker {
return this.checkAddonEvent("onInstalled", addon);
}
- onUninstalling(addon, requiresRestart) {
+ onUninstalling(addon) {
return this.checkAddonEvent("onUninstalling", addon);
}
@@ -1033,7 +1033,7 @@ class EventChecker {
});
}
- onInstallEnded(install, newAddon) {
+ onInstallEnded(install) {
return this.checkInstall("onInstallEnded", install, {
state: "STATE_INSTALLED",
error: 0,
@@ -1221,3 +1221,10 @@ async function installBuiltinExtension(extensionData, waitForStartup = true) {
}
return wrapper;
}
+
+function useAMOStageCert() {
+ // NOTE: add_task internally calls add_test which mutate the add_task properties object,
+ // and so we should not reuse the same object as add_task options passed to multiple
+ // add_task calls.
+ return { pref_set: [["xpinstall.signatures.dev-root", true]] };
+}
diff --git a/toolkit/mozapps/extensions/test/xpcshell/head_compat.js b/toolkit/mozapps/extensions/test/xpcshell/head_compat.js
index 79ddb8dd3f..76fafee50e 100644
--- a/toolkit/mozapps/extensions/test/xpcshell/head_compat.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/head_compat.js
@@ -22,7 +22,7 @@ AddonManager.addExternalExtensionLoader({
Object.assign(addon, manifest);
return addon;
},
- loadScope(addon, file) {
+ loadScope() {
return {
install() {},
uninstall() {},
diff --git a/toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_blocklist_appversion.js b/toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_blocklist_appversion.js
index e8d03f088b..08e41b47fd 100644
--- a/toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_blocklist_appversion.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_blocklist_appversion.js
@@ -227,7 +227,7 @@ function createAddon(addon) {
* If a lastTest is provided checks that the notification dialog got passed
* the newly blocked items compared to the previous test.
*/
-async function checkState(test, lastTest, callback) {
+async function checkState(test) {
let addons = await AddonManager.getAddonsByIDs(ADDONS.map(a => a.id));
const bls = Ci.nsIBlocklistService;
diff --git a/toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_blocklist_mlbf.js b/toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_blocklist_mlbf.js
index 1f6cb3db05..f7e3a57152 100644
--- a/toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_blocklist_mlbf.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_blocklist_mlbf.js
@@ -11,11 +11,11 @@ createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1");
AddonTestUtils.useRealCertChecks = true;
// A real, signed XPI for use in the test.
-const SIGNED_ADDON_XPI_FILE = do_get_file("../data/webext-implicit-id.xpi");
-const SIGNED_ADDON_ID = "webext_implicit_id@tests.mozilla.org";
-const SIGNED_ADDON_VERSION = "1.0";
+const SIGNED_ADDON_XPI_FILE = do_get_file("amosigned.xpi");
+const SIGNED_ADDON_ID = "amosigned-xpi@tests.mozilla.org";
+const SIGNED_ADDON_VERSION = "2.2";
const SIGNED_ADDON_KEY = `${SIGNED_ADDON_ID}:${SIGNED_ADDON_VERSION}`;
-const SIGNED_ADDON_SIGN_TIME = 1459980789000; // notBefore of certificate.
+const SIGNED_ADDON_SIGN_TIME = 1711462525000; // notBefore of certificate.
// A real, signed sitepermission XPI for use in the test.
const SIGNED_SITEPERM_XPI_FILE = do_get_file("webmidi_permission.xpi");
@@ -78,7 +78,7 @@ add_task(async function signed_xpi_initially_unblocked() {
await Blocklist.getAddonBlocklistEntry(addon),
{
state: Ci.nsIBlocklistService.STATE_BLOCKED,
- url: "https://addons.mozilla.org/en-US/xpcshell/blocked-addon/webext_implicit_id@tests.mozilla.org/1.0/",
+ url: `https://addons.mozilla.org/en-US/xpcshell/blocked-addon/${SIGNED_ADDON_ID}/${SIGNED_ADDON_VERSION}/`,
},
"Blocked addon should have blocked entry"
);
@@ -174,7 +174,9 @@ add_task(async function signed_temporary() {
await Assert.rejects(
AddonManager.installTemporaryAddon(SIGNED_ADDON_XPI_FILE),
- /Add-on webext_implicit_id@tests.mozilla.org is not compatible with application version/,
+ new RegExp(
+ `Add-on ${SIGNED_ADDON_ID} is not compatible with application version`
+ ),
"Blocklisted add-on cannot be installed"
);
});
@@ -183,19 +185,27 @@ add_task(async function signed_temporary() {
// It can still be blocked by a stash, which is tested in
// privileged_addon_blocked_by_stash in test_blocklist_mlbf_stashes.js.
add_task(async function privileged_xpi_not_blocked() {
+ const PRIV_ADDON_ID = "test@tests.mozilla.org";
+ const PRIV_ADDON_VERSION = "2.0buildid20240326.152244";
mockMLBF({
- blocked: ["test@tests.mozilla.org:2.0"],
+ blocked: [`${PRIV_ADDON_ID}:${PRIV_ADDON_VERSION}`],
notblocked: [],
generationTime: 1546297200000, // 1 jan 2019 = after the cert's notBefore
});
await ExtensionBlocklistMLBF._onUpdate();
+ // Prevent install to fail due to privileged.xpi version using
+ // an addon version that hits a manifest warning (see PRIV_ADDON_VERSION).
+ // TODO(Bug 1824240): remove this once privileged.xpi can be resigned with a
+ // version format that does not hit a manifest warning.
+ ExtensionTestUtils.failOnSchemaWarnings(false);
const install = await promiseInstallFile(
do_get_file("../data/signing_checks/privileged.xpi")
);
+ ExtensionTestUtils.failOnSchemaWarnings(true);
Assert.equal(install.error, 0, "Install should not have an error");
- let addon = await promiseAddonByID("test@tests.mozilla.org");
+ let addon = await promiseAddonByID(PRIV_ADDON_ID);
Assert.equal(addon.signedState, AddonManager.SIGNEDSTATE_PRIVILEGED);
Assert.equal(addon.blocklistState, Ci.nsIBlocklistService.STATE_NOT_BLOCKED);
await addon.uninstall();
@@ -205,13 +215,17 @@ add_task(async function privileged_xpi_not_blocked() {
// It can still be blocked by a stash, which is tested in
// langpack_blocked_by_stash in test_blocklist_mlbf_stashes.js.
add_task(
- // We do not support langpacks on Android.
- { skip_if: () => AppConstants.platform == "android" },
+ {
+ // langpack_signed.xpi is signed with AMO staging signature.
+ pref_set: [["xpinstall.signatures.dev-root", true]],
+ // We do not support langpacks on Android.
+ skip_if: () => AppConstants.platform == "android",
+ },
async function langpack_not_blocked_on_Nightly() {
mockMLBF({
blocked: ["langpack-klingon@firefox.mozilla.org:1.0"],
notblocked: [],
- generationTime: 1546297200000, // 1 jan 2019 = after the cert's notBefore
+ generationTime: 1712243366640, // 4 apr 2024 = after the cert's notBefore
});
await ExtensionBlocklistMLBF._onUpdate();
@@ -226,12 +240,16 @@ add_task(
Assert.equal(
addon.blocklistState,
Ci.nsIBlocklistService.STATE_NOT_BLOCKED,
- "Langpacks cannot be blocked via the MLBF"
+ "Langpacks cannot be blocked via the MLBF on nightly"
);
} else {
// On non-Nightly, langpacks are submitted through AMO so we will enforce
// the MLBF blocklist for them.
- Assert.equal(addon.blocklistState, Ci.nsIBlocklistService.STATE_BLOCKED);
+ Assert.equal(
+ addon.blocklistState,
+ Ci.nsIBlocklistService.STATE_BLOCKED,
+ "Langpacks can be blocked via the MLBF on non-Nightly channels"
+ );
}
await addon.uninstall();
}
diff --git a/toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_blocklist_mlbf_update.js b/toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_blocklist_mlbf_update.js
index b98d6e345d..77e5df2540 100644
--- a/toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_blocklist_mlbf_update.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_blocklist_mlbf_update.js
@@ -25,7 +25,7 @@ add_task(async function collapse_multiple_pending_update_requests() {
// Add a spy to the RemoteSettings client, so we can verify that the number
// of RemoteSettings accesses matches with what we expect.
const originalClientGet = ExtensionBlocklistMLBF._client.get;
- const spyClientGet = (tag, returnValue) => {
+ const spyClientGet = tag => {
ExtensionBlocklistMLBF._client.get = async function () {
// Record the method call.
observed.push(tag);
diff --git a/toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_blocklist_severities.js b/toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_blocklist_severities.js
index fffbb8a51e..059d014197 100644
--- a/toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_blocklist_severities.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_blocklist_severities.js
@@ -451,7 +451,7 @@ add_task(async function test_pt4() {
await promiseRestartManager();
await checkInitialState();
- await loadBlocklist("empty", args => {
+ await loadBlocklist("empty", () => {
dump("Checking notification pt 4\n");
// See note in other callback - we no longer notify for non-blocked add-ons.
ok(false, "Should not get a notification as there are no blocked addons.");
diff --git a/toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_blocklistchange.js b/toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_blocklistchange.js
index 7383e093ee..b021a13c80 100644
--- a/toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_blocklistchange.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_blocklistchange.js
@@ -40,7 +40,7 @@ const useMLBF = Services.prefs.getBoolPref(
var testserver = createHttpServer({ hosts: ["example.com"] });
-function permissionPromptHandler(subject, topic, data) {
+function permissionPromptHandler(subject) {
ok(
subject?.wrappedJSObject?.info?.resolve,
"Got a permission prompt notification as expected"
@@ -280,7 +280,7 @@ if (useMLBF) {
}
// XXXgijs: according to https://bugzilla.mozilla.org/show_bug.cgi?id=1257565#c111
-// this code and the related code in Blocklist.jsm (specific to XML blocklist) is
+// this code and the related code in Blocklist.sys.mjs (specific to XML blocklist) is
// dead code and can be removed. See https://bugzilla.mozilla.org/show_bug.cgi?id=1549550 .
//
// Don't need the full interface, attempts to call other methods will just
@@ -343,16 +343,16 @@ function Pload_blocklist(aId) {
// Does a background update check for add-ons and returns a promise that
// resolves when any started installs complete
function Pbackground_update() {
- return new Promise((resolve, reject) => {
+ return new Promise(resolve => {
let installCount = 0;
let backgroundCheckCompleted = false;
AddonManager.addInstallListener({
- onNewInstall(aInstall) {
+ onNewInstall() {
installCount++;
},
- onInstallEnded(aInstall) {
+ onInstallEnded() {
installCount--;
// Wait until all started installs have completed
if (installCount) {
diff --git a/toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_gfxBlacklist_Device.js b/toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_gfxBlacklist_Device.js
index 9b1d84b77d..68c9357356 100644
--- a/toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_gfxBlacklist_Device.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_gfxBlacklist_Device.js
@@ -63,7 +63,7 @@ async function run_test() {
do_test_finished();
}
- Services.obs.addObserver(function (aSubject, aTopic, aData) {
+ Services.obs.addObserver(function () {
// If we wait until after we go through the event loop, gfxInfo is sure to
// have processed the gfxItems event.
executeSoon(checkBlacklist);
diff --git a/toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_gfxBlacklist_DriverNew.js b/toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_gfxBlacklist_DriverNew.js
index a1bcde5566..fa274bde2d 100644
--- a/toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_gfxBlacklist_DriverNew.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_gfxBlacklist_DriverNew.js
@@ -57,7 +57,7 @@ async function run_test() {
do_test_finished();
}
- Services.obs.addObserver(function (aSubject, aTopic, aData) {
+ Services.obs.addObserver(function () {
// If we wait until after we go through the event loop, gfxInfo is sure to
// have processed the gfxItems event.
executeSoon(checkBlacklist);
diff --git a/toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_gfxBlacklist_Equal_DriverNew.js b/toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_gfxBlacklist_Equal_DriverNew.js
index ec74d813ae..a6a1dc1435 100644
--- a/toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_gfxBlacklist_Equal_DriverNew.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_gfxBlacklist_Equal_DriverNew.js
@@ -102,7 +102,7 @@ async function run_test() {
do_test_finished();
}
- Services.obs.addObserver(function (aSubject, aTopic, aData) {
+ Services.obs.addObserver(function () {
// If we wait until after we go through the event loop, gfxInfo is sure to
// have processed the gfxItems event.
executeSoon(checkBlacklist);
diff --git a/toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_gfxBlacklist_Equal_DriverOld.js b/toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_gfxBlacklist_Equal_DriverOld.js
index ff887a92eb..93ca432c6d 100644
--- a/toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_gfxBlacklist_Equal_DriverOld.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_gfxBlacklist_Equal_DriverOld.js
@@ -58,7 +58,7 @@ async function run_test() {
do_test_finished();
}
- Services.obs.addObserver(function (aSubject, aTopic, aData) {
+ Services.obs.addObserver(function () {
// If we wait until after we go through the event loop, gfxInfo is sure to
// have processed the gfxItems event.
executeSoon(checkBlacklist);
diff --git a/toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_gfxBlacklist_Equal_OK.js b/toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_gfxBlacklist_Equal_OK.js
index 1eef119663..4be9215161 100644
--- a/toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_gfxBlacklist_Equal_OK.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_gfxBlacklist_Equal_OK.js
@@ -58,7 +58,7 @@ async function run_test() {
do_test_finished();
}
- Services.obs.addObserver(function (aSubject, aTopic, aData) {
+ Services.obs.addObserver(function () {
// If we wait until after we go through the event loop, gfxInfo is sure to
// have processed the gfxItems event.
executeSoon(checkBlacklist);
diff --git a/toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_gfxBlacklist_GTE_DriverOld.js b/toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_gfxBlacklist_GTE_DriverOld.js
index 182c825ffb..d8b082bedc 100644
--- a/toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_gfxBlacklist_GTE_DriverOld.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_gfxBlacklist_GTE_DriverOld.js
@@ -58,7 +58,7 @@ async function run_test() {
do_test_finished();
}
- Services.obs.addObserver(function (aSubject, aTopic, aData) {
+ Services.obs.addObserver(function () {
// If we wait until after we go through the event loop, gfxInfo is sure to
// have processed the gfxItems event.
executeSoon(checkBlacklist);
diff --git a/toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_gfxBlacklist_GTE_OK.js b/toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_gfxBlacklist_GTE_OK.js
index 2cc3686007..0e419ec761 100644
--- a/toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_gfxBlacklist_GTE_OK.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_gfxBlacklist_GTE_OK.js
@@ -60,7 +60,7 @@ async function run_test() {
do_test_finished();
}
- Services.obs.addObserver(function (aSubject, aTopic, aData) {
+ Services.obs.addObserver(function () {
// If we wait until after we go through the event loop, gfxInfo is sure to
// have processed the gfxItems event.
executeSoon(checkBlacklist);
diff --git a/toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_gfxBlacklist_No_Comparison.js b/toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_gfxBlacklist_No_Comparison.js
index 169cdc5e62..4d457cff14 100644
--- a/toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_gfxBlacklist_No_Comparison.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_gfxBlacklist_No_Comparison.js
@@ -59,7 +59,7 @@ async function run_test() {
do_test_finished();
}
- Services.obs.addObserver(function (aSubject, aTopic, aData) {
+ Services.obs.addObserver(function () {
// If we wait until after we go through the event loop, gfxInfo is sure to
// have processed the gfxItems event.
executeSoon(checkBlacklist);
diff --git a/toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_gfxBlacklist_OK.js b/toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_gfxBlacklist_OK.js
index 04d766e027..991bfa8a96 100644
--- a/toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_gfxBlacklist_OK.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_gfxBlacklist_OK.js
@@ -59,7 +59,7 @@ async function run_test() {
do_test_finished();
}
- Services.obs.addObserver(function (aSubject, aTopic, aData) {
+ Services.obs.addObserver(function () {
// If we wait until after we go through the event loop, gfxInfo is sure to
// have processed the gfxItems event.
executeSoon(checkBlacklist);
diff --git a/toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_gfxBlacklist_OS.js b/toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_gfxBlacklist_OS.js
index ce5a61cb75..3f525b48ce 100644
--- a/toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_gfxBlacklist_OS.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_gfxBlacklist_OS.js
@@ -58,7 +58,7 @@ async function run_test() {
do_test_finished();
}
- Services.obs.addObserver(function (aSubject, aTopic, aData) {
+ Services.obs.addObserver(function () {
// If we wait until after we go through the event loop, gfxInfo is sure to
// have processed the gfxItems event.
executeSoon(checkBlacklist);
diff --git a/toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_gfxBlacklist_OSVersion_match.js b/toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_gfxBlacklist_OSVersion_match.js
index 7a4ec276ee..d9d357be76 100644
--- a/toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_gfxBlacklist_OSVersion_match.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_gfxBlacklist_OSVersion_match.js
@@ -60,7 +60,7 @@ async function run_test() {
do_test_finished();
}
- Services.obs.addObserver(function (aSubject, aTopic, aData) {
+ Services.obs.addObserver(function () {
// If we wait until after we go through the event loop, gfxInfo is sure to
// have processed the gfxItems event.
executeSoon(checkBlacklist);
diff --git a/toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_gfxBlacklist_OSVersion_mismatch_DriverVersion.js b/toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_gfxBlacklist_OSVersion_mismatch_DriverVersion.js
index 61dba8db96..a1c8107f1d 100644
--- a/toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_gfxBlacklist_OSVersion_mismatch_DriverVersion.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_gfxBlacklist_OSVersion_mismatch_DriverVersion.js
@@ -60,7 +60,7 @@ async function run_test() {
do_test_finished();
}
- Services.obs.addObserver(function (aSubject, aTopic, aData) {
+ Services.obs.addObserver(function () {
// If we wait until after we go through the event loop, gfxInfo is sure to
// have processed the gfxItems event.
executeSoon(checkBlacklist);
diff --git a/toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_gfxBlacklist_OSVersion_mismatch_OSVersion.js b/toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_gfxBlacklist_OSVersion_mismatch_OSVersion.js
index 117e2a34ee..be076d98c3 100644
--- a/toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_gfxBlacklist_OSVersion_mismatch_OSVersion.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_gfxBlacklist_OSVersion_mismatch_OSVersion.js
@@ -61,7 +61,7 @@ async function run_test() {
do_test_finished();
}
- Services.obs.addObserver(function (aSubject, aTopic, aData) {
+ Services.obs.addObserver(function () {
// If we wait until after we go through the event loop, gfxInfo is sure to
// have processed the gfxItems event.
executeSoon(checkBlacklist);
diff --git a/toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_gfxBlacklist_Vendor.js b/toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_gfxBlacklist_Vendor.js
index 37bc0d3c89..e5d137db60 100644
--- a/toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_gfxBlacklist_Vendor.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_gfxBlacklist_Vendor.js
@@ -58,7 +58,7 @@ async function run_test() {
do_test_finished();
}
- Services.obs.addObserver(function (aSubject, aTopic, aData) {
+ Services.obs.addObserver(function () {
// If we wait until after we go through the event loop, gfxInfo is sure to
// have processed the gfxItems event.
executeSoon(checkBlacklist);
diff --git a/toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_gfxBlacklist_Version.js b/toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_gfxBlacklist_Version.js
index 9a6a904465..cbd1699d53 100644
--- a/toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_gfxBlacklist_Version.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_gfxBlacklist_Version.js
@@ -180,7 +180,7 @@ async function run_test() {
do_test_finished();
}
- Services.obs.addObserver(function (aSubject, aTopic, aData) {
+ Services.obs.addObserver(function () {
// If we wait until after we go through the event loop, gfxInfo is sure to
// have processed the gfxItems event.
executeSoon(checkBlocklist);
diff --git a/toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_gfxBlacklist_prefs.js b/toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_gfxBlacklist_prefs.js
index 34e92b0e80..6e5f71b364 100644
--- a/toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_gfxBlacklist_prefs.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_gfxBlacklist_prefs.js
@@ -53,7 +53,7 @@ async function run_test() {
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "3", "8");
await promiseStartupManager();
- function blacklistAdded(aSubject, aTopic, aData) {
+ function blacklistAdded() {
// If we wait until after we go through the event loop, gfxInfo is sure to
// have processed the gfxItems event.
executeSoon(ensureBlacklistSet);
@@ -95,7 +95,7 @@ async function run_test() {
]);
}
- function blacklistRemoved(aSubject, aTopic, aData) {
+ function blacklistRemoved() {
// If we wait until after we go through the event loop, gfxInfo is sure to
// have processed the gfxItems event.
executeSoon(ensureBlacklistUnset);
diff --git a/toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/xpcshell.toml b/toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/xpcshell.toml
index 2aee95e952..edb77da1bc 100644
--- a/toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/xpcshell.toml
+++ b/toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/xpcshell.toml
@@ -5,6 +5,7 @@ firefox-appdir = "browser"
support-files = [
"../data/**",
"../../xpinstall/webmidi_permission.xpi",
+ "../../xpinstall/amosigned.xpi",
]
["test_android_blocklist_dump.js"]
diff --git a/toolkit/mozapps/extensions/test/xpcshell/test_AbuseReporter.js b/toolkit/mozapps/extensions/test/xpcshell/test_AbuseReporter.js
index e5dffe0b00..c94ef29e31 100644
--- a/toolkit/mozapps/extensions/test/xpcshell/test_AbuseReporter.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_AbuseReporter.js
@@ -800,11 +800,7 @@ add_task(async function test_report_recommended() {
});
add_task(async function test_query_amo_details() {
- async function assertReportOnAMODetails({
- addonId,
- addonType = "extension",
- expectedReport,
- } = {}) {
+ async function assertReportOnAMODetails({ addonId, expectedReport } = {}) {
// Clear last report timestamp and any telemetry event recorded so far.
clearAbuseReportState();
Services.telemetry.clearEvents();
diff --git a/toolkit/mozapps/extensions/test/xpcshell/test_AddonRepository.js b/toolkit/mozapps/extensions/test/xpcshell/test_AddonRepository.js
index 6f1c99eaa8..9071328680 100644
--- a/toolkit/mozapps/extensions/test/xpcshell/test_AddonRepository.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_AddonRepository.js
@@ -2,7 +2,7 @@
* http://creativecommons.org/publicdomain/zero/1.0/
*/
-// Tests AddonRepository.jsm
+// Tests AddonRepository.sys.mjs
var gServer = createHttpServer({ hosts: ["example.com"] });
diff --git a/toolkit/mozapps/extensions/test/xpcshell/test_AddonRepository_appIsShuttingDown.js b/toolkit/mozapps/extensions/test/xpcshell/test_AddonRepository_appIsShuttingDown.js
index 4f23026ed3..c1f63496a3 100644
--- a/toolkit/mozapps/extensions/test/xpcshell/test_AddonRepository_appIsShuttingDown.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_AddonRepository_appIsShuttingDown.js
@@ -2,8 +2,8 @@
* http://creativecommons.org/publicdomain/zero/1.0/
*/
-// Tests AddonRepository.jsm when backgroundUpdateChecks are hit while the application
-// shutdown has been already initiated (See Bug 1841444).
+// Tests AddonRepository.sys.mjs when backgroundUpdateChecks are hit while the
+// application shutdown has been already initiated (See Bug 1841444).
const { sinon } = ChromeUtils.importESModule(
"resource://testing-common/Sinon.sys.mjs"
diff --git a/toolkit/mozapps/extensions/test/xpcshell/test_AddonRepository_cache.js b/toolkit/mozapps/extensions/test/xpcshell/test_AddonRepository_cache.js
index 2a1bc2721b..c7b10afa19 100644
--- a/toolkit/mozapps/extensions/test/xpcshell/test_AddonRepository_cache.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_AddonRepository_cache.js
@@ -465,7 +465,7 @@ function check_cache(aExpectedToFind, aExpectedImmediately) {
for (let i = 0; i < REPOSITORY_ADDONS.length; i++) {
lookups.push(
- new Promise((resolve, reject) => {
+ new Promise(resolve => {
let immediatelyFound = true;
let expected = aExpectedToFind[i] ? REPOSITORY_ADDONS[i] : null;
// can't Promise-wrap this because we're also testing whether the callback is
diff --git a/toolkit/mozapps/extensions/test/xpcshell/test_AddonRepository_cache_locale.js b/toolkit/mozapps/extensions/test/xpcshell/test_AddonRepository_cache_locale.js
index 37e60e27dd..cf47e388d5 100644
--- a/toolkit/mozapps/extensions/test/xpcshell/test_AddonRepository_cache_locale.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_AddonRepository_cache_locale.js
@@ -152,7 +152,7 @@ function promiseLocaleChanged(requestedLocale) {
}
return new Promise(resolve => {
let localeObserver = {
- observe(aSubject, aTopic, aData) {
+ observe(aSubject, aTopic) {
switch (aTopic) {
case REQ_LOC_CHANGE_EVENT:
let reqLocs = Services.locale.requestedLocales;
@@ -169,7 +169,7 @@ function promiseLocaleChanged(requestedLocale) {
function promiseMetaDataUpdate() {
return new Promise(resolve => {
- let listener = args => {
+ let listener = () => {
Services.prefs.removeObserver(PREF_METADATA_LASTUPDATE, listener);
resolve();
};
diff --git a/toolkit/mozapps/extensions/test/xpcshell/test_ProductAddonChecker_signatures.js b/toolkit/mozapps/extensions/test/xpcshell/test_ProductAddonChecker_signatures.js
index 5ae61568ef..93602ffac9 100644
--- a/toolkit/mozapps/extensions/test/xpcshell/test_ProductAddonChecker_signatures.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_ProductAddonChecker_signatures.js
@@ -98,7 +98,8 @@ add_task(async function test_valid_content_signature() {
signedBaseUri + goodXmlPath + "?" + validSignatureQuery,
/*allowNonBuiltIn*/ false,
/*allowedCerts*/ false,
- /*verifyContentSignature*/ true
+ /*verifyContentSignature*/ true,
+ /*trustedContentSignatureRoot*/ Ci.nsIX509CertDB.AppXPCShellRoot
);
Assert.ok(true, "Should successfully get addon list");
@@ -122,7 +123,8 @@ add_task(async function test_invalid_content_signature() {
signedBaseUri + goodXmlPath + "?" + invalidSignatureQuery,
/*allowNonBuiltIn*/ false,
/*allowedCerts*/ false,
- /*verifyContentSignature*/ true
+ /*verifyContentSignature*/ true,
+ /*trustedContentSignatureRoot*/ Ci.nsIX509CertDB.AppXPCShellRoot
);
Assert.ok(false, "Should fail to get addon list");
} catch (e) {
@@ -143,7 +145,8 @@ add_task(async function test_missing_content_signature_header() {
signedBaseUri + goodXmlPath + "?" + missingSignatureQuery,
/*allowNonBuiltIn*/ false,
/*allowedCerts*/ false,
- /*verifyContentSignature*/ true
+ /*verifyContentSignature*/ true,
+ /*trustedContentSignatureRoot*/ Ci.nsIX509CertDB.AppXPCShellRoot
);
Assert.ok(false, "Should fail to get addon list");
} catch (e) {
@@ -165,7 +168,8 @@ add_task(async function test_incomplete_content_signature_header() {
signedBaseUri + goodXmlPath + "?" + incompleteSignatureQuery,
/*allowNonBuiltIn*/ false,
/*allowedCerts*/ false,
- /*verifyContentSignature*/ true
+ /*verifyContentSignature*/ true,
+ /*trustedContentSignatureRoot*/ Ci.nsIX509CertDB.AppXPCShellRoot
);
Assert.ok(false, "Should fail to get addon list");
} catch (e) {
@@ -187,7 +191,8 @@ add_task(async function test_bad_x5u_content_signature_header() {
signedBaseUri + goodXmlPath + "?" + badX5uSignatureQuery,
/*allowNonBuiltIn*/ false,
/*allowedCerts*/ false,
- /*verifyContentSignature*/ true
+ /*verifyContentSignature*/ true,
+ /*trustedContentSignatureRoot*/ Ci.nsIX509CertDB.AppXPCShellRoot
);
Assert.ok(false, "Should fail to get addon list");
} catch (e) {
diff --git a/toolkit/mozapps/extensions/test/xpcshell/test_addon_manager_telemetry_events.js b/toolkit/mozapps/extensions/test/xpcshell/test_addon_manager_telemetry_events.js
index 6a533f540a..d4103420ff 100644
--- a/toolkit/mozapps/extensions/test/xpcshell/test_addon_manager_telemetry_events.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_addon_manager_telemetry_events.js
@@ -40,7 +40,7 @@ function getTelemetryEvents(includeMethods = EVENT_METHODS) {
);
return snapshot.parent
- .filter(([timestamp, category, method]) => {
+ .filter(([, category, method]) => {
const includeMethod = includeMethods
? includeMethods.includes(method)
: true;
@@ -68,11 +68,9 @@ function assertNoTelemetryEvents() {
return;
}
- let filteredEvents = snapshot.parent.filter(
- ([timestamp, category, method]) => {
- return category === EVENT_CATEGORY;
- }
- );
+ let filteredEvents = snapshot.parent.filter(([_timestamp, category]) => {
+ return category === EVENT_CATEGORY;
+ });
Assert.deepEqual(filteredEvents, [], "Got no AMTelemetry events as expected");
}
diff --git a/toolkit/mozapps/extensions/test/xpcshell/test_delay_update_webextension.js b/toolkit/mozapps/extensions/test/xpcshell/test_delay_update_webextension.js
index 7b1c6fbef9..579f99687f 100644
--- a/toolkit/mozapps/extensions/test/xpcshell/test_delay_update_webextension.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_delay_update_webextension.js
@@ -206,7 +206,7 @@ add_task(async function delay_updates_complete() {
},
},
background() {
- browser.runtime.onUpdateAvailable.addListener(details => {
+ browser.runtime.onUpdateAvailable.addListener(() => {
browser.test.notifyPass("reload");
browser.runtime.reload();
});
@@ -273,7 +273,7 @@ add_task(async function delay_updates_defer() {
},
},
background() {
- browser.runtime.onUpdateAvailable.addListener(details => {
+ browser.runtime.onUpdateAvailable.addListener(() => {
// Upgrade will only proceed when "allow" message received.
browser.test.onMessage.addListener(msg => {
if (msg == "allow") {
@@ -371,7 +371,7 @@ add_task(async function delay_updates_staged() {
},
},
background() {
- browser.runtime.onUpdateAvailable.addListener(details => {
+ browser.runtime.onUpdateAvailable.addListener(() => {
browser.test.sendMessage("denied");
});
browser.test.sendMessage("ready");
@@ -443,7 +443,7 @@ add_task(async function delay_updates_staged_no_update_url() {
},
},
background() {
- browser.runtime.onUpdateAvailable.addListener(details => {
+ browser.runtime.onUpdateAvailable.addListener(() => {
browser.test.sendMessage("denied");
});
browser.test.sendMessage("ready");
diff --git a/toolkit/mozapps/extensions/test/xpcshell/test_installOrigins.js b/toolkit/mozapps/extensions/test/xpcshell/test_installOrigins.js
index 7ef584b54d..0b1690f5a8 100644
--- a/toolkit/mozapps/extensions/test/xpcshell/test_installOrigins.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_installOrigins.js
@@ -179,7 +179,7 @@ function testInstallEvent(expectTelemetry) {
let events = snapshot.parent
.filter(
- ([timestamp, category, method, object, value, extra]) =>
+ ([, category, method, , , extra]) =>
category === "addonsManager" &&
method == "install" &&
extra.step == expectTelemetry.step
@@ -229,15 +229,13 @@ function promiseCompleteWebInstall(
installInfo.install();
});
- TestUtils.topicObserved("addon-install-confirmation").then(
- (subject, data) => {
- info(`==== test got addon-install-confirmation`);
- let installInfo = subject.wrappedJSObject;
- for (let installer of installInfo.installs) {
- installer.install();
- }
+ TestUtils.topicObserved("addon-install-confirmation").then(subject => {
+ info(`==== test got addon-install-confirmation`);
+ let installInfo = subject.wrappedJSObject;
+ for (let installer of installInfo.installs) {
+ installer.install();
}
- );
+ });
TestUtils.topicObserved("webextension-permission-prompt").then(
([subject]) => {
const { info } = subject.wrappedJSObject || {};
diff --git a/toolkit/mozapps/extensions/test/xpcshell/test_install_cancel.js b/toolkit/mozapps/extensions/test/xpcshell/test_install_cancel.js
index 0be6ec0359..b5902bc6ba 100644
--- a/toolkit/mozapps/extensions/test/xpcshell/test_install_cancel.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_install_cancel.js
@@ -35,7 +35,7 @@ class TestListener {
function startListener(listener) {
let observer = {
- observe(subject, topic, data) {
+ observe(subject) {
let channel = subject.QueryInterface(Ci.nsIHttpChannel);
if (channel.URI.spec === "http://example.com/addons/test.xpi") {
let channelListener = new TestListener(listener);
diff --git a/toolkit/mozapps/extensions/test/xpcshell/test_provider_markSafe.js b/toolkit/mozapps/extensions/test/xpcshell/test_provider_markSafe.js
index e8062a2caf..033acf3dfc 100644
--- a/toolkit/mozapps/extensions/test/xpcshell/test_provider_markSafe.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_provider_markSafe.js
@@ -12,7 +12,7 @@ function mockAddonProvider(name) {
AddonManager.isInstallEnabled("made-up-mimetype");
},
- supportsMimetype(mimetype) {
+ supportsMimetype() {
this.apiAccessed = true;
return false;
},
diff --git a/toolkit/mozapps/extensions/test/xpcshell/test_provider_shutdown.js b/toolkit/mozapps/extensions/test/xpcshell/test_provider_shutdown.js
index 498b28a0c9..47612f1565 100644
--- a/toolkit/mozapps/extensions/test/xpcshell/test_provider_shutdown.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_provider_shutdown.js
@@ -31,7 +31,7 @@ function mockAddonProvider(aName) {
mockProvider.doneResolve = resolve;
mockProvider.doneReject = reject;
});
- mockProvider.shutdownPromise = new Promise((resolve, reject) => {
+ mockProvider.shutdownPromise = new Promise(resolve => {
mockProvider.shutdownResolve = resolve;
});
return mockProvider;
diff --git a/toolkit/mozapps/extensions/test/xpcshell/test_reload.js b/toolkit/mozapps/extensions/test/xpcshell/test_reload.js
index 993c4a9c53..92e67c53c1 100644
--- a/toolkit/mozapps/extensions/test/xpcshell/test_reload.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_reload.js
@@ -99,11 +99,11 @@ add_task(async function test_can_reload_permanent_addon() {
let disabledCalled = false;
let enabledCalled = false;
AddonManager.addAddonListener({
- onDisabled: aAddon => {
+ onDisabled: () => {
Assert.ok(!enabledCalled);
disabledCalled = true;
},
- onEnabled: aAddon => {
+ onEnabled: () => {
Assert.ok(disabledCalled);
enabledCalled = true;
},
diff --git a/toolkit/mozapps/extensions/test/xpcshell/test_signed_install.js b/toolkit/mozapps/extensions/test/xpcshell/test_signed_install.js
index 065463864d..99b6bca376 100644
--- a/toolkit/mozapps/extensions/test/xpcshell/test_signed_install.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_signed_install.js
@@ -195,25 +195,25 @@ async function test_update_working(file1, file2, expectedSignedState) {
await install.addon.uninstall();
}
-add_task(async function setup() {
+add_setup(async function setup() {
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "4", "4");
await promiseStartupManager();
});
// Try to install a broken add-on
-add_task(async function test_install_invalid_modified() {
+add_task(useAMOStageCert(), async function test_install_invalid_modified() {
let file = createBrokenAddonModify(do_get_file(DATA + ADDONS.signed1));
await test_install_broken(file, AddonManager.ERROR_CORRUPT_FILE);
file.remove(true);
});
-add_task(async function test_install_invalid_added() {
+add_task(useAMOStageCert(), async function test_install_invalid_added() {
let file = createBrokenAddonAdd(do_get_file(DATA + ADDONS.signed1));
await test_install_broken(file, AddonManager.ERROR_CORRUPT_FILE);
file.remove(true);
});
-add_task(async function test_install_invalid_removed() {
+add_task(useAMOStageCert(), async function test_install_invalid_removed() {
let file = createBrokenAddonRemove(do_get_file(DATA + ADDONS.signed1));
await test_install_broken(file, AddonManager.ERROR_CORRUPT_FILE);
file.remove(true);
@@ -226,58 +226,62 @@ add_task(async function test_install_invalid_unsigned() {
});
// Try to install a signed add-on
-add_task(async function test_install_valid() {
+add_task(useAMOStageCert(), async function test_install_valid() {
let file = do_get_file(DATA + ADDONS.signed1);
await test_install_working(file, AddonManager.SIGNEDSTATE_SIGNED);
});
add_task(
- {
- pref_set: [["xpinstall.signatures.dev-root", true]],
- // `xpinstall.signatures.dev-root` is not taken into account on release
- // builds because `MOZ_REQUIRE_SIGNING` is set to `true`.
- skip_if: () => AppConstants.MOZ_REQUIRE_SIGNING,
- },
- async function test_install_valid_file_with_different_root_cert() {
- const TEST_CASES = [
- {
- title: "XPI without ID in manifest",
- xpi: "data/webext-implicit-id.xpi",
- expectedMessage:
- /Cannot find id for addon .+ Preference xpinstall.signatures.dev-root is set/,
- },
- {
- title: "XPI with ID in manifest",
- xpi: DATA + ADDONS.signed1,
- expectedMessage: /Add-on test@somewhere.com is not correctly signed/,
- },
- ];
+ useAMOStageCert(),
+ async function test_install_implicit_id_with_different_root_cert() {
+ info(
+ `test install error on fail to verify signature on XPI without ID in manifest`
+ );
- for (const { title, xpi, expectedMessage } of TEST_CASES) {
- info(`test_install_valid_file_with_different_root_cert: ${title}`);
+ const xpi = do_get_file("data/webext-implicit-id.xpi");
+ const expectedMessage =
+ /Cannot find id for addon .+ Preference xpinstall.signatures.dev-root is set/;
- const file = do_get_file(xpi);
+ const { messages } = await AddonTestUtils.promiseConsoleOutput(async () => {
+ await test_install_broken(
+ xpi,
+ AddonManager.ERROR_CORRUPT_FILE,
+ // We don't expect the `addon` property on the `install` object to be
+ // `null` because that seems to happen later (when the signature is
+ // checked).
+ false
+ );
+ });
- const awaitConsole = new Promise(resolve => {
- Services.console.registerListener(function listener(message) {
- if (expectedMessage.test(message.message)) {
- Services.console.unregisterListener(listener);
- resolve();
- }
- });
- });
+ AddonTestUtils.checkMessages(messages, {
+ expected: [{ message: expectedMessage }],
+ });
+ }
+);
+add_task(
+ async function test_install_stage_signed_invalid_with_prod_root_cert() {
+ info(
+ `test install error on fail to verify signature on XPI with ID in manifest`
+ );
+
+ const xpi = do_get_file(DATA + ADDONS.signed1);
+ const expectedMessage = /Add-on test@somewhere.com is not correctly signed/;
+
+ const { messages } = await AddonTestUtils.promiseConsoleOutput(async () => {
await test_install_broken(
- file,
+ xpi,
AddonManager.ERROR_CORRUPT_FILE,
// We don't expect the `addon` property on the `install` object to be
// `null` because that seems to happen later (when the signature is
// checked).
false
);
+ });
- await awaitConsole;
- }
+ AddonTestUtils.checkMessages(messages, {
+ expected: [{ message: expectedMessage }],
+ });
}
);
@@ -291,25 +295,34 @@ add_task(async function test_install_valid_sha256() {
// Try to install an add-on with the "Mozilla Extensions" OU
add_task(async function test_install_valid_privileged() {
let file = do_get_file(DATA + ADDONS.privileged);
- await test_install_working(file, AddonManager.SIGNEDSTATE_PRIVILEGED);
+ try {
+ // Prevent install to fail due to privileged.xpi version using
+ // a version format that hits a manifest warning.
+ // TODO(Bug 1824240): remove this once privileged.xpi can be resigned with a
+ // version format that does not hit a manifest warning.
+ ExtensionTestUtils.failOnSchemaWarnings(false);
+ await test_install_working(file, AddonManager.SIGNEDSTATE_PRIVILEGED);
+ } finally {
+ ExtensionTestUtils.failOnSchemaWarnings(true);
+ }
});
// Try to update to a broken add-on
-add_task(async function test_update_invalid_modified() {
+add_task(useAMOStageCert(), async function test_update_invalid_modified() {
let file1 = do_get_file(DATA + ADDONS.signed1);
let file2 = createBrokenAddonModify(do_get_file(DATA + ADDONS.signed2));
await test_update_broken(file1, file2, AddonManager.ERROR_CORRUPT_FILE);
file2.remove(true);
});
-add_task(async function test_update_invalid_added() {
+add_task(useAMOStageCert(), async function test_update_invalid_added() {
let file1 = do_get_file(DATA + ADDONS.signed1);
let file2 = createBrokenAddonAdd(do_get_file(DATA + ADDONS.signed2));
await test_update_broken(file1, file2, AddonManager.ERROR_CORRUPT_FILE);
file2.remove(true);
});
-add_task(async function test_update_invalid_removed() {
+add_task(useAMOStageCert(), async function test_update_invalid_removed() {
let file1 = do_get_file(DATA + ADDONS.signed1);
let file2 = createBrokenAddonRemove(do_get_file(DATA + ADDONS.signed2));
await test_update_broken(file1, file2, AddonManager.ERROR_CORRUPT_FILE);
@@ -317,7 +330,7 @@ add_task(async function test_update_invalid_removed() {
});
// Try to update to an unsigned add-on
-add_task(async function test_update_invalid_unsigned() {
+add_task(useAMOStageCert(), async function test_update_invalid_unsigned() {
let file1 = do_get_file(DATA + ADDONS.signed1);
let file2 = do_get_file(DATA + ADDONS.unsigned);
await test_update_broken(
@@ -328,7 +341,7 @@ add_task(async function test_update_invalid_unsigned() {
});
// Try to update to a signed add-on
-add_task(async function test_update_valid() {
+add_task(useAMOStageCert(), async function test_update_valid() {
let file1 = do_get_file(DATA + ADDONS.signed1);
let file2 = do_get_file(DATA + ADDONS.signed2);
await test_update_working(file1, file2, AddonManager.SIGNEDSTATE_SIGNED);
diff --git a/toolkit/mozapps/extensions/test/xpcshell/test_signed_langpack.js b/toolkit/mozapps/extensions/test/xpcshell/test_signed_langpack.js
index 8ad83b2ecb..421d40f4a0 100644
--- a/toolkit/mozapps/extensions/test/xpcshell/test_signed_langpack.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_signed_langpack.js
@@ -32,7 +32,7 @@ async function installShouldFail(file) {
// Test that the preference controlling langpack signing works properly
// (and that the general preference for addon signing does not affect
// language packs).
-add_task(async function () {
+add_task(useAMOStageCert(), async function () {
AddonTestUtils.useRealCertChecks = true;
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1.9");
diff --git a/toolkit/mozapps/extensions/test/xpcshell/test_signed_long.js b/toolkit/mozapps/extensions/test/xpcshell/test_signed_long.js
index 2aa76e8ff8..6213aa0f1b 100644
--- a/toolkit/mozapps/extensions/test/xpcshell/test_signed_long.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_signed_long.js
@@ -4,7 +4,7 @@ const ID = "123456789012345678901234567890123456789012345678901@somewhere.com";
// Tests that signature verification works correctly on an extension with
// an ID that does not fit into a certificate CN field.
-add_task(async function test_long_id() {
+add_task(useAMOStageCert(), async function test_long_id() {
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1");
await promiseStartupManager();
diff --git a/toolkit/mozapps/extensions/test/xpcshell/test_signed_verify.js b/toolkit/mozapps/extensions/test/xpcshell/test_signed_verify.js
index c17cb941cb..e801485c73 100644
--- a/toolkit/mozapps/extensions/test/xpcshell/test_signed_verify.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_signed_verify.js
@@ -25,9 +25,439 @@ function verifySignatures() {
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "4", "4");
-add_task(async function test_no_change() {
+add_setup(async () => {
await promiseStartupManager();
+});
+
+add_task(function test_hasStrongSignature_helper() {
+ const { hasStrongSignature } = ChromeUtils.importESModule(
+ "resource://gre/modules/addons/crypto-utils.sys.mjs"
+ );
+ const { PKCS7_WITH_SHA1, PKCS7_WITH_SHA256, COSE_WITH_SHA256 } =
+ Ci.nsIAppSignatureInfo;
+ const testCases = [
+ [false, "SHA1 only", [PKCS7_WITH_SHA1]],
+ [true, "SHA256 only", [PKCS7_WITH_SHA256]],
+ [true, "COSE only", [COSE_WITH_SHA256]],
+ [true, "SHA1 and SHA256", [PKCS7_WITH_SHA1, PKCS7_WITH_SHA256]],
+ [true, "SHA1 and COSE", [PKCS7_WITH_SHA1, COSE_WITH_SHA256]],
+ [true, "SHA256 and COSE", [PKCS7_WITH_SHA256, COSE_WITH_SHA256]],
+ ];
+ for (const [expect, msg, signedTypes] of testCases) {
+ Assert.equal(hasStrongSignature({ signedTypes }), expect, msg);
+ }
+});
+
+add_task(async function test_addon_signedTypes() {
+ // This test is allowing weak signatures to run assertions on the AddonWrapper.signedTypes
+ // property also for extensions only including SHA1 signatures.
+ const resetWeakSignaturePref =
+ AddonTestUtils.setWeakSignatureInstallAllowed(true);
+
+ const { PKCS7_WITH_SHA1, COSE_WITH_SHA256 } = Ci.nsIAppSignatureInfo;
+
+ const { addon: addonSignedCOSE } = await promiseInstallFile(
+ do_get_file("amosigned-mv3-cose.xpi")
+ );
+ const { addon: addonSignedSHA1 } = await promiseInstallFile(
+ do_get_file("amosigned-sha1only.xpi")
+ );
+
+ Assert.deepEqual(
+ addonSignedCOSE.signedTypes.sort(),
+ [COSE_WITH_SHA256, PKCS7_WITH_SHA1].sort(),
+ `Expect ${addonSignedCOSE.id} to be signed with both COSE and SHA1`
+ );
+
+ Assert.deepEqual(
+ addonSignedSHA1.signedTypes,
+ [PKCS7_WITH_SHA1],
+ `Expect ${addonSignedSHA1.id} to be signed with SHA1 only`
+ );
+
+ await addonSignedSHA1.uninstall();
+ await addonSignedCOSE.uninstall();
+
+ resetWeakSignaturePref();
+});
+
+add_task(
+ async function test_install_error_on_new_install_with_weak_signature() {
+ // Ensure restrictions on weak signatures are enabled (this should be removed when
+ // the new behavior is riding the train).
+ const resetWeakSignaturePref =
+ AddonTestUtils.setWeakSignatureInstallAllowed(false);
+
+ const { messages } = await AddonTestUtils.promiseConsoleOutput(async () => {
+ let install = await AddonManager.getInstallForFile(
+ do_get_file("amosigned-sha1only.xpi")
+ );
+
+ await Assert.equal(
+ install.state,
+ AddonManager.STATE_DOWNLOAD_FAILED,
+ "Expect install state to be STATE_DOWNLOAD_FAILED"
+ );
+
+ await Assert.rejects(
+ install.install(),
+ /Install failed: onDownloadFailed/,
+ "Expected install to fail"
+ );
+ });
+
+ resetWeakSignaturePref();
+
+ // Checking the message expected to be logged in the Browser Console.
+ AddonTestUtils.checkMessages(messages, {
+ expected: [
+ {
+ message:
+ /Invalid XPI: install rejected due to the package not including a strong cryptographic signature/,
+ },
+ ],
+ });
+ }
+);
+
+/**
+ * Test helper used to simulate an update from a given pre-installed add-on xpi to a new xpi file for the same
+ * add-on and assert the expected result and logged messages.
+ *
+ * @param {object} params
+ * @param {string} params.currentAddonXPI
+ * The path to the add-on xpi to be pre-installed and then updated to `newAddonXPI`.
+ * @param {string} params.newAddonXPI
+ * The path to the add-on xpi to be installed as an update over `currentAddonXPI`.
+ * @param {string} params.newAddonVersion
+ * The add-on version expected for `newAddonXPI`.
+ * @param {boolean} params.expectedInstallOK
+ * Set to true for an update scenario that is expected to be successful.
+ * @param {Array<string|RegExp>} params.expectedMessages
+ * Array of strings or RegExp for console messages expected to be logged.
+ * @param {Array<string|RegExp>} params.forbiddenMessages
+ * Array of strings or RegExp for console messages expected to NOT be logged.
+ */
+async function testWeakSignatureXPIUpdate({
+ currentAddonXPI,
+ newAddonXPI,
+ newAddonVersion,
+ expectedInstallOK,
+ expectedMessages,
+ forbiddenMessages,
+}) {
+ // Temporarily allow weak signature to install the xpi as a new install.
+ let resetWeakSignaturePref =
+ AddonTestUtils.setWeakSignatureInstallAllowed(true);
+
+ const { addon: addonFirstInstall } = await promiseInstallFile(
+ currentAddonXPI
+ );
+ const addonId = addonFirstInstall.id;
+ const initialAddonVersion = addonFirstInstall.version;
+
+ resetWeakSignaturePref();
+
+ // Make sure the install over is executed while weak signature is not allowed
+ // for new installs to confirm that installing over is allowed.
+ resetWeakSignaturePref = AddonTestUtils.setWeakSignatureInstallAllowed(false);
+
+ info("Install over the existing installed addon");
+ let addonInstalledOver;
+ const { messages } = await AddonTestUtils.promiseConsoleOutput(async () => {
+ const fileURL = Services.io.newFileURI(newAddonXPI).spec;
+ let install = await AddonManager.getInstallForURL(fileURL, {
+ existingAddon: addonFirstInstall,
+ version: newAddonVersion,
+ });
+
+ addonInstalledOver = await install.install().catch(err => {
+ if (expectedInstallOK) {
+ ok(false, `Unexpected error hit on installing update XPI: ${err}`);
+ } else {
+ ok(true, `Install failed as expected: ${err}`);
+ }
+ });
+ });
+
+ resetWeakSignaturePref();
+
+ if (expectedInstallOK) {
+ Assert.equal(
+ addonInstalledOver.id,
+ addonFirstInstall.id,
+ "Expect addon id to be the same"
+ );
+ Assert.equal(
+ addonInstalledOver.version,
+ newAddonVersion,
+ "Got expected addon version after update xpi install completed"
+ );
+ await addonInstalledOver.uninstall();
+ } else {
+ Assert.equal(
+ addonInstalledOver?.version,
+ undefined,
+ "Expect update addon xpi not installed successfully"
+ );
+ Assert.equal(
+ (await AddonManager.getAddonByID(addonId)).version,
+ initialAddonVersion,
+ "Expect the addon version to match the initial XPI version"
+ );
+ await addonFirstInstall.uninstall();
+ }
+
+ Assert.equal(
+ await AddonManager.getAddonByID(addonId),
+ undefined,
+ "Expect the test addon to be fully uninstalled"
+ );
+
+ // Checking the message logged in the Browser Console.
+ AddonTestUtils.checkMessages(messages, {
+ expected: expectedMessages,
+ forbidden: forbiddenMessages,
+ });
+}
+
+add_task(async function test_weak_install_over_weak_existing() {
+ const addonId = "amosigned-xpi@tests.mozilla.org";
+ await testWeakSignatureXPIUpdate({
+ currentAddonXPI: do_get_file("amosigned-sha1only.xpi"),
+ newAddonXPI: do_get_file("amosigned-sha1only.xpi"),
+ newAddonVersion: "2.1",
+ expectedInstallOK: true,
+ expectedMessages: [
+ {
+ message: new RegExp(
+ `Allow weak signature install over existing "${addonId}" XPI`
+ ),
+ },
+ ],
+ });
+});
+
+add_task(async function test_update_weak_to_strong_signature() {
+ const addonId = "amosigned-xpi@tests.mozilla.org";
+ await testWeakSignatureXPIUpdate({
+ currentAddonXPI: do_get_file("amosigned-sha1only.xpi"),
+ newAddonXPI: do_get_file("amosigned.xpi"),
+ newAddonVersion: "2.2",
+ expectedInstallOK: true,
+ forbiddenMessages: [
+ {
+ message: new RegExp(
+ `Allow weak signature install over existing "${addonId}" XPI`
+ ),
+ },
+ ],
+ });
+});
+
+add_task(async function test_update_strong_to_weak_signature() {
+ const addonId = "amosigned-xpi@tests.mozilla.org";
+ await testWeakSignatureXPIUpdate({
+ currentAddonXPI: do_get_file("amosigned.xpi"),
+ newAddonXPI: do_get_file("amosigned-sha1only.xpi"),
+ newAddonVersion: "2.1",
+ expectedInstallOK: false,
+ expectedMessages: [
+ {
+ message: new RegExp(
+ "Invalid XPI: install rejected due to the package not including a strong cryptographic signature"
+ ),
+ },
+ ],
+ forbiddenMessages: [
+ {
+ message: new RegExp(
+ `Allow weak signature install over existing "${addonId}" XPI`
+ ),
+ },
+ ],
+ });
+});
+
+add_task(async function test_signedTypes_stored_in_addonDB() {
+ const { addon: addonAfterInstalled } = await promiseInstallFile(
+ do_get_file("amosigned-mv3-cose.xpi")
+ );
+ const addonId = addonAfterInstalled.id;
+
+ const { PKCS7_WITH_SHA1, COSE_WITH_SHA256 } = Ci.nsIAppSignatureInfo;
+ const expectedSignedTypes = [COSE_WITH_SHA256, PKCS7_WITH_SHA1].sort();
+
+ Assert.deepEqual(
+ addonAfterInstalled.signedTypes.sort(),
+ expectedSignedTypes,
+ `Got expected ${addonId} signedTyped after install`
+ );
+
+ await promiseRestartManager();
+
+ const addonAfterAOMRestart = await AddonManager.getAddonByID(addonId);
+
+ Assert.deepEqual(
+ addonAfterAOMRestart.signedTypes.sort(),
+ expectedSignedTypes,
+ `Got expected ${addonId} signedTyped after AOM restart`
+ );
+
+ const removeSignedStateFromAddonDB = async () => {
+ const addon_db_file = Services.dirsvc.get("ProfD", Ci.nsIFile);
+ addon_db_file.append("extensions.json");
+ const addon_db_data = await IOUtils.readJSON(addon_db_file.path);
+
+ const addon_db_data_tampered = {
+ ...addon_db_data,
+ addons: addon_db_data.addons.map(addonData => {
+ // Tamper the data of the test extension to mock the
+ // scenario.
+ delete addonData.signedTypes;
+ return addonData;
+ }),
+ };
+ await IOUtils.writeJSON(addon_db_file.path, addon_db_data_tampered);
+ };
+
+ // Shutdown the AddonManager and tamper the AddonDB to confirm XPIProvider.checkForChanges
+ // calls originated internally when opening a profile created from a previous Firefox version
+ // is going to populate the new signedTypes property.
+ info(
+ "Check that XPIProvider.checkForChanges(true) will recompute missing signedTypes properties"
+ );
+ await promiseShutdownManager();
+ await removeSignedStateFromAddonDB();
+ await promiseStartupManager();
+
+ // Expect the signedTypes property to be undefined because of the
+ // AddonDB data being tampered earlier in this test.
+ const addonAfterAppUpgrade = await AddonManager.getAddonByID(addonId);
+ Assert.deepEqual(
+ addonAfterAppUpgrade.signedTypes,
+ undefined,
+ `Got empty ${addonId} signedTyped set to undefied after AddonDB data tampered`
+ );
+
+ // Mock call to XPIDatabase.checkForChanges expected to be hit when the application
+ // is updated.
+ AddonTestUtils.getXPIExports().XPIProvider.checkForChanges(
+ /* aAppChanged */ true
+ );
+
+ Assert.deepEqual(
+ addonAfterAppUpgrade.signedTypes?.sort(),
+ expectedSignedTypes.sort(),
+ `Got expected ${addonId} signedTyped after XPIProvider.checkForChanges recomputed it`
+ );
+
+ // Shutdown the AddonManager and tamper the AddonDB to confirm XPIDatabase.updateCompatibility
+ // would populate signedTypes if missing.
+ info(
+ "Check that XPIDatabase.updateCompatibility will recompute missing signedTypes properties"
+ );
+ await promiseShutdownManager();
+ await removeSignedStateFromAddonDB();
+ await promiseStartupManager();
+
+ // Expect the signedTypes property to be undefined because of the
+ // AddonDB data being tampered earlier in this test.
+ const addonAfterUpdateCompatibility = await AddonManager.getAddonByID(
+ addonId
+ );
+ Assert.deepEqual(
+ addonAfterUpdateCompatibility.signedTypes,
+ undefined,
+ `Got empty ${addonId} signedTyped set to undefied after AddonDB data tampered`
+ );
+
+ // Mock call to XPIDatabase.updateCompatibility expected to be originated from
+ // XPIDatabaseReconcile.processFileChanges and confirm that signedTypes has been
+ // recomputed as expected.
+ AddonTestUtils.getXPIExports().XPIDatabaseReconcile.processFileChanges(
+ {},
+ true
+ );
+ Assert.deepEqual(
+ addonAfterUpdateCompatibility.signedTypes?.sort(),
+ expectedSignedTypes.sort(),
+ `Got expected ${addonId} signedTyped after XPIDatabase.updateCompatibility recomputed it`
+ );
+
+ // Restart the AddonManager and confirm that XPIDatabase.verifySignatures would not recompute
+ // the content of the signedTypes array if all values are still the same.
+ info(
+ "Check that XPIDatabase.updateCompatibility will recompute missing signedTypes properties"
+ );
+ await promiseRestartManager();
+
+ let listener = {
+ onPropertyChanged(_addon, properties) {
+ Assert.deepEqual(
+ properties,
+ [],
+ `No properties should have been changed for ${_addon.id}`
+ );
+ Assert.ok(
+ false,
+ `onPropertyChanged should have not been called for ${_addon.id}`
+ );
+ },
+ };
+
+ AddonManager.addAddonListener(listener);
+ await verifySignatures();
+ AddonManager.removeAddonListener(listener);
+
+ // Shutdown the AddonManager and tamper the AddonDB to set signedTypes to undefined
+ // then confirm that XPIDatabase.verifySignatures does not hit an exception due to
+ // signedTypes assumed to always be set to an array.
+ info(
+ "Check that XPIDatabase.verifySignatures does not fail when signedTypes is undefined"
+ );
+ await promiseShutdownManager();
+ await removeSignedStateFromAddonDB();
+ await promiseStartupManager();
+
+ // Expect the signedTypes property to be undefined because of the
+ // AddonDB data being tampered earlier in this test.
+ const addonUndefinedSignedTypes = await AddonManager.getAddonByID(addonId);
+ Assert.deepEqual(
+ addonUndefinedSignedTypes.signedTypes,
+ undefined,
+ `Got empty ${addonId} signedTyped set to undefied after AddonDB data tampered`
+ );
+ await verifySignatures();
+ Assert.deepEqual(
+ addonUndefinedSignedTypes.signedTypes?.sort(),
+ expectedSignedTypes.sort(),
+ `Got expected ${addonId} signedTyped after XPIDatabase.verifySignatures recomputed it`
+ );
+
+ await addonUndefinedSignedTypes.uninstall();
+});
+
+add_task(
+ {
+ pref_set: [["xpinstall.signatures.required", false]],
+ // Skip this test on builds where disabling xpi signature checks is not supported.
+ skip_if: () => AppConstants.MOZ_REQUIRE_SIGNING,
+ },
+ async function test_weak_signature_not_restricted_on_disabled_signature_checks() {
+ // Ensure the restriction on installing xpi using only weak signatures is enabled.
+ let resetWeakSignaturePref =
+ AddonTestUtils.setWeakSignatureInstallAllowed(false);
+ const { addon } = await promiseInstallFile(
+ do_get_file("amosigned-sha1only.xpi")
+ );
+ Assert.notEqual(addon, null, "Expect addon to be installed");
+ resetWeakSignaturePref();
+ await addon.uninstall();
+ }
+);
+add_task(useAMOStageCert(), async function test_no_change() {
// Install the first add-on
await promiseInstallFile(do_get_file(`${DATA}/signed1.xpi`));
@@ -43,7 +473,7 @@ add_task(async function test_no_change() {
await manuallyInstall(do_get_file(`${DATA}/signed2.xpi`), profileDir, ID);
let listener = {
- onPropetyChanged(_addon, properties) {
+ onPropertyChanged(_addon) {
Assert.ok(false, `Got unexpected onPropertyChanged for ${_addon.id}`);
},
};
@@ -63,7 +493,7 @@ add_task(async function test_no_change() {
AddonManager.removeAddonListener(listener);
});
-add_task(async function test_diable() {
+add_task(useAMOStageCert(), async function test_disable() {
// Install the first add-on
await promiseInstallFile(do_get_file(`${DATA}/signed1.xpi`));
@@ -96,7 +526,7 @@ add_task(async function test_diable() {
Assert.deepEqual(
changedProperties,
- ["signedState", "appDisabled"],
+ ["signedState", "signedTypes", "appDisabled"],
"Got onPropertyChanged events for signedState and appDisabled"
);
diff --git a/toolkit/mozapps/extensions/test/xpcshell/test_system_delay_update.js b/toolkit/mozapps/extensions/test/xpcshell/test_system_delay_update.js
index 4490ec065b..b7dfd0ba72 100644
--- a/toolkit/mozapps/extensions/test/xpcshell/test_system_delay_update.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_system_delay_update.js
@@ -26,7 +26,7 @@ registerCleanupFunction(() => {
distroDir.remove(true);
});
-AddonTestUtils.usePrivilegedSignatures = id => "system";
+AddonTestUtils.usePrivilegedSignatures = () => "system";
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "42");
diff --git a/toolkit/mozapps/extensions/test/xpcshell/test_system_repository.js b/toolkit/mozapps/extensions/test/xpcshell/test_system_repository.js
index dc1c96e7bc..342410992b 100644
--- a/toolkit/mozapps/extensions/test/xpcshell/test_system_repository.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_system_repository.js
@@ -29,7 +29,7 @@ add_task(async function test_app_addons() {
`http://localhost:${gServer.identity.primaryPort}/get?%IDS%`
);
- gServer.registerPathHandler("/get", (request, response) => {
+ gServer.registerPathHandler("/get", () => {
do_throw("Unexpected request to server.");
});
diff --git a/toolkit/mozapps/extensions/test/xpcshell/test_system_reset.js b/toolkit/mozapps/extensions/test/xpcshell/test_system_reset.js
index 93e4c516fa..37e056c140 100644
--- a/toolkit/mozapps/extensions/test/xpcshell/test_system_reset.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_system_reset.js
@@ -3,7 +3,7 @@
const updatesDir = FileUtils.getDir("ProfD", ["features"]);
-AddonTestUtils.usePrivilegedSignatures = id => "system";
+AddonTestUtils.usePrivilegedSignatures = () => "system";
add_task(async function setup() {
// Build the test sets
@@ -489,7 +489,7 @@ add_task(async function test_bad_app_cert() {
await promiseShutdownManager();
- AddonTestUtils.usePrivilegedSignatures = id => "system";
+ AddonTestUtils.usePrivilegedSignatures = () => "system";
});
// A failed upgrade should revert to the default set.
diff --git a/toolkit/mozapps/extensions/test/xpcshell/test_system_update_blank.js b/toolkit/mozapps/extensions/test/xpcshell/test_system_update_blank.js
index 56d10436c7..a60d72f8b3 100644
--- a/toolkit/mozapps/extensions/test/xpcshell/test_system_update_blank.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_system_update_blank.js
@@ -6,7 +6,7 @@ let distroDir = FileUtils.getDir("ProfD", ["sysfeatures", "empty"]);
distroDir.create(Ci.nsIFile.DIRECTORY_TYPE, FileUtils.PERMS_DIRECTORY);
registerDirectory("XREAppFeat", distroDir);
-AddonTestUtils.usePrivilegedSignatures = id => "system";
+AddonTestUtils.usePrivilegedSignatures = () => "system";
add_task(() => initSystemAddonDirs());
diff --git a/toolkit/mozapps/extensions/test/xpcshell/test_system_update_checkSizeHash.js b/toolkit/mozapps/extensions/test/xpcshell/test_system_update_checkSizeHash.js
index f9ac09255a..456164dfae 100644
--- a/toolkit/mozapps/extensions/test/xpcshell/test_system_update_checkSizeHash.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_system_update_checkSizeHash.js
@@ -6,7 +6,7 @@ let distroDir = FileUtils.getDir("ProfD", ["sysfeatures", "empty"]);
distroDir.create(Ci.nsIFile.DIRECTORY_TYPE, FileUtils.PERMS_DIRECTORY);
registerDirectory("XREAppFeat", distroDir);
-AddonTestUtils.usePrivilegedSignatures = id => "system";
+AddonTestUtils.usePrivilegedSignatures = () => "system";
/**
* Defines the set of initial conditions to run each test against. Each should
diff --git a/toolkit/mozapps/extensions/test/xpcshell/test_system_update_custom.js b/toolkit/mozapps/extensions/test/xpcshell/test_system_update_custom.js
index b0310d3ceb..22250d6724 100644
--- a/toolkit/mozapps/extensions/test/xpcshell/test_system_update_custom.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_system_update_custom.js
@@ -6,7 +6,7 @@ let distroDir = FileUtils.getDir("ProfD", ["sysfeatures", "empty"]);
distroDir.create(Ci.nsIFile.DIRECTORY_TYPE, FileUtils.PERMS_DIRECTORY);
registerDirectory("XREAppFeat", distroDir);
-AddonTestUtils.usePrivilegedSignatures = id => "system";
+AddonTestUtils.usePrivilegedSignatures = () => "system";
add_task(initSystemAddonDirs);
diff --git a/toolkit/mozapps/extensions/test/xpcshell/test_system_update_empty.js b/toolkit/mozapps/extensions/test/xpcshell/test_system_update_empty.js
index 3fae4272be..16c2084842 100644
--- a/toolkit/mozapps/extensions/test/xpcshell/test_system_update_empty.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_system_update_empty.js
@@ -6,7 +6,7 @@ let distroDir = FileUtils.getDir("ProfD", ["sysfeatures", "empty"]);
distroDir.create(Ci.nsIFile.DIRECTORY_TYPE, FileUtils.PERMS_DIRECTORY);
registerDirectory("XREAppFeat", distroDir);
-AddonTestUtils.usePrivilegedSignatures = id => "system";
+AddonTestUtils.usePrivilegedSignatures = () => "system";
add_task(() => initSystemAddonDirs());
diff --git a/toolkit/mozapps/extensions/test/xpcshell/test_system_update_installTelemetryInfo.js b/toolkit/mozapps/extensions/test/xpcshell/test_system_update_installTelemetryInfo.js
index f67894289d..bc690cad71 100644
--- a/toolkit/mozapps/extensions/test/xpcshell/test_system_update_installTelemetryInfo.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_system_update_installTelemetryInfo.js
@@ -7,7 +7,7 @@ let distroDir = FileUtils.getDir("ProfD", ["sysfeatures", "empty"]);
distroDir.create(Ci.nsIFile.DIRECTORY_TYPE, FileUtils.PERMS_DIRECTORY);
registerDirectory("XREAppFeat", distroDir);
-AddonTestUtils.usePrivilegedSignatures = id => "system";
+AddonTestUtils.usePrivilegedSignatures = () => "system";
add_task(() => initSystemAddonDirs());
diff --git a/toolkit/mozapps/extensions/test/xpcshell/test_system_update_newset.js b/toolkit/mozapps/extensions/test/xpcshell/test_system_update_newset.js
index fd93ba5d38..3a1746d28c 100644
--- a/toolkit/mozapps/extensions/test/xpcshell/test_system_update_newset.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_system_update_newset.js
@@ -6,7 +6,7 @@ let distroDir = FileUtils.getDir("ProfD", ["sysfeatures", "empty"]);
distroDir.create(Ci.nsIFile.DIRECTORY_TYPE, FileUtils.PERMS_DIRECTORY);
registerDirectory("XREAppFeat", distroDir);
-AddonTestUtils.usePrivilegedSignatures = id => "system";
+AddonTestUtils.usePrivilegedSignatures = () => "system";
add_task(() => initSystemAddonDirs());
diff --git a/toolkit/mozapps/extensions/test/xpcshell/test_system_update_overlapping.js b/toolkit/mozapps/extensions/test/xpcshell/test_system_update_overlapping.js
index a6c5bc905c..61d3d91300 100644
--- a/toolkit/mozapps/extensions/test/xpcshell/test_system_update_overlapping.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_system_update_overlapping.js
@@ -7,7 +7,7 @@ distroDir.create(Ci.nsIFile.DIRECTORY_TYPE, FileUtils.PERMS_DIRECTORY);
registerDirectory("XREAppFeat", distroDir);
add_task(() => initSystemAddonDirs());
-AddonTestUtils.usePrivilegedSignatures = id => "system";
+AddonTestUtils.usePrivilegedSignatures = () => "system";
/**
* Defines the set of initial conditions to run each test against. Each should
diff --git a/toolkit/mozapps/extensions/test/xpcshell/test_system_update_uninstall_check.js b/toolkit/mozapps/extensions/test/xpcshell/test_system_update_uninstall_check.js
index bf2dd85772..b2daa307db 100644
--- a/toolkit/mozapps/extensions/test/xpcshell/test_system_update_uninstall_check.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_system_update_uninstall_check.js
@@ -35,7 +35,7 @@ add_task(async function test_systems_update_uninstall_check() {
},
]);
- const listener = (msg, { method, params, reason }) => {
+ const listener = (msg, { method, params }) => {
if (params.id === "system2@tests.mozilla.org" && method === "uninstall") {
Assert.ok(
false,
diff --git a/toolkit/mozapps/extensions/test/xpcshell/test_system_update_upgrades.js b/toolkit/mozapps/extensions/test/xpcshell/test_system_update_upgrades.js
index d270f33190..8e2d7776ef 100644
--- a/toolkit/mozapps/extensions/test/xpcshell/test_system_update_upgrades.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_system_update_upgrades.js
@@ -6,7 +6,7 @@ let distroDir = FileUtils.getDir("ProfD", ["sysfeatures", "empty"]);
distroDir.create(Ci.nsIFile.DIRECTORY_TYPE, FileUtils.PERMS_DIRECTORY);
registerDirectory("XREAppFeat", distroDir);
-AddonTestUtils.usePrivilegedSignatures = id => "system";
+AddonTestUtils.usePrivilegedSignatures = () => "system";
add_task(() => initSystemAddonDirs());
diff --git a/toolkit/mozapps/extensions/test/xpcshell/test_system_upgrades.js b/toolkit/mozapps/extensions/test/xpcshell/test_system_upgrades.js
index f02003805c..ddf98c73ec 100644
--- a/toolkit/mozapps/extensions/test/xpcshell/test_system_upgrades.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_system_upgrades.js
@@ -20,7 +20,7 @@ const systemDefaults = FileUtils.getDir("ProfD", [
systemDefaults.create(Ci.nsIFile.DIRECTORY_TYPE, FileUtils.PERMS_DIRECTORY);
registerDirectory("XREAppFeat", systemDefaults);
-AddonTestUtils.usePrivilegedSignatures = id => "system";
+AddonTestUtils.usePrivilegedSignatures = () => "system";
const ADDON_ID = "updates@test";
diff --git a/toolkit/mozapps/extensions/test/xpcshell/test_temporary.js b/toolkit/mozapps/extensions/test/xpcshell/test_temporary.js
index 80faa57fc1..0bef760261 100644
--- a/toolkit/mozapps/extensions/test/xpcshell/test_temporary.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_temporary.js
@@ -80,7 +80,7 @@ add_task(async function test_new_temporary() {
Assert.equal(aInstall.version, "1.0");
installedCalled = true;
},
- onInstallStarted: aInstall => {
+ onInstallStarted: () => {
do_throw("onInstallStarted called unexpectedly");
},
});
@@ -416,7 +416,7 @@ add_task(async function test_replace_permanent() {
}
installedCalled = true;
},
- onInstallStarted: aInstall => {
+ onInstallStarted: () => {
do_throw("onInstallStarted called unexpectedly");
},
});
diff --git a/toolkit/mozapps/extensions/test/xpcshell/test_update.js b/toolkit/mozapps/extensions/test/xpcshell/test_update.js
index 1bd41e8d71..708b9de264 100644
--- a/toolkit/mozapps/extensions/test/xpcshell/test_update.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_update.js
@@ -595,25 +595,22 @@ add_task(async function test_params() {
let resultsPromise = new Promise(resolve => {
let results = new Map();
- testserver.registerPathHandler(
- "/data/param_test.json",
- function (request, response) {
- let params = new URLSearchParams(request.queryString);
- let itemId = params.get("item_id");
- ok(
- !results.has(itemId),
- `Should not see a duplicate request for item ${itemId}`
- );
-
- results.set(itemId, params);
-
- if (results.size === PARAM_IDS.length) {
- resolve(results);
- }
-
- request.setStatusLine(null, 500, "Server Error");
+ testserver.registerPathHandler("/data/param_test.json", function (request) {
+ let params = new URLSearchParams(request.queryString);
+ let itemId = params.get("item_id");
+ ok(
+ !results.has(itemId),
+ `Should not see a duplicate request for item ${itemId}`
+ );
+
+ results.set(itemId, params);
+
+ if (results.size === PARAM_IDS.length) {
+ resolve(results);
}
- );
+
+ request.setStatusLine(null, 500, "Server Error");
+ });
});
let addons = await getAddons(PARAM_IDS);
@@ -746,11 +743,11 @@ add_task(async function test_no_auto_update() {
equal(aInstall.existingAddon.id, "addon1@tests.mozilla.org");
},
- onDownloadFailed(aInstall) {
+ onDownloadFailed() {
ok(false, "Should not have seen onDownloadFailed event");
},
- onDownloadCancelled(aInstall) {
+ onDownloadCancelled() {
ok(false, "Should not have seen onDownloadCancelled event");
},
@@ -764,11 +761,11 @@ add_task(async function test_no_auto_update() {
resolve();
},
- onInstallFailed(aInstall) {
+ onInstallFailed() {
ok(false, "Should not have seen onInstallFailed event");
},
- onInstallCancelled(aInstall) {
+ onInstallCancelled() {
ok(false, "Should not have seen onInstallCancelled event");
},
};
diff --git a/toolkit/mozapps/extensions/test/xpcshell/test_updateCancel.js b/toolkit/mozapps/extensions/test/xpcshell/test_updateCancel.js
index ac201f434c..bba7a1b77b 100644
--- a/toolkit/mozapps/extensions/test/xpcshell/test_updateCancel.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_updateCancel.js
@@ -27,7 +27,7 @@ function makeCancelListener() {
});
return {
- onUpdateAvailable(addon, install) {
+ onUpdateAvailable() {
reject("Should not have seen onUpdateAvailable notification");
},
diff --git a/toolkit/mozapps/extensions/test/xpcshell/test_update_addontype.js b/toolkit/mozapps/extensions/test/xpcshell/test_update_addontype.js
index ca324cf4ef..221f9e003e 100644
--- a/toolkit/mozapps/extensions/test/xpcshell/test_update_addontype.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_update_addontype.js
@@ -67,7 +67,7 @@ add_task(async function test_update_theme_to_extension() {
await Assert.rejects(
install.install(),
- err => install.error == AddonManager.ERROR_UNEXPECTED_ADDON_TYPE,
+ () => install.error == AddonManager.ERROR_UNEXPECTED_ADDON_TYPE,
"Refusing to change addon type from theme to extension"
);
diff --git a/toolkit/mozapps/extensions/test/xpcshell/test_update_noSystemAddonUpdate.js b/toolkit/mozapps/extensions/test/xpcshell/test_update_noSystemAddonUpdate.js
index f13187ab33..93ff750066 100644
--- a/toolkit/mozapps/extensions/test/xpcshell/test_update_noSystemAddonUpdate.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_update_noSystemAddonUpdate.js
@@ -25,7 +25,7 @@ add_task(async function test_systems_update_uninstall_check() {
await setupSystemAddonConditions(initialSetup, distroDir);
const testserver = createHttpServer({ hosts: ["example.com"] });
- testserver.registerPathHandler("/update.json", (request, response) => {
+ testserver.registerPathHandler("/update.json", request => {
Assert.ok(
!request._queryString.includes("system2@tests.mozilla.org"),
"System addon should not request update from normal update process"
diff --git a/toolkit/mozapps/extensions/test/xpcshell/test_updateid.js b/toolkit/mozapps/extensions/test/xpcshell/test_updateid.js
index c88c8e637b..06dd536b9a 100644
--- a/toolkit/mozapps/extensions/test/xpcshell/test_updateid.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_updateid.js
@@ -74,7 +74,7 @@ add_task(async function test_update_new_id() {
await Assert.rejects(
install.install(),
- err => install.error == AddonManager.ERROR_INCORRECT_ID,
+ () => install.error == AddonManager.ERROR_INCORRECT_ID,
"Upgrade to a different ID fails"
);
diff --git a/toolkit/mozapps/extensions/test/xpcshell/test_updateversion.js b/toolkit/mozapps/extensions/test/xpcshell/test_updateversion.js
index 4d1510c40f..5d6e045f21 100644
--- a/toolkit/mozapps/extensions/test/xpcshell/test_updateversion.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_updateversion.js
@@ -65,7 +65,7 @@ add_task(async function test_update_version_mismatch() {
await Assert.rejects(
install.install(),
- err => install.error == AddonManager.ERROR_UNEXPECTED_ADDON_VERSION,
+ () => install.error == AddonManager.ERROR_UNEXPECTED_ADDON_VERSION,
"Should refuse installation when downloaded version does not match"
);
diff --git a/toolkit/mozapps/extensions/test/xpcshell/test_webextension.js b/toolkit/mozapps/extensions/test/xpcshell/test_webextension.js
index cd4b376117..db5f1d5925 100644
--- a/toolkit/mozapps/extensions/test/xpcshell/test_webextension.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_webextension.js
@@ -316,6 +316,73 @@ add_task(async function test_options_ui() {
);
await addon.uninstall();
+
+ info("Test again with options_page manifest property");
+ const ID3 = "options_page_alias@tests.mozilla.org";
+ addon = await promiseInstallWebExtension({
+ manifest: {
+ browser_specific_settings: { gecko: { id: ID3 } },
+ options_page: "options.html",
+ },
+ });
+
+ checkAddon(ID3, addon, {
+ optionsType: AddonManager.OPTIONS_TYPE_TAB,
+ });
+
+ ok(
+ OPTIONS_RE.test(addon.optionsURL),
+ "Addon should have a moz-extension: options URL for /options.html"
+ );
+
+ await addon.uninstall();
+
+ info("Test options_page and options_page set to a different page");
+
+ const ID4 = "options_page_warning@tests.mozilla.org";
+ addon = await promiseInstallWebExtension({
+ manifest: {
+ browser_specific_settings: { gecko: { id: ID4 } },
+ options_page: "options_page.html",
+ options_ui: {
+ page: "options.html",
+ open_in_tab: false,
+ },
+ },
+ });
+
+ checkAddon(ID4, addon, {
+ optionsType: AddonManager.OPTIONS_TYPE_INLINE_BROWSER,
+ });
+
+ ok(
+ OPTIONS_RE.test(addon.optionsURL),
+ "Addon should have a moz-extension: options URL for /options.html"
+ );
+
+ await addon.uninstall();
+
+ info("Test options_page and options_page are both set to the same page");
+
+ const ID5 = "options_page_and_ui_same_page@tests.mozilla.org";
+ addon = await promiseInstallWebExtension({
+ manifest: {
+ browser_specific_settings: { gecko: { id: ID5 } },
+ options_page: "options.html",
+ options_ui: { page: "options.html" },
+ },
+ });
+
+ checkAddon(ID5, addon, {
+ optionsType: AddonManager.OPTIONS_TYPE_INLINE_BROWSER,
+ });
+
+ ok(
+ OPTIONS_RE.test(addon.optionsURL),
+ "Addon should have a moz-extension: options URL for /options.html"
+ );
+
+ await addon.uninstall();
});
// Test that experiments permissions add the appropriate dependencies.
diff --git a/toolkit/mozapps/extensions/test/xpcshell/test_webextension_install.js b/toolkit/mozapps/extensions/test/xpcshell/test_webextension_install.js
index 1b2080e8db..913c802609 100644
--- a/toolkit/mozapps/extensions/test/xpcshell/test_webextension_install.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_webextension_install.js
@@ -11,8 +11,10 @@ add_task(async function setup() {
await promiseStartupManager();
});
+// Extension without id in the manifest file and signed with AMO prod root
+// (https://addons.mozilla.org/en-US/firefox/addon/reference-static-theme/).
const IMPLICIT_ID_XPI = "data/webext-implicit-id.xpi";
-const IMPLICIT_ID_ID = "webext_implicit_id@tests.mozilla.org";
+const IMPLICIT_ID_ID = "{46607a7b-1b2a-40ce-9afe-91cda52c46a6}";
// webext-implicit-id.xpi has a minimal manifest with no
// applications or browser_specific_settings, so its id comes
diff --git a/toolkit/mozapps/extensions/test/xpcshell/xpcshell.toml b/toolkit/mozapps/extensions/test/xpcshell/xpcshell.toml
index 6b1cb010d4..e8d3807ab9 100644
--- a/toolkit/mozapps/extensions/test/xpcshell/xpcshell.toml
+++ b/toolkit/mozapps/extensions/test/xpcshell/xpcshell.toml
@@ -4,7 +4,12 @@ tags = "addons"
head = "head_addons.js"
firefox-appdir = "browser"
dupe-manifest = true
-support-files = ["data/**"]
+support-files = [
+ "data/**",
+ "../xpinstall/amosigned.xpi",
+ "../xpinstall/amosigned-mv3-cose.xpi",
+ "../xpinstall/amosigned-sha1only.xpi",
+]
["test_AMBrowserExtensionsImport.js"]