diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:14:29 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:14:29 +0000 |
commit | fbaf0bb26397aa498eb9156f06d5a6fe34dd7dd8 (patch) | |
tree | 4c1ccaf5486d4f2009f9a338a98a83e886e29c97 /toolkit/mozapps/extensions/test | |
parent | Releasing progress-linux version 124.0.1-1~progress7.99u1. (diff) | |
download | firefox-fbaf0bb26397aa498eb9156f06d5a6fe34dd7dd8.tar.xz firefox-fbaf0bb26397aa498eb9156f06d5a6fe34dd7dd8.zip |
Merging upstream version 125.0.1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'toolkit/mozapps/extensions/test')
6 files changed, 103 insertions, 15 deletions
diff --git a/toolkit/mozapps/extensions/test/browser/browser.toml b/toolkit/mozapps/extensions/test/browser/browser.toml index 1daf6211f8..0b4a2d8f0a 100644 --- a/toolkit/mozapps/extensions/test/browser/browser.toml +++ b/toolkit/mozapps/extensions/test/browser/browser.toml @@ -156,6 +156,8 @@ https_first_disabled = true ["browser_sidebar_hidden_categories.js"] +["browser_sidebar_preferences_button.js"] + ["browser_sidebar_restore_category.js"] ["browser_subframe_install.js"] diff --git a/toolkit/mozapps/extensions/test/browser/browser_html_options_ui.js b/toolkit/mozapps/extensions/test/browser/browser_html_options_ui.js index c5bfa1022f..efe28cf218 100644 --- a/toolkit/mozapps/extensions/test/browser/browser_html_options_ui.js +++ b/toolkit/mozapps/extensions/test/browser/browser_html_options_ui.js @@ -115,13 +115,7 @@ add_task(async function testInlineOptions() { "The browser has the expected options URL" ); is(url, card.addon.optionsURL, "Browser has the expected options URL loaded"); - let stack = browser.closest("stack"); - is( - browser.clientWidth, - stack.clientWidth, - "Browser should be the same width as its direct parent" - ); - Assert.greater(stack.clientWidth, 0, "The stack has a width"); + Assert.greater(browser.clientWidth, 0, "The browser has a width"); ok( card.querySelector('[action="preferences"]').hidden, "The preferences option is hidden now" @@ -163,8 +157,7 @@ add_task(async function testInlineOptions() { info("Switch back, check browser is shown"); prefsBtn.click(); - is(browser.clientWidth, stack.clientWidth, "The browser width is set again"); - Assert.greater(stack.clientWidth, 0, "The stack has a width"); + Assert.greater(browser.clientWidth, 0, "The browser has a width"); await closeView(win); await extension.unload(); diff --git a/toolkit/mozapps/extensions/test/browser/browser_page_options_install_addon.js b/toolkit/mozapps/extensions/test/browser/browser_page_options_install_addon.js index 5007731927..7bc7c08345 100644 --- a/toolkit/mozapps/extensions/test/browser/browser_page_options_install_addon.js +++ b/toolkit/mozapps/extensions/test/browser/browser_page_options_install_addon.js @@ -5,7 +5,7 @@ // Tests bug 567127 - Add install button to the add-ons manager var MockFilePicker = SpecialPowers.MockFilePicker; -MockFilePicker.init(window); +MockFilePicker.init(window.browsingContext); async function checkInstallConfirmation(...names) { let notificationCount = 0; diff --git a/toolkit/mozapps/extensions/test/browser/browser_sidebar_preferences_button.js b/toolkit/mozapps/extensions/test/browser/browser_sidebar_preferences_button.js new file mode 100644 index 0000000000..91a631bca2 --- /dev/null +++ b/toolkit/mozapps/extensions/test/browser/browser_sidebar_preferences_button.js @@ -0,0 +1,73 @@ +/* Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ */ + +"use strict"; + +add_task(async function testNoOtherTabsPresent() { + let addonsWin = await loadInitialView("extension"); + let preferencesButton = + addonsWin.document.querySelector("#preferencesButton"); + + let preferencesPromise = BrowserTestUtils.waitForNewTab( + gBrowser, + "about:preferences" + ); + + preferencesButton.click(); + + let preferencesTab = await preferencesPromise; + + is( + gBrowser.currentURI.spec, + "about:preferences", + "about:preferences should open if neither it nor about:settings are present" + ); + + gBrowser.removeTab(preferencesTab); + + await closeView(addonsWin); +}); + +async function ensurePreferencesButtonFocusesTab(expectedUri) { + let addonsWin = await loadInitialView("extension"); + let preferencesButton = + addonsWin.document.querySelector("#preferencesButton"); + + let tabCountBeforeClick = gBrowser.tabCount; + preferencesButton.click(); + let tabCountAfterClick = gBrowser.tabCount; + + is( + tabCountAfterClick, + tabCountBeforeClick, + "preferences button should not open new tabs" + ); + is( + gBrowser.currentURI.spec, + expectedUri, + "the correct tab should be focused" + ); + + addonsWin.focus(); + await closeView(addonsWin); +} + +add_task(async function testAboutPreferencesPresent() { + await BrowserTestUtils.withNewTab("about:preferences", async () => { + await ensurePreferencesButtonFocusesTab("about:preferences"); + }); +}); + +add_task(async function testAboutSettingsPresent() { + await BrowserTestUtils.withNewTab("about:settings", async () => { + await ensurePreferencesButtonFocusesTab("about:settings"); + }); +}); + +add_task(async function testAboutSettingsAndPreferencesPresent() { + await BrowserTestUtils.withNewTab("about:settings", async () => { + await BrowserTestUtils.withNewTab("about:preferences", async () => { + await ensurePreferencesButtonFocusesTab("about:settings"); + }); + }); +}); diff --git a/toolkit/mozapps/extensions/test/xpcshell/test_corrupt.js b/toolkit/mozapps/extensions/test/xpcshell/test_corrupt.js index 727c643763..33e81c13bd 100644 --- a/toolkit/mozapps/extensions/test/xpcshell/test_corrupt.js +++ b/toolkit/mozapps/extensions/test/xpcshell/test_corrupt.js @@ -196,7 +196,7 @@ add_task(async function test_after_corruption() { await Assert.rejects( promiseShutdownManager(), - /NotAllowedError: Could not open the file at .+ for writing/ + /NotAllowedError: Could not write to `.+'/ ); }); @@ -211,6 +211,6 @@ add_task(async function test_after_second_restart() { await Assert.rejects( promiseShutdownManager(), - /NotAllowedError: Could not open the file at .+ for writing/ + /NotAllowedError: Could not write to `.+'/ ); }); diff --git a/toolkit/mozapps/extensions/test/xpcshell/test_system_update_enterprisepolicy.js b/toolkit/mozapps/extensions/test/xpcshell/test_system_update_enterprisepolicy.js index d36b97a3cc..e25890515f 100644 --- a/toolkit/mozapps/extensions/test/xpcshell/test_system_update_enterprisepolicy.js +++ b/toolkit/mozapps/extensions/test/xpcshell/test_system_update_enterprisepolicy.js @@ -44,12 +44,32 @@ const TEST_CONDITIONS = { add_task(async function test_update_disabled_by_policy() { await setupSystemAddonConditions(TEST_CONDITIONS, distroDir); + const TEST_POLICY_DATA = { + DisableSystemAddonUpdate: true, + }; await EnterprisePolicyTesting.setupPolicyEngineWithJson({ - policies: { - DisableSystemAddonUpdate: true, - }, + policies: TEST_POLICY_DATA, }); + Assert.deepEqual( + Services.policies.getActivePolicies(), + TEST_POLICY_DATA, + "Got the expected test policy data as the active policy " + + "(if this assertions fails, check your system for enterprise policies installed at system level)" + ); + + Assert.equal( + Services.policies.isAllowed("SysAddonUpdate"), + false, + "Expected SysAddonUpdate feature to be disabled by policies" + ); + + Assert.equal( + Services.prefs.getBoolPref("extensions.systemAddon.update.enabled"), + true, + "Expected system addon updates to not be already disabled through prefs" + ); + await updateAllSystemAddons( buildSystemAddonUpdates([ { |