tor-browser

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

commit 46ff7e98c870723eb7e87cb4abadf6c9f3d8ab60
parent 61bf0a41d6b50c40cdbef5f02193fbebc1afd77c
Author: Maxx Crawford <mcrawford@mozilla.com>
Date:   Fri,  9 Jan 2026 21:53:34 +0000

Bug 2009484 - Add trainhopConfig to reverse weather opt-in button order. r=home-newtab-reviewers,nbarrett

This patch adds support for a new trainhopConfig property
`weather.reverseOptInButtons` that allows swapping the order of the
"Yes" and "Not now" buttons in the weather opt-in dialog.

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

Diffstat:
Mbrowser/extensions/newtab/content-src/components/Weather/Weather.jsx | 22++++++++++++++++------
Mbrowser/extensions/newtab/data/content/activity-stream.bundle.js | 21+++++++++++++++------
2 files changed, 31 insertions(+), 12 deletions(-)

diff --git a/browser/extensions/newtab/content-src/components/Weather/Weather.jsx b/browser/extensions/newtab/content-src/components/Weather/Weather.jsx @@ -285,6 +285,14 @@ export class _Weather extends React.PureComponent { const weatherOptIn = Prefs.values["system.showWeatherOptIn"]; const nimbusWeatherOptInEnabled = Prefs.values.trainhopConfig?.weather?.weatherOptInEnabled; + // Bug 2009484: Controls button order in opt-in dialog for A/B testing. + // When true, "Not now" gets slot="primary"; + // when false/undefined, "Yes" gets slot="primary". + // Also note the primary button's position varies by platform: + // on Windows, it appears on the left, + // while on Linux and macOS, it appears on the right. + const reverseOptInButtons = + Prefs.values.trainhopConfig?.weather?.reverseOptInButtons; const optInDisplayed = Prefs.values["weather.optInDisplayed"]; const optInUserChoice = Prefs.values["weather.optInAccepted"]; @@ -470,16 +478,18 @@ export class _Weather extends React.PureComponent { <moz-button size="small" type="default" - data-l10n-id="newtab-weather-opt-in-not-now" - onClick={this.handleRejectOptIn} - id="reject-opt-in" + data-l10n-id="newtab-weather-opt-in-yes" + onClick={this.handleAcceptOptIn} + id="accept-opt-in" + slot={reverseOptInButtons ? "" : "primary"} /> <moz-button size="small" type="default" - data-l10n-id="newtab-weather-opt-in-yes" - onClick={this.handleAcceptOptIn} - id="accept-opt-in" + data-l10n-id="newtab-weather-opt-in-not-now" + onClick={this.handleRejectOptIn} + id="reject-opt-in" + slot={reverseOptInButtons ? "primary" : ""} /> </moz-button-group> </div> diff --git a/browser/extensions/newtab/data/content/activity-stream.bundle.js b/browser/extensions/newtab/data/content/activity-stream.bundle.js @@ -11031,6 +11031,13 @@ class _Weather extends (external_React_default()).PureComponent { const showDetailedView = Prefs.values["weather.display"] === "detailed"; const weatherOptIn = Prefs.values["system.showWeatherOptIn"]; const nimbusWeatherOptInEnabled = Prefs.values.trainhopConfig?.weather?.weatherOptInEnabled; + // Bug 2009484: Controls button order in opt-in dialog for A/B testing. + // When true, "Not now" gets slot="primary"; + // when false/undefined, "Yes" gets slot="primary". + // Also note the primary button's position varies by platform: + // on Windows, it appears on the left, + // while on Linux and macOS, it appears on the right. + const reverseOptInButtons = Prefs.values.trainhopConfig?.weather?.reverseOptInButtons; const optInDisplayed = Prefs.values["weather.optInDisplayed"]; const optInUserChoice = Prefs.values["weather.optInAccepted"]; const staticWeather = Prefs.values["weather.staticData.enabled"]; @@ -11147,15 +11154,17 @@ class _Weather extends (external_React_default()).PureComponent { }, /*#__PURE__*/external_React_default().createElement("moz-button", { size: "small", type: "default", - "data-l10n-id": "newtab-weather-opt-in-not-now", - onClick: this.handleRejectOptIn, - id: "reject-opt-in" + "data-l10n-id": "newtab-weather-opt-in-yes", + onClick: this.handleAcceptOptIn, + id: "accept-opt-in", + slot: reverseOptInButtons ? "" : "primary" }), /*#__PURE__*/external_React_default().createElement("moz-button", { size: "small", type: "default", - "data-l10n-id": "newtab-weather-opt-in-yes", - onClick: this.handleAcceptOptIn, - id: "accept-opt-in" + "data-l10n-id": "newtab-weather-opt-in-not-now", + onClick: this.handleRejectOptIn, + id: "reject-opt-in", + slot: reverseOptInButtons ? "primary" : "" })))))); } return /*#__PURE__*/external_React_default().createElement("div", {