commit 5a5d32606016abf413fe9091dce3d2e90777938b
parent 301767050c77530c86ae2a41f6689d1f43d96460
Author: Beth Rennie <beth@brennie.ca>
Date: Fri, 9 Jan 2026 21:10:30 +0000
Bug 2003349 - Hide rollouts from about:studies unless nimbus.debug=true r=nimbus-reviewers,relud
Differential Revision: https://phabricator.services.mozilla.com/D274650
Diffstat:
2 files changed, 54 insertions(+), 9 deletions(-)
diff --git a/toolkit/components/normandy/content/AboutPages.sys.mjs b/toolkit/components/normandy/content/AboutPages.sys.mjs
@@ -102,11 +102,15 @@ ChromeUtils.defineLazyGetter(AboutPages, "aboutStudies", () => {
},
getMessagingSystemList() {
+ const debugEnabled = Services.prefs.getBoolPref("nimbus.debug");
+
// Do not include Firefox Labs. Those are shown on
// about:preferences#experimental.
+ //
+ // Only show Rollouts if nimbus.debug is enabled.
return lazy.ExperimentAPI.manager.store
.getAll()
- .filter(e => !e.isFirefoxLabsOptIn);
+ .filter(e => !e.isFirefoxLabsOptIn && (debugEnabled || !e.isRollout));
},
async optInToExperiment(data) {
diff --git a/toolkit/components/normandy/test/browser/browser_about_studies.js b/toolkit/components/normandy/test/browser/browser_about_studies.js
@@ -741,10 +741,12 @@ add_task(async function test_nimbus_about_studies_rollout() {
return content.document.querySelectorAll(".study-name").length;
});
// Make sure strings are properly shown
- Assert.equal(studyCount, 1, "Rollout loaded in non-debug mode");
+ Assert.equal(studyCount, 0, "Rollout not loaded in non-debug mode");
}
);
- Services.prefs.setBoolPref("nimbus.debug", true);
+ await SpecialPowers.pushPrefEnv({
+ set: [["nimbus.debug", true]],
+ });
await BrowserTestUtils.withNewTab(
{ gBrowser, url: "about:studies" },
async browser => {
@@ -785,7 +787,7 @@ add_task(async function test_nimbus_about_studies_rollout() {
);
// Cleanup for multiple test runs
await NimbusTestUtils.assert.storeIsEmpty(ExperimentAPI.manager.store);
- Services.prefs.clearUserPref("nimbus.debug");
+ await SpecialPowers.popPrefEnv();
});
add_task(async function test_getStudiesEnabled() {
@@ -870,7 +872,7 @@ add_task(async function test_forceEnroll() {
sandbox.restore();
});
-add_task(async function test_inactive_rollouts_under_completed_studies() {
+add_task(async function test_inactive_rollouts_not_under_completed_studies() {
// Adds an active experiment and rollout
const experiment = NimbusTestUtils.factories.recipe("my-testing-experiment");
const rollout = NimbusTestUtils.factories.recipe("my-testing-rollout", {
@@ -904,12 +906,12 @@ add_task(async function test_inactive_rollouts_under_completed_studies() {
"active list should include enrolled experiment"
);
Assert.ok(
- activeListItems.includes(rollout.slug),
+ !activeListItems.includes(rollout.slug),
"active list should include enrolled rollout"
);
Assert.equal(
activeListItems.length,
- 2,
+ 1,
"should be 2 elements in active list"
);
}
@@ -942,17 +944,56 @@ add_task(async function test_inactive_rollouts_under_completed_studies() {
"inactive list should include unenrolled experiment"
);
Assert.ok(
+ !inactiveListItems.includes(rollout.slug),
+ "inactive list should not include unenrolled rollout"
+ );
+ Assert.equal(
+ inactiveListItems.length,
+ 1,
+ "should be 2 items in inactive list"
+ );
+ }
+ );
+
+ await SpecialPowers.pushPrefEnv({
+ set: [["nimbus.debug", true]],
+ });
+
+ await BrowserTestUtils.withNewTab(
+ { gBrowser, url: "about:studies" },
+ async browser => {
+ const inactiveListItems = await SpecialPowers.spawn(
+ browser,
+ [],
+ async () => {
+ await ContentTaskUtils.waitForCondition(
+ () => content.document.querySelector(".nimbus.disabled"),
+ "waiting for the experiment to become disabled"
+ );
+ return Array.from(
+ content.document.querySelectorAll("ul.inactive-study-list li")
+ ).map(el => el.dataset.studySlug);
+ }
+ );
+
+ Assert.ok(
+ inactiveListItems.includes(experiment.slug),
+ "inactive list should include unenrolled experiment"
+ );
+ Assert.ok(
inactiveListItems.includes(rollout.slug),
- "inactive list should include unenrolled rollout"
+ "inactive list should include unenrolled rollout in debug"
);
Assert.equal(
inactiveListItems.length,
2,
- "should be 2 items in inactive list"
+ "should be 2 items in inactive list in debug"
);
}
);
+ await SpecialPowers.popPrefEnv();
+
// Cleanup for multiple test runs
await NimbusTestUtils.assert.storeIsEmpty(ExperimentAPI.manager.store);
});