tor-browser

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

commit 888ad507a9896365dfc6148663e6329ac8b63b4e
parent 9bd0056bb97aef3f6f44ec457417821f92a7eb4c
Author: Rebecca King <rking@mozilla.com>
Date:   Wed, 19 Nov 2025 13:38:08 +0000

Bug 2000059 - Update IPP autostart to use feature prefs - r=ip-protection-reviewers,fchasen,tgiles

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

Diffstat:
Mbrowser/app/profile/firefox.js | 4+++-
Mbrowser/components/ipprotection/IPPAutoStart.sys.mjs | 14+++++++++++++-
Mbrowser/components/preferences/privacy.js | 11+++++++++--
Mbrowser/components/preferences/tests/browser_privacy_ipprotection.js | 5+++++
4 files changed, 30 insertions(+), 4 deletions(-)

diff --git a/browser/app/profile/firefox.js b/browser/app/profile/firefox.js @@ -3504,7 +3504,9 @@ pref("browser.contextual-services.contextId.rust-component.enabled", true); pref("browser.ipProtection.enabled", false); // Pref to track whether the user has opted out of using IP Protection pref("browser.ipProtection.optedOut", false); -// Pref to enable IP protection autostart +// Pref to enable the autoStart feature +pref("browser.ipProtection.features.autoStart", false); +// Prefs to track the user turning on autostart preference pref("browser.ipProtection.autoStartEnabled", false); pref("browser.ipProtection.autoStartPrivateEnabled", false); // Pref to track whether the user has turned IP protection on diff --git a/browser/components/ipprotection/IPPAutoStart.sys.mjs b/browser/components/ipprotection/IPPAutoStart.sys.mjs @@ -17,6 +17,7 @@ ChromeUtils.defineESModuleGetters(lazy, { "resource:///modules/ipprotection/IPProtectionService.sys.mjs", }); +const AUTOSTART_FEATURE_ENABLE_PREF = "browser.ipProtection.features.autoStart"; const AUTOSTART_PREF = "browser.ipProtection.autoStartEnabled"; /** @@ -41,6 +42,13 @@ class IPPAutoStartSingleton { } } ); + + XPCOMUtils.defineLazyPreferenceGetter( + this, + "autoStartFeatureEnablePref", + AUTOSTART_FEATURE_ENABLE_PREF, + false + ); } init() { @@ -72,7 +80,11 @@ class IPPAutoStartSingleton { get autoStart() { // We activate the auto-start feature only if the pref is true and we have // the serverlist already. - return this.autoStartPref && lazy.IPProtectionServerlist.hasList; + return ( + this.autoStartFeatureEnablePref && + this.autoStartPref && + lazy.IPProtectionServerlist.hasList + ); } #handleEvent(_event) { diff --git a/browser/components/preferences/privacy.js b/browser/components/preferences/privacy.js @@ -202,6 +202,7 @@ Preferences.addAll([ // Firefox VPN { id: "browser.ipProtection.variant", type: "string" }, { id: "browser.ipProtection.exceptionsMode", type: "string" }, + { id: "browser.ipProtection.features.autoStart", type: "bool" }, { id: "browser.ipProtection.autoStartEnabled", type: "bool" }, { id: "browser.ipProtection.autoStartPrivateEnabled", type: "bool" }, @@ -1463,9 +1464,15 @@ Preferences.addSetting({ }, }); Preferences.addSetting({ + id: "ipProtectionAutoStartFeatureEnabled", + pref: "browser.ipProtection.features.autoStart", + get: prefVal => prefVal, +}); +Preferences.addSetting({ id: "ipProtectionAutoStart", - deps: ["ipProtectionVisible"], - visible: ({ ipProtectionVisible }) => ipProtectionVisible.value, + deps: ["ipProtectionVisible", "ipProtectionAutoStartFeatureEnabled"], + visible: ({ ipProtectionVisible, ipProtectionAutoStartFeatureEnabled }) => + ipProtectionVisible.value && ipProtectionAutoStartFeatureEnabled.value, }); Preferences.addSetting({ id: "ipProtectionAutoStartCheckbox", diff --git a/browser/components/preferences/tests/browser_privacy_ipprotection.js b/browser/components/preferences/tests/browser_privacy_ipprotection.js @@ -7,6 +7,8 @@ const FEATURE_PREF = "browser.ipProtection.variant"; const MODE_PREF = "browser.ipProtection.exceptionsMode"; +const AUTOSTART_FEATURE_ENABLED_PREF = + "browser.ipProtection.features.autoStart"; const AUTOSTART_PREF = "browser.ipProtection.autoStartEnabled"; const AUTOSTART_PRIVATE_PREF = "browser.ipProtection.autoStartPrivateEnabled"; @@ -15,6 +17,7 @@ const SECTION_ID = "dataIPProtectionGroup"; async function setupVpnPrefs({ feature, mode = "all", + autostartFeatureEnabled = false, autostart = false, autostartprivate = false, }) { @@ -22,6 +25,7 @@ async function setupVpnPrefs({ set: [ [FEATURE_PREF, feature], [MODE_PREF, mode], + [AUTOSTART_FEATURE_ENABLED_PREF, autostartFeatureEnabled], [AUTOSTART_PREF, autostart], [AUTOSTART_PRIVATE_PREF, autostartprivate], ], @@ -227,6 +231,7 @@ add_task(async function test_exceptions_change_mode_and_buttons() { add_task(async function test_autostart_checkboxes() { await setupVpnPrefs({ feature: "beta", + autostartFeatureEnabled: true, autostart: true, autostartprivate: true, });