tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

commit 71623fa5a1f7afd950c5e081d899cfb373d45a8e
parent 12e5f7e34f4695e7d78037f52b545fe37485ae81
Author: Ben Chatterton <bchatterton@mozilla.com>
Date:   Thu,  2 Oct 2025 22:23:49 +0000

Bug 1989465: Create pref to allow testing of Firefox Refresh, r=jhirsch,profiles-reviewers

Differential Revision: https://phabricator.services.mozilla.com/D266869

Diffstat:
Mbrowser/app/profile/firefox.js | 2++
Mbrowser/components/profiles/tests/browser/browser.toml | 2++
Abrowser/components/profiles/tests/browser/browser_refresh_button.js | 39+++++++++++++++++++++++++++++++++++++++
Mtoolkit/modules/ResetProfile.sys.mjs | 5+++++
4 files changed, 48 insertions(+), 0 deletions(-)

diff --git a/browser/app/profile/firefox.js b/browser/app/profile/firefox.js @@ -3444,6 +3444,8 @@ pref("browser.backup.disabled-on-idle-backup-retry", false); pref("browser.profiles.profile-name.updated", false); // Whether to allow the user to merge profile data pref("browser.profiles.sync.allow-danger-merge", false); +// Allow Firefox Refresh even if profile is ineligible, see Bug 1928138 +pref("browser.profiles.forceEnableRefresh", false); pref("startup.homepage_override_url_nimbus", ""); // These prefs are referring to the Fx update version diff --git a/browser/components/profiles/tests/browser/browser.toml b/browser/components/profiles/tests/browser/browser.toml @@ -43,6 +43,8 @@ skip-if = ["os == 'mac' && os_version == '15.30' && arch == 'aarch64' && opt && ["browser_preferences.js"] fail-if = ["a11y_checks"] # Bug 1955503 +["browser_refresh_button.js"] + ["browser_test_current_theme_from_amo.js"] ["browser_test_last_tab.js"] diff --git a/browser/components/profiles/tests/browser/browser_refresh_button.js b/browser/components/profiles/tests/browser/browser_refresh_button.js @@ -0,0 +1,39 @@ +/* Any copyright is dedicated to the Public Domain. + https://creativecommons.org/publicdomain/zero/1.0/ */ + +"use strict"; + +ChromeUtils.defineESModuleGetters(this, { + UrlbarTestUtils: "resource://testing-common/UrlbarTestUtils.sys.mjs", +}); + +add_task(async function test_RefreshTestPrefFunction() { + await initGroupDatabase(); + + window.gURLBar.value = ""; + // Pref allows refresh for all profiles, see Bug 1928138 + await SpecialPowers.pushPrefEnv({ + set: [["browser.profiles.forceEnableRefresh", true]], + }); + + await UrlbarTestUtils.promiseAutocompleteResultPopup({ + window, + value: "refresh", + waitForFocus: SimpleTest.waitForFocus, + }); + let row = UrlbarTestUtils.getRowAt(window, 1); + let refreshButton = row.querySelector("span[data-action='refresh']"); + ok(refreshButton, "Refresh button should be visible"); + + window.gURLBar.value = ""; + await SpecialPowers.popPrefEnv(); + await UrlbarTestUtils.promiseAutocompleteResultPopup({ + window, + value: "refresh", + waitForFocus: SimpleTest.waitForFocus, + }); + row = UrlbarTestUtils.getRowAt(window, 1); + // row 0 is always the "Search with <default engine>" item + // If there is no row 1, there is no refresh button + ok(!row, "Refresh button should not be visible"); +}); diff --git a/toolkit/modules/ResetProfile.sys.mjs b/toolkit/modules/ResetProfile.sys.mjs @@ -45,6 +45,11 @@ export var ResetProfile = { return false; } + // Allow Firefox Refresh if force pref is set, see Bug 1928138 + if (Services.prefs.getBoolPref("browser.profiles.forceEnableRefresh")) { + return true; + } + // We also need to be using a profile the profile manager knows about. // We are disabling Firefox Refresh for profiles with a storeID. // Bug 1928138 will add support for selectable profiles and profiles with