Skip to content
Snippets Groups Projects
Commit 652ef0f5 authored by Shane Hughes's avatar Shane Hughes
Browse files

Bug 1788966 - Stop showing privacy segmentation screen. r=Mardak

Remove the privacy segmentation screen unless a Nimbus variable or its fallback
pref is set. Bug 1788967 sets this pref to false, so this should remove the
screen by default but leave it available for us to continue work on it.

Differential Revision: https://phabricator.services.mozilla.com/D156330
parent 7ec7dec6
No related branches found
No related tags found
No related merge requests found
......@@ -17,6 +17,7 @@ XPCOMUtils.defineLazyModuleGetters(lazy, {
BrowserUtils: "resource://gre/modules/BrowserUtils.jsm",
ShellService: "resource:///modules/ShellService.jsm",
BuiltInThemes: "resource:///modules/BuiltInThemes.jsm",
NimbusFeatures: "resource://nimbus/ExperimentAPI.jsm",
});
XPCOMUtils.defineLazyPreferenceGetter(
......@@ -947,6 +948,12 @@ const OnboardingMessageProvider = {
let isDefault = await lazy.ShellService.isDefaultBrowser();
return checkDefault && !isDefault;
},
_shouldShowPrivacySegmentationScreen() {
// Fall back to pref: browser.privacySegmentation.preferences.show
return lazy.NimbusFeatures.majorRelease2022.getVariable(
"feltPrivacyShowPreferencesSection"
);
},
_doesHomepageNeedReset() {
return (
Services.prefs.prefHasUserValue(HOMEPAGE_PREF) ||
......@@ -976,6 +983,7 @@ const OnboardingMessageProvider = {
const needPin = await this._doesAppNeedPin();
const needDefault = await this._doesAppNeedDefault();
const needPrivatePin = await this._doesAppNeedPin(true);
const showSegmentation = this._shouldShowPrivacySegmentationScreen();
//If a user has Firefox as default remove import screen
if (!needDefault) {
......@@ -1022,6 +1030,12 @@ const OnboardingMessageProvider = {
);
}
if (!showSegmentation) {
removeScreens(screen =>
screen.id?.startsWith("UPGRADE_PRIVACY_SEGMENTATION")
);
}
//If privatePin, remove checkbox from pinscreen
if (!needPrivatePin) {
delete content.screens?.find(
......
......@@ -355,6 +355,27 @@ add_task(
}
);
add_task(async function test_aboutwelcome_privacy_segmentation_pref() {
async function testPrivacySegmentation(enabled = false) {
await pushPrefs(["browser.privacySegmentation.preferences.show", enabled]);
let screenIds = ["UPGRADE_PRIVACY_SEGMENTATION", "UPGRADE_GRATITUDE"];
let browser = await openMRUpgradeWelcome(screenIds);
await test_upgrade_screen_content(
browser,
//Expected selectors
[`main.${screenIds[enabled ? 0 : 1]}`],
//Unexpected selectors:
[`main.${screenIds[enabled ? 1 : 0]}`]
);
await BrowserTestUtils.removeTab(gBrowser.selectedTab);
await popPrefs();
}
for (let enabled of [true, false]) {
await testPrivacySegmentation(enabled);
}
});
add_task(async function test_aboutwelcome_upgrade_show_firefox_view() {
let browser = await openMRUpgradeWelcome(["UPGRADE_GRATITUDE"]);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment