commit d25533a3139886897113894cb89dbf40ad544ef4
parent eb15eb3da6f39a90e774e07cfc83152b38c05cd0
Author: Magnus Melin <mkmelin+mozilla@iki.fi>
Date: Fri, 3 Oct 2025 05:46:20 +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, 11 insertions(+), 1 deletion(-)
diff --git a/toolkit/components/telemetry/app/TelemetryReportingPolicy.sys.mjs b/toolkit/components/telemetry/app/TelemetryReportingPolicy.sys.mjs
@@ -702,6 +702,7 @@ var TelemetryReportingPolicyImpl = {
this.shutdown();
this._isFirstRun = undefined;
this._ensureUserIsNotifiedPromise = undefined;
+ this._nimbusVariables = {};
return this.setup();
},
@@ -780,7 +781,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(