tor-browser

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

commit a2775ed162980e13ab13eb1e05d208cf3b398f75
parent 685b1d62bc22ada1cc7cc06a514217f387038b79
Author: Mark Banner <standard8@mozilla.com>
Date:   Thu, 23 Oct 2025 22:32:05 +0000

Bug 1995341 - Update the search settings UI for Suggest proxy changes. r=adw,fluent-reviewers,desktop-theme-reviewers,urlbar-reviewers,mkennedy,bolsson,dao

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

Diffstat:
Mbrowser/components/enterprisepolicies/tests/browser/browser_policy_firefoxsuggest.js | 35++++++++++++++++++++---------------
Mbrowser/components/preferences/privacy.inc.xhtml | 7-------
Mbrowser/components/preferences/privacy.js | 31-------------------------------
Mbrowser/components/preferences/search.inc.xhtml | 20++++++++++++--------
Mbrowser/components/preferences/search.js | 19++++++++++++++-----
Mbrowser/components/preferences/tests/browser.toml | 2--
Dbrowser/components/preferences/tests/browser_privacy_firefoxSuggest.js | 191-------------------------------------------------------------------------------
Mbrowser/components/preferences/tests/browser_search_firefoxSuggest.js | 16++++++++--------
Mbrowser/components/urlbar/content/enUS-searchFeatures.ftl | 7-------
Mbrowser/locales/en-US/browser/preferences/preferences.ftl | 19++++++++++++++-----
Mbrowser/themes/shared/preferences/privacy.css | 19-------------------
Mbrowser/themes/shared/preferences/search.css | 4++++
Mtools/lint/fluent-lint/exclusions.yml | 2++
13 files changed, 74 insertions(+), 298 deletions(-)

