commit 572aafc40ad0f14f65b051b5a83fcbae9cbbce68
parent 41f13be6d202fe196fe99846ece781c917c1f0a0
Author: Emma Zuehlcke <emz@mozilla.com>
Date: Mon, 22 Dec 2025 10:51:42 +0000
Bug 2006956 - Show tab reload message bar when ETP settings are changed in ETP advanced view. r=fluent-reviewers,hjones,bolsson
Differential Revision: https://phabricator.services.mozilla.com/D277046
Diffstat:
4 files changed, 114 insertions(+), 0 deletions(-)
diff --git a/browser/components/preferences/main.js b/browser/components/preferences/main.js
@@ -3567,6 +3567,18 @@ SettingGroupManager.registerGroups({
],
},
{
+ id: "reloadTabsHint",
+ control: "moz-message-bar",
+ l10nId: "preferences-etp-reload-tabs-hint",
+ options: [
+ {
+ control: "moz-button",
+ l10nId: "preferences-etp-reload-tabs-hint-button",
+ slot: "actions",
+ },
+ ],
+ },
+ {
id: "rfpWarning",
control: "moz-message-bar",
l10nId: "preferences-etp-rfp-warning-message",
diff --git a/browser/components/preferences/privacy.js b/browser/components/preferences/privacy.js
@@ -2879,6 +2879,9 @@ Preferences.addSetting({
Preferences.addSetting({
id: "etpAllowListConvenienceEnabled",
pref: "privacy.trackingprotection.allow_list.convenience.enabled",
+ onUserChange() {
+ gPrivacyPane.maybeNotifyUserToReload();
+ },
});
Preferences.addSetting({
@@ -2890,6 +2893,24 @@ Preferences.addSetting({
});
Preferences.addSetting({
+ id: "reloadTabsHint",
+ _showHint: false,
+ set(value, _, setting) {
+ this._showHint = value;
+ setting.emit("change");
+ },
+ get() {
+ return this._showHint;
+ },
+ visible(_, setting) {
+ return setting.value;
+ },
+ onUserClick() {
+ gPrivacyPane.reloadAllOtherTabs();
+ },
+});
+
+Preferences.addSetting({
id: "resistFingerprinting",
pref: "privacy.resistFingerprinting",
});
@@ -2975,6 +2996,9 @@ Preferences.addSetting({
Preferences.addSetting({
id: "etpAllowListConvenienceEnabledCustom",
pref: "privacy.trackingprotection.allow_list.convenience.enabled",
+ onUserChange() {
+ gPrivacyPane.maybeNotifyUserToReload();
+ },
});
Preferences.addSetting({
@@ -4707,6 +4731,8 @@ var gPrivacyPane = {
for (let notification of document.querySelectorAll(".reload-tabs")) {
notification.hidden = true;
}
+
+ Preferences.getSetting("reloadTabsHint").value = false;
},
/**
@@ -4728,6 +4754,8 @@ var gPrivacyPane = {
notification.hidden = false;
}
}
+
+ Preferences.getSetting("reloadTabsHint").value = true;
},
/**
diff --git a/browser/components/preferences/tests/browser_etp_advanced.js b/browser/components/preferences/tests/browser_etp_advanced.js
@@ -109,6 +109,74 @@ add_task(async function test_etp_category_radios_and_customize_navigation() {
BrowserTestUtils.removeTab(tab);
});
+// Ensures the reload tabs message bar appears when ETP settings change.
+add_task(async function test_reload_tabs_message_bar() {
+ await SpecialPowers.pushPrefEnv({
+ set: [
+ [CAT_PREF, "strict"],
+ [BASELINE_PREF, true],
+ [CONVENIENCE_PREF, true],
+ ],
+ });
+
+ info("Open an additional tab so the reload notification will show");
+ let extraTab = await BrowserTestUtils.openNewForegroundTab(
+ gBrowser,
+ "https://example.com"
+ );
+
+ let { doc, tab } = await openEtpPage();
+
+ let reloadTabsHint = getControl(doc, "reloadTabsHint");
+ ok(reloadTabsHint, "reloadTabsHint element exists");
+ ok(
+ BrowserTestUtils.isHidden(reloadTabsHint),
+ "Reload tabs message bar is initially hidden"
+ );
+
+ info("Toggle convenience checkbox to trigger reload notification");
+ let convenienceCheckbox = getControl(doc, "etpAllowListConvenienceEnabled");
+ ok(convenienceCheckbox.checked, "Convenience checkbox starts checked");
+
+ let prefChange = waitForAndAssertPrefState(
+ CONVENIENCE_PREF,
+ false,
+ "Convenience pref disabled"
+ );
+ synthesizeClick(convenienceCheckbox);
+ await prefChange;
+
+ info("Wait for message bar to become visible");
+ await BrowserTestUtils.waitForCondition(
+ () => BrowserTestUtils.isVisible(reloadTabsHint),
+ "Waiting for reload tabs message bar to become visible"
+ );
+
+ ok(
+ BrowserTestUtils.isVisible(reloadTabsHint),
+ "Reload tabs message bar is visible after changing ETP setting"
+ );
+
+ let reloadButton = reloadTabsHint.querySelector("moz-button");
+ ok(reloadButton, "Reload button exists in the message bar");
+
+ info("Click reload button to hide the message bar");
+ synthesizeClick(reloadButton);
+
+ await BrowserTestUtils.waitForCondition(
+ () => BrowserTestUtils.isHidden(reloadTabsHint),
+ "Waiting for reload tabs message bar to become hidden"
+ );
+
+ ok(
+ BrowserTestUtils.isHidden(reloadTabsHint),
+ "Reload tabs message bar is hidden after reload button clicked"
+ );
+
+ BrowserTestUtils.removeTab(extraTab);
+ BrowserTestUtils.removeTab(tab);
+});
+
// Ensures strict baseline checkbox flows prompt for confirmation and gate the convenience checkbox.
add_task(async function test_strict_baseline_checkbox_requires_confirmation() {
await SpecialPowers.pushPrefEnv({
diff --git a/browser/locales-preview/privacyPreferences.ftl b/browser/locales-preview/privacyPreferences.ftl
@@ -245,6 +245,12 @@ preferences-etp-advanced-settings-group =
preferences-etp-customize-button =
.label = Customize
+
+preferences-etp-reload-tabs-hint =
+ .message = Reload your tabs to apply these changes.
+preferences-etp-reload-tabs-hint-button =
+ .label = Reload all tabs
+
preferences-etp-rfp-warning-message =
.message = You’re using Resist Fingerprinting (RFP), which replaces some of { -brand-short-name }’s fingerprinting protection settings. This might cause some sites to break.