Loading modules/libpref/init/all.js +2 −0 Original line number Diff line number Diff line Loading @@ -1970,6 +1970,8 @@ pref("extensions.manifestV2.actionsPopupURLRestricted", false); #else pref("extensions.openPopupWithoutUserGesture.enabled", false); #endif // Install origins restriction. pref("extensions.install_origins.enabled", false); // Modifier key prefs: default to Windows settings, // menu access key = alt, accelerator key = control. Loading toolkit/mozapps/extensions/test/xpcshell/test_addon_manager_telemetry_events.js +402 −371 Original line number Diff line number Diff line Loading @@ -89,7 +89,13 @@ add_task(async function setup() { }); // Test the basic install and management flows. add_task(async function test_basic_telemetry_events() { add_task( { // We need to enable this pref because some assertions verify that // `installOrigins` is collected in some Telemetry events. pref_set: [["extensions.install_origins.enabled", true]], }, async function test_basic_telemetry_events() { const EXTENSION_ID = "basic@test.extension"; const manifest = { Loading Loading @@ -233,10 +239,21 @@ add_task(async function test_basic_telemetry_events() { .filter(evt => evt.method === "install") .map(evt => evt.value); const expectedValues = ["2", "2"]; Assert.deepEqual(eventValues, expectedValues, "Got the expected install id"); }); Assert.deepEqual( eventValues, expectedValues, "Got the expected install id" ); } ); add_task(async function test_update_telemetry_events() { add_task( { // We need to enable this pref because some assertions verify that // `installOrigins` is collected in some Telemetry events. pref_set: [["extensions.install_origins.enabled", true]], }, async function test_update_telemetry_events() { const EXTENSION_ID = "basic@test.extension"; const testserver = AddonTestUtils.createHttpServer({ Loading Loading @@ -316,7 +333,10 @@ add_task(async function test_update_telemetry_events() { let addon = await AddonManager.getAddonByID(EXTENSION_ID); // User requested update. await promiseFindAddonUpdates(addon, AddonManager.UPDATE_WHEN_USER_REQUESTED); await promiseFindAddonUpdates( addon, AddonManager.UPDATE_WHEN_USER_REQUESTED ); let installs = await AddonManager.getAllInstalls(); await promiseCompleteAllInstalls(installs); Loading Loading @@ -414,7 +434,12 @@ add_task(async function test_update_telemetry_events() { { method, object, extra: { ...baseExtra, addon_id, step: "started", updated_from: "user" }, extra: { ...baseExtra, addon_id, step: "started", updated_from: "user", }, }, { method, Loading Loading @@ -475,7 +500,12 @@ add_task(async function test_update_telemetry_events() { { method, object, extra: { ...baseExtra, addon_id, step: "completed", updated_from: "app" }, extra: { ...baseExtra, addon_id, step: "completed", updated_from: "app", }, }, // Broken update to the 2.1.1 version (on ERROR_NETWORK_FAILURE). { Loading Loading @@ -538,7 +568,8 @@ add_task(async function test_update_telemetry_events() { // Clear any AMTelemetry events related to the uninstalled extensions. getTelemetryEvents(); }); } ); add_task(async function test_no_telemetry_events_on_internal_sources() { assertNoTelemetryEvents(); Loading toolkit/mozapps/extensions/test/xpcshell/test_dictionary_webextension.js +138 −123 Original line number Diff line number Diff line Loading @@ -23,7 +23,13 @@ add_task(async function setup() { AddonTestUtils.hookAMTelemetryEvents(); }); add_task(async function test_validation() { add_task( { // We need to enable this pref because some assertions verify that // `installOrigins` is collected in some Telemetry events. pref_set: [["extensions.install_origins.enabled", true]], }, async function test_validation() { await Assert.rejects( promiseInstallWebExtension({ manifest: { Loading Loading @@ -132,7 +138,11 @@ add_task(async function test_validation() { }, { object: "dictionary", extra: { step: "completed", addon_id: addon.id, install_origins: "0" }, extra: { step: "completed", addon_id: addon.id, install_origins: "0", }, }, ], "Got the expected install telemetry events for the first installed dictionary" Loading @@ -147,7 +157,11 @@ add_task(async function test_validation() { }, { object: "dictionary", extra: { step: "completed", addon_id: addon2.id, install_origins: "0" }, extra: { step: "completed", addon_id: addon2.id, install_origins: "0", }, }, ], "Got the expected install telemetry events for the second installed dictionary" Loading @@ -168,7 +182,8 @@ add_task(async function test_validation() { ], "Got the expected uninstall telemetry events" ); }); } ); const WORD = "Flehgragh"; Loading toolkit/mozapps/extensions/test/xpinstall/browser.ini +1 −0 Original line number Diff line number Diff line Loading @@ -22,6 +22,7 @@ support-files = startsoftwareupdate.html triggerredirect.html unsigned.xpi unsigned_mv3.xpi webmidi_permission.xpi ../xpcshell/data/signing_checks/privileged.xpi Loading toolkit/mozapps/extensions/test/xpinstall/browser_doorhanger_installs.js +93 −14 Original line number Diff line number Diff line Loading @@ -289,13 +289,13 @@ async function waitForNotification( return win.PopupNotifications.panel; } function waitForNotificationClose() { if (!PopupNotifications.isPanelOpen) { function waitForNotificationClose(win = window) { if (!win.PopupNotifications.isPanelOpen) { return Promise.resolve(); } return new Promise(resolve => { info("Waiting for notification to close"); PopupNotifications.panel.addEventListener( win.PopupNotifications.panel.addEventListener( "popuphidden", function() { resolve(); Loading Loading @@ -344,7 +344,7 @@ function setupRedirect(aSettings) { var TESTS = [ async function test_disabledInstall() { SpecialPowers.pushPrefEnv({ await SpecialPowers.pushPrefEnv({ set: [["xpinstall.enabled", false]], }); let notificationPromise = waitForNotification("xpinstall-disabled"); Loading Loading @@ -392,7 +392,7 @@ var TESTS = [ }, async function test_blockedInstall() { SpecialPowers.pushPrefEnv({ await SpecialPowers.pushPrefEnv({ set: [["extensions.postDownloadThirdPartyPrompt", false]], }); Loading Loading @@ -467,7 +467,7 @@ var TESTS = [ }, async function test_blockedInstallDomain() { SpecialPowers.pushPrefEnv({ await SpecialPowers.pushPrefEnv({ set: [ ["extensions.postDownloadThirdPartyPrompt", true], ["extensions.install_origins.enabled", true], Loading Loading @@ -500,7 +500,7 @@ var TESTS = [ }, async function test_allowedInstallDomain() { SpecialPowers.pushPrefEnv({ await SpecialPowers.pushPrefEnv({ set: [ ["extensions.postDownloadThirdPartyPrompt", true], ["extensions.install_origins.enabled", true], Loading Loading @@ -626,7 +626,7 @@ var TESTS = [ }, async function test_blockedPostDownload() { SpecialPowers.pushPrefEnv({ await SpecialPowers.pushPrefEnv({ set: [["extensions.postDownloadThirdPartyPrompt", true]], }); Loading Loading @@ -684,7 +684,7 @@ var TESTS = [ }, async function test_recommendedPostDownload() { SpecialPowers.pushPrefEnv({ await SpecialPowers.pushPrefEnv({ set: [["extensions.postDownloadThirdPartyPrompt", true]], }); Loading Loading @@ -721,7 +721,7 @@ var TESTS = [ }, async function test_priviledgedNo3rdPartyPrompt() { SpecialPowers.pushPrefEnv({ await SpecialPowers.pushPrefEnv({ set: [["extensions.postDownloadThirdPartyPrompt", true]], }); AddonManager.checkUpdateSecurity = false; Loading Loading @@ -1230,7 +1230,7 @@ var TESTS = [ }, async function test_failedSecurity() { SpecialPowers.pushPrefEnv({ await SpecialPowers.pushPrefEnv({ set: [ [PREF_INSTALL_REQUIREBUILTINCERTS, false], ["extensions.postDownloadThirdPartyPrompt", false], Loading Loading @@ -1467,8 +1467,11 @@ var TESTS = [ }, async function test_blockedInstallDomain_with_unified_extensions() { SpecialPowers.pushPrefEnv({ set: [["extensions.unifiedExtensions.enabled", true]], await SpecialPowers.pushPrefEnv({ set: [ ["extensions.unifiedExtensions.enabled", true], ["extensions.install_origins.enabled", true], ], }); let win = await BrowserTestUtils.openNewBrowserWindow(); Loading Loading @@ -1502,6 +1505,82 @@ var TESTS = [ await BrowserTestUtils.closeWindow(win); await SpecialPowers.popPrefEnv(); }, async function test_mv3_installOrigins_disallowed_with_unified_extensions() { await SpecialPowers.pushPrefEnv({ set: [ ["extensions.unifiedExtensions.enabled", true], // Disable signature check because we load an unsigned MV3 extension. ["xpinstall.signatures.required", false], ["extensions.install_origins.enabled", true], ], }); let win = await BrowserTestUtils.openNewBrowserWindow(); await SimpleTest.promiseFocus(win); let notificationPromise = waitForNotification( "addon-install-failed", 1, "unified-extensions-button", win ); let triggers = encodeURIComponent( JSON.stringify({ // This XPI does not have any `install_origins` in its manifest. XPI: "unsigned_mv3.xpi", }) ); await BrowserTestUtils.openNewForegroundTab( win.gBrowser, TESTROOT + "installtrigger.html?" + triggers ); await notificationPromise; await BrowserTestUtils.closeWindow(win); await SpecialPowers.popPrefEnv(); }, async function test_mv3_installOrigins_allowed_with_unified_extensions() { await SpecialPowers.pushPrefEnv({ set: [ ["extensions.unifiedExtensions.enabled", true], // Disable signature check because we load an unsigned MV3 extension. ["xpinstall.signatures.required", false], // When this pref is disabled, install should be possible. ["extensions.install_origins.enabled", false], ], }); let win = await BrowserTestUtils.openNewBrowserWindow(); await SimpleTest.promiseFocus(win); let notificationPromise = waitForNotification( "addon-install-blocked", 1, "unified-extensions-button", win ); let triggers = encodeURIComponent( JSON.stringify({ // This XPI does not have any `install_origins` in its manifest. XPI: "unsigned_mv3.xpi", }) ); await BrowserTestUtils.openNewForegroundTab( win.gBrowser, TESTROOT + "installtrigger.html?" + triggers ); let panel = await notificationPromise; let closePromise = waitForNotificationClose(win); // hide the panel (this simulates the user dismissing it) panel.hidePopup(); await closePromise; await BrowserTestUtils.closeWindow(win); await SpecialPowers.popPrefEnv(); }, ]; var gTestStart = null; Loading @@ -1526,7 +1605,7 @@ var XPInstallObserver = { add_task(async function() { requestLongerTimeout(4); SpecialPowers.pushPrefEnv({ await SpecialPowers.pushPrefEnv({ set: [ ["extensions.logging.enabled", true], ["extensions.strictCompatibility", true], Loading Loading
modules/libpref/init/all.js +2 −0 Original line number Diff line number Diff line Loading @@ -1970,6 +1970,8 @@ pref("extensions.manifestV2.actionsPopupURLRestricted", false); #else pref("extensions.openPopupWithoutUserGesture.enabled", false); #endif // Install origins restriction. pref("extensions.install_origins.enabled", false); // Modifier key prefs: default to Windows settings, // menu access key = alt, accelerator key = control. Loading
toolkit/mozapps/extensions/test/xpcshell/test_addon_manager_telemetry_events.js +402 −371 Original line number Diff line number Diff line Loading @@ -89,7 +89,13 @@ add_task(async function setup() { }); // Test the basic install and management flows. add_task(async function test_basic_telemetry_events() { add_task( { // We need to enable this pref because some assertions verify that // `installOrigins` is collected in some Telemetry events. pref_set: [["extensions.install_origins.enabled", true]], }, async function test_basic_telemetry_events() { const EXTENSION_ID = "basic@test.extension"; const manifest = { Loading Loading @@ -233,10 +239,21 @@ add_task(async function test_basic_telemetry_events() { .filter(evt => evt.method === "install") .map(evt => evt.value); const expectedValues = ["2", "2"]; Assert.deepEqual(eventValues, expectedValues, "Got the expected install id"); }); Assert.deepEqual( eventValues, expectedValues, "Got the expected install id" ); } ); add_task(async function test_update_telemetry_events() { add_task( { // We need to enable this pref because some assertions verify that // `installOrigins` is collected in some Telemetry events. pref_set: [["extensions.install_origins.enabled", true]], }, async function test_update_telemetry_events() { const EXTENSION_ID = "basic@test.extension"; const testserver = AddonTestUtils.createHttpServer({ Loading Loading @@ -316,7 +333,10 @@ add_task(async function test_update_telemetry_events() { let addon = await AddonManager.getAddonByID(EXTENSION_ID); // User requested update. await promiseFindAddonUpdates(addon, AddonManager.UPDATE_WHEN_USER_REQUESTED); await promiseFindAddonUpdates( addon, AddonManager.UPDATE_WHEN_USER_REQUESTED ); let installs = await AddonManager.getAllInstalls(); await promiseCompleteAllInstalls(installs); Loading Loading @@ -414,7 +434,12 @@ add_task(async function test_update_telemetry_events() { { method, object, extra: { ...baseExtra, addon_id, step: "started", updated_from: "user" }, extra: { ...baseExtra, addon_id, step: "started", updated_from: "user", }, }, { method, Loading Loading @@ -475,7 +500,12 @@ add_task(async function test_update_telemetry_events() { { method, object, extra: { ...baseExtra, addon_id, step: "completed", updated_from: "app" }, extra: { ...baseExtra, addon_id, step: "completed", updated_from: "app", }, }, // Broken update to the 2.1.1 version (on ERROR_NETWORK_FAILURE). { Loading Loading @@ -538,7 +568,8 @@ add_task(async function test_update_telemetry_events() { // Clear any AMTelemetry events related to the uninstalled extensions. getTelemetryEvents(); }); } ); add_task(async function test_no_telemetry_events_on_internal_sources() { assertNoTelemetryEvents(); Loading
toolkit/mozapps/extensions/test/xpcshell/test_dictionary_webextension.js +138 −123 Original line number Diff line number Diff line Loading @@ -23,7 +23,13 @@ add_task(async function setup() { AddonTestUtils.hookAMTelemetryEvents(); }); add_task(async function test_validation() { add_task( { // We need to enable this pref because some assertions verify that // `installOrigins` is collected in some Telemetry events. pref_set: [["extensions.install_origins.enabled", true]], }, async function test_validation() { await Assert.rejects( promiseInstallWebExtension({ manifest: { Loading Loading @@ -132,7 +138,11 @@ add_task(async function test_validation() { }, { object: "dictionary", extra: { step: "completed", addon_id: addon.id, install_origins: "0" }, extra: { step: "completed", addon_id: addon.id, install_origins: "0", }, }, ], "Got the expected install telemetry events for the first installed dictionary" Loading @@ -147,7 +157,11 @@ add_task(async function test_validation() { }, { object: "dictionary", extra: { step: "completed", addon_id: addon2.id, install_origins: "0" }, extra: { step: "completed", addon_id: addon2.id, install_origins: "0", }, }, ], "Got the expected install telemetry events for the second installed dictionary" Loading @@ -168,7 +182,8 @@ add_task(async function test_validation() { ], "Got the expected uninstall telemetry events" ); }); } ); const WORD = "Flehgragh"; Loading
toolkit/mozapps/extensions/test/xpinstall/browser.ini +1 −0 Original line number Diff line number Diff line Loading @@ -22,6 +22,7 @@ support-files = startsoftwareupdate.html triggerredirect.html unsigned.xpi unsigned_mv3.xpi webmidi_permission.xpi ../xpcshell/data/signing_checks/privileged.xpi Loading
toolkit/mozapps/extensions/test/xpinstall/browser_doorhanger_installs.js +93 −14 Original line number Diff line number Diff line Loading @@ -289,13 +289,13 @@ async function waitForNotification( return win.PopupNotifications.panel; } function waitForNotificationClose() { if (!PopupNotifications.isPanelOpen) { function waitForNotificationClose(win = window) { if (!win.PopupNotifications.isPanelOpen) { return Promise.resolve(); } return new Promise(resolve => { info("Waiting for notification to close"); PopupNotifications.panel.addEventListener( win.PopupNotifications.panel.addEventListener( "popuphidden", function() { resolve(); Loading Loading @@ -344,7 +344,7 @@ function setupRedirect(aSettings) { var TESTS = [ async function test_disabledInstall() { SpecialPowers.pushPrefEnv({ await SpecialPowers.pushPrefEnv({ set: [["xpinstall.enabled", false]], }); let notificationPromise = waitForNotification("xpinstall-disabled"); Loading Loading @@ -392,7 +392,7 @@ var TESTS = [ }, async function test_blockedInstall() { SpecialPowers.pushPrefEnv({ await SpecialPowers.pushPrefEnv({ set: [["extensions.postDownloadThirdPartyPrompt", false]], }); Loading Loading @@ -467,7 +467,7 @@ var TESTS = [ }, async function test_blockedInstallDomain() { SpecialPowers.pushPrefEnv({ await SpecialPowers.pushPrefEnv({ set: [ ["extensions.postDownloadThirdPartyPrompt", true], ["extensions.install_origins.enabled", true], Loading Loading @@ -500,7 +500,7 @@ var TESTS = [ }, async function test_allowedInstallDomain() { SpecialPowers.pushPrefEnv({ await SpecialPowers.pushPrefEnv({ set: [ ["extensions.postDownloadThirdPartyPrompt", true], ["extensions.install_origins.enabled", true], Loading Loading @@ -626,7 +626,7 @@ var TESTS = [ }, async function test_blockedPostDownload() { SpecialPowers.pushPrefEnv({ await SpecialPowers.pushPrefEnv({ set: [["extensions.postDownloadThirdPartyPrompt", true]], }); Loading Loading @@ -684,7 +684,7 @@ var TESTS = [ }, async function test_recommendedPostDownload() { SpecialPowers.pushPrefEnv({ await SpecialPowers.pushPrefEnv({ set: [["extensions.postDownloadThirdPartyPrompt", true]], }); Loading Loading @@ -721,7 +721,7 @@ var TESTS = [ }, async function test_priviledgedNo3rdPartyPrompt() { SpecialPowers.pushPrefEnv({ await SpecialPowers.pushPrefEnv({ set: [["extensions.postDownloadThirdPartyPrompt", true]], }); AddonManager.checkUpdateSecurity = false; Loading Loading @@ -1230,7 +1230,7 @@ var TESTS = [ }, async function test_failedSecurity() { SpecialPowers.pushPrefEnv({ await SpecialPowers.pushPrefEnv({ set: [ [PREF_INSTALL_REQUIREBUILTINCERTS, false], ["extensions.postDownloadThirdPartyPrompt", false], Loading Loading @@ -1467,8 +1467,11 @@ var TESTS = [ }, async function test_blockedInstallDomain_with_unified_extensions() { SpecialPowers.pushPrefEnv({ set: [["extensions.unifiedExtensions.enabled", true]], await SpecialPowers.pushPrefEnv({ set: [ ["extensions.unifiedExtensions.enabled", true], ["extensions.install_origins.enabled", true], ], }); let win = await BrowserTestUtils.openNewBrowserWindow(); Loading Loading @@ -1502,6 +1505,82 @@ var TESTS = [ await BrowserTestUtils.closeWindow(win); await SpecialPowers.popPrefEnv(); }, async function test_mv3_installOrigins_disallowed_with_unified_extensions() { await SpecialPowers.pushPrefEnv({ set: [ ["extensions.unifiedExtensions.enabled", true], // Disable signature check because we load an unsigned MV3 extension. ["xpinstall.signatures.required", false], ["extensions.install_origins.enabled", true], ], }); let win = await BrowserTestUtils.openNewBrowserWindow(); await SimpleTest.promiseFocus(win); let notificationPromise = waitForNotification( "addon-install-failed", 1, "unified-extensions-button", win ); let triggers = encodeURIComponent( JSON.stringify({ // This XPI does not have any `install_origins` in its manifest. XPI: "unsigned_mv3.xpi", }) ); await BrowserTestUtils.openNewForegroundTab( win.gBrowser, TESTROOT + "installtrigger.html?" + triggers ); await notificationPromise; await BrowserTestUtils.closeWindow(win); await SpecialPowers.popPrefEnv(); }, async function test_mv3_installOrigins_allowed_with_unified_extensions() { await SpecialPowers.pushPrefEnv({ set: [ ["extensions.unifiedExtensions.enabled", true], // Disable signature check because we load an unsigned MV3 extension. ["xpinstall.signatures.required", false], // When this pref is disabled, install should be possible. ["extensions.install_origins.enabled", false], ], }); let win = await BrowserTestUtils.openNewBrowserWindow(); await SimpleTest.promiseFocus(win); let notificationPromise = waitForNotification( "addon-install-blocked", 1, "unified-extensions-button", win ); let triggers = encodeURIComponent( JSON.stringify({ // This XPI does not have any `install_origins` in its manifest. XPI: "unsigned_mv3.xpi", }) ); await BrowserTestUtils.openNewForegroundTab( win.gBrowser, TESTROOT + "installtrigger.html?" + triggers ); let panel = await notificationPromise; let closePromise = waitForNotificationClose(win); // hide the panel (this simulates the user dismissing it) panel.hidePopup(); await closePromise; await BrowserTestUtils.closeWindow(win); await SpecialPowers.popPrefEnv(); }, ]; var gTestStart = null; Loading @@ -1526,7 +1605,7 @@ var XPInstallObserver = { add_task(async function() { requestLongerTimeout(4); SpecialPowers.pushPrefEnv({ await SpecialPowers.pushPrefEnv({ set: [ ["extensions.logging.enabled", true], ["extensions.strictCompatibility", true], Loading