commit ff2376c18bda1dcf77bd0adf8c4d869ebfd76cec
parent c93446545b68a2c6def7832da661547d441bb3fc
Author: Magnus Melin <mkmelin+mozilla@iki.fi>
Date: Thu, 2 Oct 2025 15:45:50 +0000
Bug 1991866 - Fix [c-c perma] toolkit/components/telemetry/tests/unit/test_TOUNotificationFlow.js | test_canUpload_allowed_when_both_bypass_prefs_true. r=mviar,toolkit-telemetry-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D266975
Diffstat:
2 files changed, 10 insertions(+), 1 deletion(-)
diff --git a/toolkit/components/telemetry/app/TelemetryReportingPolicy.sys.mjs b/toolkit/components/telemetry/app/TelemetryReportingPolicy.sys.mjs
@@ -780,7 +780,9 @@ var TelemetryReportingPolicyImpl = {
// set.
const bypassTOUFlow =
Services.prefs.getBoolPref(TOU_BYPASS_NOTIFICATION_PREF, false) ||
- !this._nimbusVariables.enabled;
+ (!Services.prefs.getBoolPref("browser.preonboarding.enabled", false) &&
+ this._nimbusVariables?.enabled !== true) ||
+ this._nimbusVariables?.enabled === false;
const allowInteractionData = Services.prefs.getBoolPref(
"datareporting.healthreport.uploadEnabled",
false
diff --git a/toolkit/components/telemetry/tests/unit/test_TOUNotificationFlow.js b/toolkit/components/telemetry/tests/unit/test_TOUNotificationFlow.js
@@ -756,6 +756,7 @@ add_task(async function test_canUpload_allowed_when_both_bypass_prefs_true() {
registerCleanupFunction(() => {
Services.prefs.clearUserPref(TelemetryUtils.Preferences.BypassNotification);
Services.prefs.clearUserPref("termsofuse.bypassNotification");
+ Services.prefs.clearUserPref("browser.preonboarding.enabled");
TelemetryReportingPolicy.reset();
});
@@ -772,10 +773,16 @@ add_task(async function test_canUpload_allowed_when_both_bypass_prefs_true() {
Services.prefs.setBoolPref("termsofuse.bypassNotification", false);
+ Services.prefs.setBoolPref("browser.preonboarding.enabled", true);
Assert.ok(
!TelemetryReportingPolicy.canUpload(),
"Upload blocked when only one bypass is true and no other allow path conditions are met"
);
+ Services.prefs.setBoolPref("browser.preonboarding.enabled", false);
+ Assert.ok(
+ TelemetryReportingPolicy.canUpload(),
+ "Upload NOT blocked when only one bypass is true and no other allow path conditions are met"
+ );
});
add_task(