diff --git a/browser/components/enterprisepolicies/tests/browser/browser_policy_firefoxsuggest.js b/browser/components/enterprisepolicies/tests/browser/browser_policy_firefoxsuggest.js @@ -30,13 +30,16 @@ add_task(async function test_firefox_suggest_with_policy() { true, "Sponsored suggestions is enabled" ); - is( - browser.contentDocument.getElementById( - "firefoxSuggestDataCollectionSearchToggle" - ).pressed, - true, - "Improve suggest is enabled" - ); + // TODO: The preference is enabled by default, so the new enterprise policy + // being added in bug 1995362 should be set to false, and this check changed + // to confirm the option is not checked. + // is( + // browser.contentDocument.getElementById( + // "firefoxSuggestOnlineEnabledToggle" + // ).checked, + // true, + // "Suggest online is enabled" + // ); is( browser.contentDocument.getElementById("firefoxSuggestNonsponsored") .disabled, @@ -47,15 +50,17 @@ add_task(async function test_firefox_suggest_with_policy() { browser.contentDocument.getElementById("firefoxSuggestSponsored") .disabled, true, - "Sponsored suggestions is enabled" - ); - is( - browser.contentDocument.getElementById( - "firefoxSuggestDataCollectionSearchToggle" - ).disabled, - true, - "Improve suggest is enabled" + "Sponsored suggestions is disabled" ); + // TODO: Bug 1995362 - This needs the new enterprise policy to be hooked + // up. + // is( + // browser.contentDocument.getElementById( + // "firefoxSuggestOnlineEnabledToggle" + // ).disabled, + // true, + // "Suggest online is disabled" + // ); } ); }); diff --git a/browser/components/preferences/privacy.inc.xhtml b/browser/components/preferences/privacy.inc.xhtml @@ -1018,13 +1018,6 @@ #endif # MOZ_CRASHREPORTER </vbox> #endif MOZ_DATA_REPORTING - <html:moz-toggle hidden="true" - id="firefoxSuggestDataCollectionPrivacyToggle" - preference="browser.urlbar.quicksuggest.dataCollection.enabled" - data-l10n-id="addressbar-firefox-suggest-data-collection" - data-l10n-attrs="label, description" - support-page="firefox-suggest#w_what-setting-is-opt-in" - /> <vbox id="privacySegmentationSection" data-subcategory="privacy-segmentation" hidden="true"> <label> <html:h2 data-l10n-id="privacy-segmentation-section-header"/> diff --git a/browser/components/preferences/privacy.js b/browser/components/preferences/privacy.js @@ -161,17 +161,6 @@ Preferences.addAll([ type: "bool", }, - // Location Bar - { id: "browser.urlbar.suggest.bookmark", type: "bool" }, - { id: "browser.urlbar.suggest.clipboard", type: "bool" }, - { id: "browser.urlbar.suggest.history", type: "bool" }, - { id: "browser.urlbar.suggest.openpage", type: "bool" }, - { id: "browser.urlbar.suggest.topsites", type: "bool" }, - { id: "browser.urlbar.suggest.engines", type: "bool" }, - { id: "browser.urlbar.suggest.quicksuggest.nonsponsored", type: "bool" }, - { id: "browser.urlbar.suggest.quicksuggest.sponsored", type: "bool" }, - { id: "browser.urlbar.quicksuggest.dataCollection.enabled", type: "bool" }, - // History { id: "places.history.enabled", type: "bool" }, { id: "browser.formfill.enable", type: "bool" }, @@ -2629,13 +2618,6 @@ var gPrivacyPane = { } } - let onNimbus = () => this._updateFirefoxSuggestToggle(); - NimbusFeatures.urlbar.onUpdate(onNimbus); - this._updateFirefoxSuggestToggle(); - window.addEventListener("unload", () => { - NimbusFeatures.urlbar.offUpdate(onNimbus); - }); - this.initSiteDataControls(); this.initCookieBannerHandling(); @@ -3923,19 +3905,6 @@ var gPrivacyPane = { } }, - /** - * Updates the visibility of the Firefox Suggest Privacy Container - * based on the user's Quick Suggest settings. - */ - _updateFirefoxSuggestToggle() { - document.getElementById( - "firefoxSuggestDataCollectionPrivacyToggle" - ).hidden = - !UrlbarPrefs.get("quickSuggestEnabled") || - UrlbarPrefs.get("quickSuggestSettingsUi") != - QuickSuggest.SETTINGS_UI.FULL; - }, - // GEOLOCATION /** diff --git a/browser/components/preferences/search.inc.xhtml b/browser/components/preferences/search.inc.xhtml @@ -74,7 +74,7 @@ <description flex="1"> <html:span id="locationBarSuggestionLabel" class="description-deemphasized" - data-l10n-id="addressbar-suggest" + data-l10n-id="addressbar-suggest-1" /> <html:a hidden="true" is="moz-support-link" @@ -95,7 +95,7 @@ <checkbox id="topSitesSuggestion" data-l10n-id="addressbar-locbar-shortcuts-option" preference="browser.urlbar.suggest.topsites"/> - <checkbox id="enginesSuggestion" data-l10n-id="addressbar-locbar-engines-option" + <checkbox id="enginesSuggestion" data-l10n-id="addressbar-locbar-engines-option-1" preference="browser.urlbar.suggest.engines"/> <hbox id="quickActionsBox" align="center" hidden="true"> <checkbox id="enableQuickActions" @@ -123,12 +123,16 @@ <description class="indent tip-caption" data-l10n-id="addressbar-locbar-suggest-sponsored-desc" /> - <html:moz-toggle id="firefoxSuggestDataCollectionSearchToggle" - preference="browser.urlbar.quicksuggest.dataCollection.enabled" - data-l10n-id="addressbar-firefox-suggest-data-collection" - data-l10n-attrs="label, description" - support-page="firefox-suggest#w_what-setting-is-opt-in" - /> + <hbox id="firefoxSuggestOnlineBox" align="center"> + <checkbox id="firefoxSuggestOnlineEnabledToggle" + class="tail-with-learn-more" + data-l10n-id="addressbar-firefox-suggest-online" + preference="browser.urlbar.quicksuggest.online.enabled" /> + <html:a is="moz-support-link" + data-l10n-id="addressbar-quickactions-learn-more" + support-page="firefox-suggest#w_what-setting-is-opt-in" + /> + </hbox> <hbox id="dismissedSuggestions" align="center"> <vbox flex="1"> <label data-l10n-id="addressbar-dismissed-suggestions-label"/> diff --git a/browser/components/preferences/search.js b/browser/components/preferences/search.js @@ -32,6 +32,17 @@ Preferences.addAll([ { id: "browser.urlbar.suggest.recentsearches", type: "bool" }, { id: "browser.urlbar.scotchBonnet.enableOverride", type: "bool" }, { id: "browser.urlbar.update2.engineAliasRefresh", type: "bool" }, + + // Suggest Section. + { id: "browser.urlbar.suggest.bookmark", type: "bool" }, + { id: "browser.urlbar.suggest.clipboard", type: "bool" }, + { id: "browser.urlbar.suggest.history", type: "bool" }, + { id: "browser.urlbar.suggest.openpage", type: "bool" }, + { id: "browser.urlbar.suggest.topsites", type: "bool" }, + { id: "browser.urlbar.suggest.engines", type: "bool" }, + { id: "browser.urlbar.suggest.quicksuggest.nonsponsored", type: "bool" }, + { id: "browser.urlbar.suggest.quicksuggest.sponsored", type: "bool" }, + { id: "browser.urlbar.quicksuggest.online.enabled", type: "bool" }, ]); const ENGINE_FLAVOR = "text/x-moz-search-engine"; @@ -345,8 +356,8 @@ var gSearchPane = { ) { // Update the l10n IDs of text elements. let l10nIdByElementId = { - locationBarGroupHeader: "addressbar-header-firefox-suggest", - locationBarSuggestionLabel: "addressbar-suggest-firefox-suggest", + locationBarGroupHeader: "addressbar-header-firefox-suggest-1", + locationBarSuggestionLabel: "addressbar-suggest-firefox-suggest-1", }; for (let [elementId, l10nId] of Object.entries(l10nIdByElementId)) { let element = document.getElementById(elementId); @@ -360,9 +371,7 @@ var gSearchPane = { .classList.add("tail-with-learn-more"); document.getElementById("firefoxSuggestLearnMore").hidden = false; - document.getElementById( - "firefoxSuggestDataCollectionSearchToggle" - ).hidden = + document.getElementById("firefoxSuggestOnlineEnabledToggle").hidden = UrlbarPrefs.get("quickSuggestSettingsUi") != QuickSuggest.SETTINGS_UI.FULL; diff --git a/browser/components/preferences/tests/browser.toml b/browser/components/preferences/tests/browser.toml @@ -195,8 +195,6 @@ skip-if = ["os == 'linux' && os_version == '24.04' && processor == 'x86_64' && t ["browser_privacy_dnsoverhttps.js"] -["browser_privacy_firefoxSuggest.js"] - ["browser_privacy_gpc.js"] ["browser_privacy_ipprotection.js"] diff --git a/browser/components/preferences/tests/browser_privacy_firefoxSuggest.js b/browser/components/preferences/tests/browser_privacy_firefoxSuggest.js @@ -1,191 +0,0 @@ -/* Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ */ - -// This tests the Privacy pane's Firefox Suggest UI. - -"use strict"; - -ChromeUtils.defineESModuleGetters(this, { - QuickSuggest: "moz-src:///browser/components/urlbar/QuickSuggest.sys.mjs", -}); - -const DATA_COLLECTION_TOGGLE_ID = "firefoxSuggestDataCollectionPrivacyToggle"; - -// Maps `SETTINGS_UI` values to expected visibility state objects. See -// `assertSuggestVisibility()` in `head.js` for info on the state objects. -const EXPECTED = { - [QuickSuggest.SETTINGS_UI.FULL]: { - [DATA_COLLECTION_TOGGLE_ID]: { isVisible: true }, - }, - [QuickSuggest.SETTINGS_UI.NONE]: { - [DATA_COLLECTION_TOGGLE_ID]: { isVisible: false }, - }, - [QuickSuggest.SETTINGS_UI.OFFLINE_ONLY]: { - [DATA_COLLECTION_TOGGLE_ID]: { isVisible: false }, - }, -}; - -// This test can take a while due to the many permutations some of these tasks -// run through, so request a longer timeout. -requestLongerTimeout(10); - -add_setup(async () => { - // Set the default value of the preference to FULL, since that's what the - // test was originally written with. - await SpecialPowers.pushPrefEnv({ - set: [ - ["browser.urlbar.quicksuggest.settingsUi", QuickSuggest.SETTINGS_UI.FULL], - ], - }); -}); - -// The following tasks check the initial visibility of the Firefox Suggest UI -// and the visibility after installing a Nimbus experiment. - -add_task(async function initiallyDisabled_disable() { - await doSuggestVisibilityTest({ - pane: "privacy", - initialSuggestEnabled: false, - initialExpected: EXPECTED[QuickSuggest.SETTINGS_UI.NONE], - nimbusVariables: { - quickSuggestEnabled: false, - }, - }); -}); - -add_task(async function initiallyDisabled_disable_settingsUIFull() { - await doSuggestVisibilityTest({ - pane: "privacy", - initialSuggestEnabled: false, - initialExpected: EXPECTED[QuickSuggest.SETTINGS_UI.NONE], - nimbusVariables: { - quickSuggestEnabled: false, - // `quickSuggestEnabled: false` should override this, so the Suggest - // settings should not be visible (`initialExpected` should persist). - quickSuggestSettingsUi: QuickSuggest.SETTINGS_UI.FULL, - }, - }); -}); - -add_task(async function initiallyDisabled_enable() { - await doSuggestVisibilityTest({ - pane: "privacy", - initialSuggestEnabled: false, - initialExpected: EXPECTED[QuickSuggest.SETTINGS_UI.NONE], - nimbusVariables: { - quickSuggestEnabled: true, - }, - newExpected: EXPECTED[QuickSuggest.SETTINGS_UI.FULL], - }); -}); - -add_task(async function initiallyDisabled_enable_settingsUiFull() { - await doSuggestVisibilityTest({ - pane: "privacy", - initialSuggestEnabled: false, - initialExpected: EXPECTED[QuickSuggest.SETTINGS_UI.NONE], - nimbusVariables: { - quickSuggestEnabled: true, - quickSuggestSettingsUi: QuickSuggest.SETTINGS_UI.FULL, - }, - newExpected: EXPECTED[QuickSuggest.SETTINGS_UI.FULL], - }); -}); - -add_task(async function initiallyDisabled_enable_settingsUiNone() { - await doSuggestVisibilityTest({ - pane: "privacy", - initialSuggestEnabled: false, - initialExpected: EXPECTED[QuickSuggest.SETTINGS_UI.NONE], - nimbusVariables: { - quickSuggestEnabled: true, - quickSuggestSettingsUi: QuickSuggest.SETTINGS_UI.NONE, - }, - }); -}); - -add_task(async function initiallyDisabled_enable_settingsUiOfflineOnly() { - await doSuggestVisibilityTest({ - pane: "privacy", - initialSuggestEnabled: false, - initialExpected: EXPECTED[QuickSuggest.SETTINGS_UI.NONE], - nimbusVariables: { - quickSuggestEnabled: true, - quickSuggestSettingsUi: QuickSuggest.SETTINGS_UI.OFFLINE_ONLY, - }, - newExpected: EXPECTED[QuickSuggest.SETTINGS_UI.OFFLINE_ONLY], - }); -}); - -add_task(async function initiallyEnabled_disable() { - await doSuggestVisibilityTest({ - pane: "privacy", - initialSuggestEnabled: true, - initialExpected: EXPECTED[QuickSuggest.SETTINGS_UI.FULL], - nimbusVariables: { - quickSuggestEnabled: false, - }, - newExpected: EXPECTED[QuickSuggest.SETTINGS_UI.NONE], - }); -}); - -add_task(async function initiallyEnabled_disable_settingsUiFull() { - await doSuggestVisibilityTest({ - pane: "privacy", - initialSuggestEnabled: true, - initialExpected: EXPECTED[QuickSuggest.SETTINGS_UI.FULL], - nimbusVariables: { - quickSuggestEnabled: false, - // `quickSuggestEnabled: false` should override this, so the Suggest - // settings should not be visible. - quickSuggestSettingsUi: QuickSuggest.SETTINGS_UI.FULL, - }, - newExpected: EXPECTED[QuickSuggest.SETTINGS_UI.NONE], - }); -}); - -add_task(async function initiallyEnabled_enable() { - await doSuggestVisibilityTest({ - pane: "privacy", - initialSuggestEnabled: true, - initialExpected: EXPECTED[QuickSuggest.SETTINGS_UI.FULL], - nimbusVariables: { - quickSuggestEnabled: true, - }, - }); -}); - -add_task(async function initiallyEnabled_settingsUiFull() { - await doSuggestVisibilityTest({ - pane: "privacy", - initialSuggestEnabled: true, - initialExpected: EXPECTED[QuickSuggest.SETTINGS_UI.FULL], - nimbusVariables: { - quickSuggestSettingsUi: QuickSuggest.SETTINGS_UI.FULL, - }, - }); -}); - -add_task(async function initiallyEnabled_settingsUiNone() { - await doSuggestVisibilityTest({ - pane: "privacy", - initialSuggestEnabled: true, - initialExpected: EXPECTED[QuickSuggest.SETTINGS_UI.FULL], - nimbusVariables: { - quickSuggestSettingsUi: QuickSuggest.SETTINGS_UI.NONE, - }, - newExpected: EXPECTED[QuickSuggest.SETTINGS_UI.NONE], - }); -}); - -add_task(async function initiallyEnabled_settingsUiOfflineOnly() { - await doSuggestVisibilityTest({ - pane: "privacy", - initialSuggestEnabled: true, - initialExpected: EXPECTED[QuickSuggest.SETTINGS_UI.FULL], - nimbusVariables: { - quickSuggestSettingsUi: QuickSuggest.SETTINGS_UI.OFFLINE_ONLY, - }, - newExpected: EXPECTED[QuickSuggest.SETTINGS_UI.OFFLINE_ONLY], - }); -}); diff --git a/browser/components/preferences/tests/browser_search_firefoxSuggest.js b/browser/components/preferences/tests/browser_search_firefoxSuggest.js @@ -10,7 +10,7 @@ ChromeUtils.defineESModuleGetters(this, { }); const CONTAINER_ID = "firefoxSuggestContainer"; -const DATA_COLLECTION_TOGGLE_ID = "firefoxSuggestDataCollectionSearchToggle"; +const ONLINE_ENABLED_TOGGLE_ID = "firefoxSuggestOnlineEnabledToggle"; const LEARN_MORE_ID = "firefoxSuggestLearnMore"; const BUTTON_RESTORE_DISMISSED_ID = "restoreDismissedSuggestions"; @@ -20,14 +20,14 @@ const EXPECTED = { [QuickSuggest.SETTINGS_UI.FULL]: { [LEARN_MORE_ID]: { isVisible: true }, [CONTAINER_ID]: { isVisible: true }, - [DATA_COLLECTION_TOGGLE_ID]: { isVisible: true }, + [ONLINE_ENABLED_TOGGLE_ID]: { isVisible: true }, locationBarGroupHeader: { isVisible: true, - l10nId: "addressbar-header-firefox-suggest", + l10nId: "addressbar-header-firefox-suggest-1", }, locationBarSuggestionLabel: { isVisible: true, - l10nId: "addressbar-suggest-firefox-suggest", + l10nId: "addressbar-suggest-firefox-suggest-1", }, }, [QuickSuggest.SETTINGS_UI.NONE]: { @@ -36,20 +36,20 @@ const EXPECTED = { locationBarGroupHeader: { isVisible: true, l10nId: "addressbar-header" }, locationBarSuggestionLabel: { isVisible: true, - l10nId: "addressbar-suggest", + l10nId: "addressbar-suggest-1", }, }, [QuickSuggest.SETTINGS_UI.OFFLINE_ONLY]: { [LEARN_MORE_ID]: { isVisible: true }, [CONTAINER_ID]: { isVisible: true }, - [DATA_COLLECTION_TOGGLE_ID]: { isVisible: false }, + [ONLINE_ENABLED_TOGGLE_ID]: { isVisible: false }, locationBarGroupHeader: { isVisible: true, - l10nId: "addressbar-header-firefox-suggest", + l10nId: "addressbar-header-firefox-suggest-1", }, locationBarSuggestionLabel: { isVisible: true, - l10nId: "addressbar-suggest-firefox-suggest", + l10nId: "addressbar-suggest-firefox-suggest-1", }, }, }; diff --git a/browser/components/urlbar/content/enUS-searchFeatures.ftl b/browser/components/urlbar/content/enUS-searchFeatures.ftl @@ -132,13 +132,6 @@ firefox-suggest-yelp-service-title = Top results for { $service } # Yelp. firefox-suggest-yelp-bottom-text = { -yelp-brand-name } · Sponsored -# These strings are used for a toggle switch in the settings UI that opts the -# user into "online" Firefox Suggest, allowing them to receive suggestions from -# Mozilla's Merino server. -addressbar-firefox-suggest-data-collection = - .label = Improve the { -firefox-suggest-brand-name } experience - .description = Share search query data with { -vendor-short-name } to create a richer search experience. - ## Used as title on the introduction pane. The text can be formatted to span ## multiple lines as needed (line breaks are significant). diff --git a/browser/locales/en-US/browser/preferences/preferences.ftl b/browser/locales/en-US/browser/preferences/preferences.ftl @@ -1297,13 +1297,13 @@ cookie-banner-blocker-checkbox-label = addressbar-header = Address Bar -addressbar-suggest = When using the address bar, suggest +addressbar-suggest-1 = Choose which suggestions display in your address bar # When Firefox Suggest is enabled, this replaces `addressbar-header`. -addressbar-header-firefox-suggest = Address Bar — { -firefox-suggest-brand-name } +addressbar-header-firefox-suggest-1 = { -firefox-suggest-brand-name } # When Firefox Suggest is enabled, this replaces `addressbar-suggest`. -addressbar-suggest-firefox-suggest = Choose the type of suggestions that appear in the address bar. +addressbar-suggest-firefox-suggest-1 = Suggestions from { -brand-short-name } and our partners in your address bar. # When Firefox Suggest is enabled, a "Learn more" link appears at the end of # `addressbar-suggest-firefox-suggest`. @@ -1328,8 +1328,8 @@ addressbar-locbar-shortcuts-option = addressbar-locbar-topsites-option = .label = Top sites .accesskey = T -addressbar-locbar-engines-option = - .label = Search engines +addressbar-locbar-engines-option-1 = + .label = Suggest search engines to use .accesskey = a addressbar-locbar-quickactions-option = .label = Quick actions @@ -1350,6 +1350,15 @@ addressbar-locbar-suggest-sponsored-option = .label = Suggestions from sponsors addressbar-locbar-suggest-sponsored-desc = Support { -brand-short-name } with occasional sponsored suggestions. +# This string is used for a checkbox in the settings UI that opts the +# user into "online" Firefox Suggest, allowing them to receive suggestions from +# Mozilla's Merino server. +# "Mozilla" is intentionally hardcoded to prevent forks from replacing it +# with their own vendor name, since the online suggest is created and maintained +# by Mozilla. +addressbar-firefox-suggest-online = + .label = Retrieve suggestions from Mozilla as you type + addressbar-quickactions-learn-more = Learn more addressbar-dismissed-suggestions-label = Dismissed suggestions diff --git a/browser/themes/shared/preferences/privacy.css b/browser/themes/shared/preferences/privacy.css @@ -329,25 +329,6 @@ display: inline-flex; } -/* Address bar */ - -#firefoxSuggestDataCollectionPrivacyToggle { - /* With this value we're trying to keep the apparent vertical space between - option boxes the same as the apparent vertical space between the labels of - the checkboxes above this toggle. */ - margin-block-start: 18px; -} - -#openSearchEnginePreferences { - margin-block-start: 0.5em; -} - -#firefoxSuggestDataCollectionSearchToggle, -#dismissedSuggestions, -#openSearchEnginePreferences.extraMargin { - margin-block-start: 2em; -} - /* Logins and Passwords */ #openWindowsPasskeySettings { diff --git a/browser/themes/shared/preferences/search.css b/browser/themes/shared/preferences/search.css @@ -77,3 +77,7 @@ #restoreDefaultSearchEngines { margin-inline-start: 0; } + +#dismissedSuggestions { + margin-block-start: 2em; +} diff --git a/tools/lint/fluent-lint/exclusions.yml b/tools/lint/fluent-lint/exclusions.yml @@ -143,6 +143,8 @@ CO01: # browser/browser.ftl - identity-custom-root - identity-description-custom-root2 + # browser/components/urlbar/content/enUS-searchFeatures.ftl + - addressbar-firefox-suggest-online # browser/migrationWizard.ftl - migration-wizard-migrator-display-name-firefox # browser/newtab/onboarding.ftl