tor-browser

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

commit f26cc44848f72a396e67a69144449dd48eb00303
parent 132b135bf961bea2acac204c414fc0dff0ff8090
Author: Nina Pypchenko <npypchenko@mozilla.com>
Date:   Tue, 11 Nov 2025 05:17:13 +0000

Bug 1998610 - Set up Firefox Home settings section r=home-newtab-reviewers,fluent-reviewers,bolsson,reemhamz,akulyk,maxx

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

Diffstat:
Mbrowser/components/preferences/home.inc.xhtml | 8++++++++
Mbrowser/components/preferences/home.js | 73+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Mbrowser/components/preferences/main.js | 29+++++++++++++++++++++++++++++
Mbrowser/extensions/newtab/lib/AboutPreferences.sys.mjs | 7+++++++
Mbrowser/locales/en-US/browser/preferences/preferences.ftl | 11++++++++++-
5 files changed, 127 insertions(+), 1 deletion(-)

diff --git a/browser/components/preferences/home.inc.xhtml b/browser/components/preferences/home.inc.xhtml @@ -92,6 +92,7 @@ <groupbox id="homeContentsGroup" data-category="paneHome" data-subcategory="contents" + data-srd-groupid="home" hidden="true"> <label><html:h2 data-l10n-id="home-prefs-content-header2" /></label> <description class="description-deemphasized" data-l10n-id="home-prefs-content-description2" /> @@ -112,4 +113,11 @@ <vbox id="highlights" /> </groupbox> + +<html:setting-group + groupid="home" + hidden="true" + data-category="paneHome" + data-subcategory="contents" /> + </html:template> diff --git a/browser/components/preferences/home.js b/browser/components/preferences/home.js @@ -38,6 +38,77 @@ const NEW_TAB_KEY = "newTabURL"; const BLANK_HOMEPAGE_URL = "chrome://browser/content/blanktab.html"; +// New Prefs UI: we need to check for this setting before registering prefs +// so that old-style prefs continue working +if (Services.prefs.getBoolPref("browser.settings-redesign.enabled")) { + Preferences.addAll([ + { id: "browser.newtabpage.activity-stream.showSearch", type: "bool" }, + { + id: "browser.newtabpage.activity-stream.system.showWeather", + type: "bool", + }, + { id: "browser.newtabpage.activity-stream.showWeather", type: "bool" }, + { + id: "browser.newtabpage.activity-stream.widgets.system.lists.enabled", + type: "bool", + }, + { + id: "browser.newtabpage.activity-stream.widgets.lists.enabled", + type: "bool", + }, + { + id: "browser.newtabpage.activity-stream.widgets.system.focusTimer.enabled", + type: "bool", + }, + { + id: "browser.newtabpage.activity-stream.widgets.focusTimer.enabled", + type: "bool", + }, + ]); + + // Search + Preferences.addSetting({ + id: "webSearch", + pref: "browser.newtabpage.activity-stream.showSearch", + }); + + // Weather + Preferences.addSetting({ + id: "showWeather", + pref: "browser.newtabpage.activity-stream.system.showWeather", + }); + Preferences.addSetting({ + id: "weather", + pref: "browser.newtabpage.activity-stream.showWeather", + deps: ["showWeather"], + visible: ({ showWeather }) => showWeather.value, + }); + + // Widgets: lists + Preferences.addSetting({ + id: "listsEnabled", + pref: "browser.newtabpage.activity-stream.widgets.system.lists.enabled", + }); + Preferences.addSetting({ + id: "lists", + pref: "browser.newtabpage.activity-stream.widgets.lists.enabled", + deps: ["listsEnabled"], + visible: ({ listsEnabled }) => listsEnabled.value, + }); + + // Widgets: timer + Preferences.addSetting({ + id: "timerEnabled", + pref: "browser.newtabpage.activity-stream.widgets.system.focusTimer.enabled", + }); + Preferences.addSetting({ + id: "timer", + pref: "browser.newtabpage.activity-stream.widgets.focusTimer.enabled", + deps: ["timerEnabled"], + visible: ({ timerEnabled }) => timerEnabled.value, + }); +} + var gHomePane = { HOME_MODE_FIREFOX_HOME: "0", HOME_MODE_BLANK: "1", @@ -666,6 +737,8 @@ var gHomePane = { }, init() { + initSettingGroup("home"); + // Event Listeners document .getElementById("homePageUrl") diff --git a/browser/components/preferences/main.js b/browser/components/preferences/main.js @@ -1177,6 +1177,35 @@ let SETTINGS_CONFIG = { }, ], }, + home: { + inProgress: true, + headingLevel: 2, + l10nId: "home-prefs-content-header", + // Icons are not ready to be used yet. + // iconSrc: "chrome://browser/skin/home.svg", + items: [ + { + id: "webSearch", + l10nId: "home-prefs-search-header2", + control: "moz-toggle", + }, + { + id: "weather", + l10nId: "home-prefs-weather-header", + control: "moz-toggle", + }, + { + id: "lists", + l10nId: "home-prefs-lists-header", + control: "moz-toggle", + }, + { + id: "timer", + l10nId: "home-prefs-timer-header", + control: "moz-toggle", + }, + ], + }, zoom: { // This section is marked as in progress for testing purposes inProgress: true, diff --git a/browser/extensions/newtab/lib/AboutPreferences.sys.mjs b/browser/extensions/newtab/lib/AboutPreferences.sys.mjs @@ -205,6 +205,13 @@ export class AboutPreferences { * We have to potentially re-assign the `id` if it is `web-search`. * We should restore `id` back to a const after Fx146+. */ + + /* Do not render old-style settings if new settings UI is enabled - this is needed to avoid + * registering prefs twice and ensuing errors */ + if (Services.prefs.getBoolPref("browser.settings-redesign.enabled")) { + return; + } + let { id } = sectionData; const { pref: prefData, diff --git a/browser/locales/en-US/browser/preferences/preferences.ftl b/browser/locales/en-US/browser/preferences/preferences.ftl @@ -744,8 +744,9 @@ choose-bookmark = ## Home Section - Firefox Home Content Customization +home-prefs-content-header = + .label = { -firefox-home-brand-name } home-prefs-content-header2 = { -firefox-home-brand-name } Content -home-prefs-content-header3 = { -firefox-home-brand-name } home-prefs-content-description2 = Choose what content you want on your { -firefox-home-brand-name } screen. home-prefs-search-header = @@ -791,6 +792,14 @@ home-prefs-trending-search-header = .label = Trending searches home-prefs-trending-search-description = Popular and frequently searched topics +# Lists is a widget on New Tab, similar to a to-do widget +home-prefs-lists-header = + .label = Lists + +# Timer is a widget on New Tab, similar to the Pomodoro timer. +home-prefs-timer-header = + .label = Timer + # "Support" here means to help sustain or contribute to something, especially through funding or sponsorship. home-prefs-support-firefox-header = .label = Support { -brand-product-name }