Bug 1959542 - Enable ToS by default in Firefox 138.x mid-cycle dot release (Windows, Mac, Linux) r=hanna_a,omc-reviewers

- Show ToS modal by default for all new users on official builds
  - Remove code related to the on-train rollout for Mac/Linus/MSIX

Differential Revision: https://phabricator.services.mozilla.com/D247111
This commit is contained in:
Meg Viar
2025-04-29 18:57:33 +00:00
parent a8b24ef5ed
commit 7888974e9f
7 changed files with 46 additions and 259 deletions

View File

@@ -1788,11 +1788,6 @@ pref("browser.partnerlink.campaign.topsites", "amzn_2020_a1");
// Activates preloading of the new tab url. // Activates preloading of the new tab url.
pref("browser.newtab.preload", true); pref("browser.newtab.preload", true);
// If an on-train limited rollout of the preonboarding modal is enabled, the
// percentage of the Mac, Linux, and MSIX population to enroll. Default to 25% of
// population (2500 / 10000).
pref("browser.preonboarding.onTrainRolloutPopulation", 2500);
// Show "Download Firefox for mobile" QR code modal on newtab // Show "Download Firefox for mobile" QR code modal on newtab
pref("browser.newtabpage.activity-stream.mobileDownloadModal.enabled", false); pref("browser.newtabpage.activity-stream.mobileDownloadModal.enabled", false);
pref("browser.newtabpage.activity-stream.mobileDownloadModal.variant-a", false); pref("browser.newtabpage.activity-stream.mobileDownloadModal.variant-a", false);

View File

@@ -22,8 +22,7 @@ const PREF_ACCEPTED_POLICY_DATE =
PREF_BRANCH + "dataSubmissionPolicyNotifiedTime"; PREF_BRANCH + "dataSubmissionPolicyNotifiedTime";
const PREF_TOS_ROLLOUT_POPULATION = const PREF_TOS_ROLLOUT_POPULATION =
"browser.preonboarding.onTrainRolloutPopulation"; "browser.preonboarding.onTrainRolloutPopulation";
const PREF_TOS_ROLLOUT_ENROLLED = const PREF_TOS_ENABLED = "browser.preonboarding.enabled";
"browser.preonboarding.enrolledInOnTrainRollout";
const PREF_TELEMETRY_LOG_LEVEL = "toolkit.telemetry.log.level"; const PREF_TELEMETRY_LOG_LEVEL = "toolkit.telemetry.log.level";
@@ -124,6 +123,7 @@ add_setup(async function () {
const isFirstRun = Preferences.get(PREF_FIRST_RUN, true); const isFirstRun = Preferences.get(PREF_FIRST_RUN, true);
const bypassNotification = Preferences.get(PREF_BYPASS_NOTIFICATION, true); const bypassNotification = Preferences.get(PREF_BYPASS_NOTIFICATION, true);
const currentPolicyVersion = Preferences.get(PREF_CURRENT_POLICY_VERSION, 1); const currentPolicyVersion = Preferences.get(PREF_CURRENT_POLICY_VERSION, 1);
const TOSEnabled = Preferences.get(PREF_TOS_ENABLED, false);
// Register a cleanup function to reset our preferences. // Register a cleanup function to reset our preferences.
registerCleanupFunction(() => { registerCleanupFunction(() => {
@@ -131,9 +131,7 @@ add_setup(async function () {
Preferences.set(PREF_BYPASS_NOTIFICATION, bypassNotification); Preferences.set(PREF_BYPASS_NOTIFICATION, bypassNotification);
Preferences.set(PREF_CURRENT_POLICY_VERSION, currentPolicyVersion); Preferences.set(PREF_CURRENT_POLICY_VERSION, currentPolicyVersion);
Preferences.reset(PREF_TELEMETRY_LOG_LEVEL); Preferences.reset(PREF_TELEMETRY_LOG_LEVEL);
Preferences.reset(PREF_TOS_ROLLOUT_ENROLLED); Preferences.set(PREF_TOS_ENABLED, TOSEnabled);
Preferences.reset(PREF_TOS_ROLLOUT_POPULATION);
return closeAllNotifications(); return closeAllNotifications();
}); });
@@ -144,9 +142,8 @@ add_setup(async function () {
// Ensure this isn't the first run, because then we open the first run page. // Ensure this isn't the first run, because then we open the first run page.
Preferences.set(PREF_FIRST_RUN, false); Preferences.set(PREF_FIRST_RUN, false);
TelemetryReportingPolicy.testUpdateFirstRun(); TelemetryReportingPolicy.testUpdateFirstRun();
// Do not trigger ToS modal for Linux, Mac, and MSIX builds // Do not enable the TOS modal
Preferences.set(PREF_TOS_ROLLOUT_ENROLLED, false); Preferences.set(PREF_TOS_ENABLED, false);
Preferences.set(PREF_TOS_ROLLOUT_POPULATION, 0);
}); });
function clearAcceptedPolicy() { function clearAcceptedPolicy() {

View File

@@ -1408,7 +1408,7 @@ const BASE_MESSAGES = () => [
const PREONBOARDING_MESSAGES = () => [ const PREONBOARDING_MESSAGES = () => [
{ {
id: "ON_TRAIN_ROLLOUT", id: "NEW_USER_TOU_ONBOARDING",
enabled: true, enabled: true,
requireAction: true, requireAction: true,
currentPolicyVersion: 3, currentPolicyVersion: 3,

View File

@@ -3751,11 +3751,15 @@ pref("toolkit.legacyUserProfileCustomizations.stylesheets", false);
pref("datareporting.policy.dataSubmissionEnabled", true); pref("datareporting.policy.dataSubmissionEnabled", true);
pref("datareporting.policy.dataSubmissionPolicyNotifiedTime", "0"); pref("datareporting.policy.dataSubmissionPolicyNotifiedTime", "0");
pref("datareporting.policy.dataSubmissionPolicyAcceptedVersion", 0); pref("datareporting.policy.dataSubmissionPolicyAcceptedVersion", 0);
pref("datareporting.policy.dataSubmissionPolicyBypassNotification", false);
pref("datareporting.policy.currentPolicyVersion", 2); pref("datareporting.policy.currentPolicyVersion", 2);
pref("datareporting.policy.minimumPolicyVersion", 1); pref("datareporting.policy.minimumPolicyVersion", 1);
pref("datareporting.policy.minimumPolicyVersion.channel-beta", 2); pref("datareporting.policy.minimumPolicyVersion.channel-beta", 2);
pref("datareporting.policy.firstRunURL", "https://www.mozilla.org/privacy/firefox/"); pref("datareporting.policy.firstRunURL", "https://www.mozilla.org/privacy/firefox/");
#ifdef MOZILLA_OFFICIAL
pref("datareporting.policy.dataSubmissionPolicyBypassNotification", false);
#else
pref("datareporting.policy.dataSubmissionPolicyBypassNotification", true);
#endif
#endif #endif
#ifdef MOZ_SERVICES_HEALTHREPORT #ifdef MOZ_SERVICES_HEALTHREPORT

View File

@@ -769,12 +769,6 @@ preonboarding:
fallbackPref: datareporting.policy.firstRunURL fallbackPref: datareporting.policy.firstRunURL
description: >- description: >-
URL of browser tab to be opened on first run instead of infobar. URL of browser tab to be opened on first run instead of infobar.
onTrainRolloutPopulation:
type: int
fallbackPref: browser.preonboarding.onTrainRolloutPopulation
description: >-
If an on-train limited rollout is enabled, the percentage of the population to enroll
moreFromMozilla: moreFromMozilla:
description: "New page on about:preferences to suggest more Mozilla products" description: "New page on about:preferences to suggest more Mozilla products"

View File

@@ -13,7 +13,6 @@ const lazy = {};
ChromeUtils.defineESModuleGetters(lazy, { ChromeUtils.defineESModuleGetters(lazy, {
BrowserUtils: "resource://gre/modules/BrowserUtils.sys.mjs", BrowserUtils: "resource://gre/modules/BrowserUtils.sys.mjs",
ExperimentManager: "resource://nimbus/lib/ExperimentManager.sys.mjs",
TelemetrySend: "resource://gre/modules/TelemetrySend.sys.mjs", TelemetrySend: "resource://gre/modules/TelemetrySend.sys.mjs",
NimbusFeatures: "resource://nimbus/ExperimentAPI.sys.mjs", NimbusFeatures: "resource://nimbus/ExperimentAPI.sys.mjs",
OnboardingMessageProvider: OnboardingMessageProvider:
@@ -721,64 +720,6 @@ var TelemetryReportingPolicyImpl = {
}); });
}, },
async _configureFromOnTrainRollout() {
const ENROLLMENT_PREF = "browser.preonboarding.enrolledInOnTrainRollout";
const platformSupported =
AppConstants.platform == "linux" ||
AppConstants.platform == "macosx" ||
(AppConstants.platform === "win" &&
Services.sysinfo.getProperty("hasWinPackageId", false));
if (!platformSupported) {
return;
}
let enrolled;
// Only enroll new users
if (this.isFirstRun()) {
const count = this._nimbusVariables.onTrainRolloutPopulation;
if (!count) {
this._log.trace(
`_configureFromOnTrainRollout: User not enrolled in on-train rollout - population is 0, not setting preferences`
);
return;
}
const bucketConfig = {
count,
namespace: "firefox-desktop-preonboarding-on-train-rollout-1",
randomizationUnit: "normandy_id",
start: 0,
total: 10000,
};
enrolled =
await lazy.ExperimentManager.isInBucketAllocation(bucketConfig);
if (enrolled) {
Services.prefs.setBoolPref(ENROLLMENT_PREF, enrolled);
}
} else {
enrolled = Services.prefs.getBoolPref(ENROLLMENT_PREF, false);
}
if (enrolled) {
const preonboardingMessage =
lazy.OnboardingMessageProvider.getPreonboardingMessages().find(
m => m.id === "ON_TRAIN_ROLLOUT"
);
this._nimbusVariables = preonboardingMessage;
this._log.trace(
`_configureFromOnTrainRollout: User enrolled in on-train rollout, will set preferences`
);
} else {
this._log.trace(
`_configureFromOnTrainRollout: User not enrolled in on-train rollout, not setting preferences`
);
}
},
/** /**
* Capture Nimbus configuration: record feature variables for future use and * Capture Nimbus configuration: record feature variables for future use and
* set Gecko preferences based on values. * set Gecko preferences based on values.
@@ -787,7 +728,23 @@ var TelemetryReportingPolicyImpl = {
this._nimbusVariables = lazy.NimbusFeatures.preonboarding.getAllVariables(); this._nimbusVariables = lazy.NimbusFeatures.preonboarding.getAllVariables();
if (this._nimbusVariables.enabled === null) { if (this._nimbusVariables.enabled === null) {
await this._configureFromOnTrainRollout(); const preonboardingMessage =
lazy.OnboardingMessageProvider.getPreonboardingMessages().find(
m => m.id === "NEW_USER_TOU_ONBOARDING"
);
// Use default message variables, overriding with values from any set
// fallback prefs.
this._nimbusVariables = {
...preonboardingMessage,
...Object.fromEntries(
Object.entries(this._nimbusVariables).filter(
([_, value]) => value !== null
)
),
};
this._log.trace(
`_configureFromNimbus: using default preonboarding message`
);
} }
if (this._nimbusVariables.enabled) { if (this._nimbusVariables.enabled) {

View File

@@ -8,7 +8,6 @@
ChromeUtils.defineESModuleGetters(this, { ChromeUtils.defineESModuleGetters(this, {
AppConstants: "resource://gre/modules/AppConstants.sys.mjs", AppConstants: "resource://gre/modules/AppConstants.sys.mjs",
ClientEnvironment: "resource://normandy/lib/ClientEnvironment.sys.mjs",
ExperimentAPI: "resource://nimbus/ExperimentAPI.sys.mjs", ExperimentAPI: "resource://nimbus/ExperimentAPI.sys.mjs",
ExperimentFakes: "resource://testing-common/NimbusTestUtils.sys.mjs", ExperimentFakes: "resource://testing-common/NimbusTestUtils.sys.mjs",
ExperimentManager: "resource://nimbus/lib/ExperimentManager.sys.mjs", ExperimentManager: "resource://nimbus/lib/ExperimentManager.sys.mjs",
@@ -33,30 +32,6 @@ const TEST_CHANNEL = "TestChannelABC";
const PREF_MINIMUM_CHANNEL_POLICY_VERSION = const PREF_MINIMUM_CHANNEL_POLICY_VERSION =
TelemetryUtils.Preferences.MinimumPolicyVersion + ".channel-" + TEST_CHANNEL; TelemetryUtils.Preferences.MinimumPolicyVersion + ".channel-" + TEST_CHANNEL;
const ON_TRAIN_ROLLOUT_SUPPORTED_PLATFORM =
AppConstants.platform == "linux" ||
AppConstants.platform == "macosx" ||
(AppConstants.platform === "win" &&
Services.sysinfo.getProperty("hasWinPackageId", false));
const ON_TRAIN_ROLLOUT_POPULATION_PREF =
"browser.preonboarding.onTrainRolloutPopulation";
const ON_TRAIN_ROLLOUT_ENROLLMENT_PREF =
"browser.preonboarding.enrolledInOnTrainRollout";
const ON_TRAIN_TEST_RECIPE = {
slug: "new-onboarding-experience-on-train-rollout-phase-1",
bucketConfig: {
count: 100,
namespace: "firefox-desktop-preonboarding-on-train-rollout-1",
randomizationUnit: "normandy_id",
start: 0,
total: 10000,
},
branches: [{ slug: "treatment", ratio: 100 }],
};
function fakeShowPolicyTimeout(set, clear) { function fakeShowPolicyTimeout(set, clear) {
Policy.setShowInfobarTimeout = set; Policy.setShowInfobarTimeout = set;
Policy.clearShowInfobarTimeout = clear; Policy.clearShowInfobarTimeout = clear;
@@ -169,6 +144,10 @@ add_task(skipIfNotBrowser(), async function test_firstRun() {
const OTHER_RUNS_TIMEOUT_MSEC = 10 * 1000; // 10s const OTHER_RUNS_TIMEOUT_MSEC = 10 * 1000; // 10s
Services.prefs.clearUserPref(TelemetryUtils.Preferences.FirstRun); Services.prefs.clearUserPref(TelemetryUtils.Preferences.FirstRun);
// The new user TOS modal is now enabled by default, so the infobar will only
// show if preonboarding is explicitly turned off via nimbus variable or its
// fallback pref.
Services.prefs.setBoolPref("browser.preonboarding.enabled", false);
let promiseTimeout = () => let promiseTimeout = () =>
new Promise(resolve => { new Promise(resolve => {
@@ -199,6 +178,8 @@ add_task(skipIfNotBrowser(), async function test_firstRun() {
OTHER_RUNS_TIMEOUT_MSEC, OTHER_RUNS_TIMEOUT_MSEC,
"The infobar display timeout should be 10s on other runs." "The infobar display timeout should be 10s on other runs."
); );
Services.prefs.clearUserPref("browser.preonboarding.enabled");
}); });
add_task(async function test_prefs() { add_task(async function test_prefs() {
@@ -709,89 +690,26 @@ add_task(
} }
); );
const getOnTrainRolloutModalStub = async ({
shouldEnroll,
isFirstRun,
isEnrolled,
}) => {
Services.prefs.setIntPref(
ON_TRAIN_ROLLOUT_POPULATION_PREF,
ON_TRAIN_TEST_RECIPE.bucketConfig.count
);
Services.prefs.setBoolPref(ON_TRAIN_ROLLOUT_ENROLLMENT_PREF, isEnrolled);
Services.prefs.setBoolPref(TelemetryUtils.Preferences.FirstRun, isFirstRun);
const testIDs = await ExperimentManager.generateTestIds(ON_TRAIN_TEST_RECIPE);
let experimentId = shouldEnroll ? testIDs.treatment : testIDs.notInExperiment;
sinon.stub(ClientEnvironment, "userId").get(() => experimentId);
let modalStub = sinon.stub(Policy, "showModal").returns(true);
fakeResetAcceptedPolicy();
TelemetryReportingPolicy.reset();
let p = Policy.delayedSetup();
Policy.fakeSessionRestoreNotification();
fakeInteractWithModal();
await p;
const doCleanup = () => {
sinon.restore();
fakeResetAcceptedPolicy();
Services.prefs.clearUserPref(ON_TRAIN_ROLLOUT_POPULATION_PREF);
Services.prefs.clearUserPref(ON_TRAIN_ROLLOUT_ENROLLMENT_PREF);
};
return { modalStub, doCleanup };
};
add_task( add_task(
skipIfNotBrowser(), skipIfNotBrowser(),
async function test_onTrainRollout_configuration_supportedOS_should_enroll() { async function test_default_modal_shows_when_not_enrolled_in_experiment() {
if (!ON_TRAIN_ROLLOUT_SUPPORTED_PLATFORM) { let modalStub = sinon.stub(Policy, "showModal").returns(true);
info(
"Skipping supported OS test because current platform is not Linux, Mac, or Win MSIX"
);
return;
}
const { modalStub, doCleanup } = await getOnTrainRolloutModalStub({ fakeResetAcceptedPolicy();
shouldEnroll: true, TelemetryReportingPolicy.reset();
isFirstRun: true, let p = Policy.delayedSetup();
isEnrolled: false, Policy.fakeSessionRestoreNotification();
}); fakeInteractWithModal();
await p;
Assert.equal( Assert.equal(
modalStub.callCount, modalStub.callCount,
1, 1,
"showModal is invoked once if enrolled in rollout" "showModal is invoked once when not enrolled in an experiemnt"
); );
doCleanup(); sinon.restore();
} fakeResetAcceptedPolicy();
);
add_task(
skipIfNotBrowser(),
async function test_onTrainRollout_configuration_supportedOS_should_not_enroll() {
if (!ON_TRAIN_ROLLOUT_SUPPORTED_PLATFORM) {
info(
"Skipping supported OS test because current platform is not Linux, Mac, or Win MSIX"
);
return;
}
const { modalStub, doCleanup } = await getOnTrainRolloutModalStub({
shouldEnroll: false,
isFirstRun: true,
isEnrolled: false,
});
Assert.equal(
modalStub.callCount,
0,
"showModal is not invoked if not enrolled in rollout"
);
doCleanup();
} }
); );
@@ -827,7 +745,7 @@ add_task(
await p; await p;
Assert.ok( Assert.ok(
unblockSpy.calledOnce, unblockSpy.callCount >= blockSpy.callCount,
"Jump list should be unblocked after user interacts with modal" "Jump list should be unblocked after user interacts with modal"
); );
@@ -836,81 +754,3 @@ add_task(
sinon.restore(); sinon.restore();
} }
); );
add_task(
skipIfNotBrowser(),
async function test_onTrainRollout_configuration_unsupportedOS() {
if (ON_TRAIN_ROLLOUT_SUPPORTED_PLATFORM) {
info(
"Skipping unsupported OS test because current platform is supported"
);
return;
}
const { modalStub, doCleanup } = await getOnTrainRolloutModalStub({
shouldEnroll: true,
isFirstRun: true,
isEnrolled: false,
});
Assert.equal(
modalStub.callCount,
0,
"showModal is not invoked on unsupported OS even if on-train rollouts are enabled and user would otherwise be enrolled"
);
doCleanup();
}
);
add_task(
skipIfNotBrowser(),
async function test_onTrainRollout_subsequent_startup_after_enrolled() {
if (!ON_TRAIN_ROLLOUT_SUPPORTED_PLATFORM) {
info(
"Skipping supported OS test because current platform is not Linux, Mac, or Win MSIX"
);
return;
}
const { modalStub, doCleanup } = await getOnTrainRolloutModalStub({
shouldEnroll: true,
isFirstRun: false,
isEnrolled: true,
});
Assert.equal(
modalStub.callCount,
1,
"showModal is invoked on subsequent startup if user was enrolled on first startup but did not interact with modal"
);
doCleanup();
}
);
add_task(
skipIfNotBrowser(),
async function test_onTrainRollout_subsequent_startup_not_enrolled() {
if (!ON_TRAIN_ROLLOUT_SUPPORTED_PLATFORM) {
info(
"Skipping supported OS test because current platform is not Linux, Mac, or Win MSIX"
);
return;
}
const { modalStub, doCleanup } = await getOnTrainRolloutModalStub({
shouldEnroll: true,
isFirstRun: false,
isEnrolled: false,
});
Assert.equal(
modalStub.callCount,
0,
"showModal is not invoked on subsequent startup if user was not enrolled on first startup"
);
doCleanup();
}
);