Backed out changeset 89b76affef99 (bug 1883673) for causing multiple bc failures. CLOSED TREE

This commit is contained in:
Iulian Moraru
2024-04-22 22:12:59 +03:00
parent 602a51ea53
commit b2f394db04
14 changed files with 183 additions and 22 deletions

View File

@@ -827,6 +827,10 @@ pref("browser.privatebrowsing.vpnpromourl", "https://vpn.mozilla.org/?utm_source
// Whether the user has opted-in to recommended settings for data features.
pref("browser.dataFeatureRecommendations.enabled", false);
// Temporary pref to control whether or not Private Browsing windows show up
// as separate icons in the Windows taskbar.
pref("browser.privateWindowSeparation.enabled", true);
// Use dark theme variant for PBM windows. This is only supported if the theme
// sets darkTheme data.
pref("browser.theme.dark-private-windows", true);

View File

@@ -322,7 +322,12 @@ function openBrowserWindow(
Ci.nsILoadContext
).usePrivateBrowsing = true;
if (AppConstants.platform == "win") {
if (
AppConstants.platform == "win" &&
lazy.NimbusFeatures.majorRelease2022.getVariable(
"feltPrivacyWindowSeparation"
)
) {
lazy.WinTaskbar.setGroupIdForWindow(
win,
lazy.WinTaskbar.defaultPrivateGroupId

View File

@@ -2710,6 +2710,12 @@ BrowserGlue.prototype = {
name: "ensurePrivateBrowsingShortcutExists",
condition:
AppConstants.platform == "win" &&
// Pref'ed off until Private Browsing window separation is enabled by default
// to avoid a situation where a user pins the Private Browsing shortcut to
// the Taskbar, which will end up launching into a different Taskbar icon.
lazy.NimbusFeatures.majorRelease2022.getVariable(
"feltPrivacyWindowSeparation"
) &&
// We don't want a shortcut if it's been disabled, eg: by enterprise policy.
lazy.PrivateBrowsingUtils.enabled &&
// Private Browsing shortcuts for packaged builds come with the package,
@@ -4520,7 +4526,10 @@ BrowserGlue.prototype = {
return "disallow-postUpdate";
}
const useMROnboarding =
lazy.NimbusFeatures.majorRelease2022.getVariable("onboarding");
const showUpgradeDialog =
useMROnboarding ??
lazy.NimbusFeatures.upgradeDialog.getVariable("enabled");
return showUpgradeDialog ? "" : "disabled";

View File

@@ -34,6 +34,7 @@ Please note that some targeting attributes require stricter controls on the tele
* [hasMigratedPasswords](#hasmigratedpasswords)
* [hasPinnedTabs](#haspinnedtabs)
* [homePageSettings](#homepagesettings)
* [inMr2022Holdback](#inmr2022holdback)
* [isBackgroundTaskMode](#isbackgroundtaskmode)
* [isChinaRepack](#ischinarepack)
* [isDefaultBrowser](#isdefaultbrowser)
@@ -971,6 +972,10 @@ mode, or `null` if this invocation is not running in background task mode.
Checks if user prefers reduced motion as indicated by the value of a media query for `prefers-reduced-motion`.
### `inMr2022Holdback`
A boolean. `true` when the user is in the Major Release 2022 holdback study.
### `distributionId`
A string containing the id of the distribution, or the empty string if there

View File

@@ -45,6 +45,7 @@ ChromeUtils.defineESModuleGetters(lazy, {
ClientEnvironment: "resource://normandy/lib/ClientEnvironment.sys.mjs",
CustomizableUI: "resource:///modules/CustomizableUI.sys.mjs",
HomePage: "resource:///modules/HomePage.sys.mjs",
NimbusFeatures: "resource://nimbus/ExperimentAPI.sys.mjs",
ProfileAge: "resource://gre/modules/ProfileAge.sys.mjs",
Region: "resource://gre/modules/Region.sys.mjs",
TargetingContext: "resource://messaging-system/targeting/Targeting.sys.mjs",
@@ -877,6 +878,15 @@ const TargetingGetters = {
return window?.matchMedia("(prefers-reduced-motion: reduce)")?.matches;
},
/**
* Whether or not the user is in the Major Release 2022 holdback study.
*/
get inMr2022Holdback() {
return (
lazy.NimbusFeatures.majorRelease2022.getVariable("onboarding") === false
);
},
/**
* The distribution id, if any.
* @return {string}

View File

@@ -157,7 +157,7 @@ const MESSAGES = () => {
// Add the highest possible cap to ensure impressions are recorded while allowing the Spotlight to sync across windows/tabs with Firefox View open
lifetime: 100,
},
targeting: `source == "about:firefoxview" &&
targeting: `!inMr2022Holdback && source == "about:firefoxview" &&
!'browser.newtabpage.activity-stream.asrouter.providers.cfr'|preferenceIsUserSet &&
'browser.newtabpage.activity-stream.asrouter.userprefs.cfr.features'|preferenceValue &&
${matchCurrentScreenTargeting(
@@ -303,7 +303,7 @@ const MESSAGES = () => {
],
},
priority: 3,
targeting: `source == "about:firefoxview" && ${matchCurrentScreenTargeting(
targeting: `!inMr2022Holdback && source == "about:firefoxview" && ${matchCurrentScreenTargeting(
FIREFOX_VIEW_PREF,
"FEATURE_CALLOUT_[0-9]"
)} && ${matchIncompleteTargeting(FIREFOX_VIEW_PREF)}`,
@@ -376,7 +376,7 @@ const MESSAGES = () => {
],
},
priority: 2,
targeting: `source == "about:firefoxview" && "browser.firefox-view.view-count" | preferenceValue > 2
targeting: `!inMr2022Holdback && source == "about:firefoxview" && "browser.firefox-view.view-count" | preferenceValue > 2
&& (("identity.fxaccounts.enabled" | preferenceValue == false) || !(("services.sync.engine.tabs" | preferenceValue == true) && ("services.sync.username" | preferenceValue))) && (!messageImpressions.FIREFOX_VIEW_SPOTLIGHT[messageImpressions.FIREFOX_VIEW_SPOTLIGHT | length - 1] || messageImpressions.FIREFOX_VIEW_SPOTLIGHT[messageImpressions.FIREFOX_VIEW_SPOTLIGHT | length - 1] < currentDate|date - ${ONE_DAY_IN_MS})`,
frequency: {
lifetime: 1,

View File

@@ -24,6 +24,7 @@ const lazy = {};
ChromeUtils.defineESModuleGetters(lazy, {
BrowserUtils: "resource://gre/modules/BrowserUtils.sys.mjs",
NimbusFeatures: "resource://nimbus/ExperimentAPI.sys.mjs",
ShellService: "resource:///modules/ShellService.sys.mjs",
});
@@ -870,7 +871,7 @@ const BASE_MESSAGES = () => [
],
lifetime: 12,
},
targeting: "doesAppNeedPrivatePin",
targeting: "!inMr2022Holdback && doesAppNeedPrivatePin",
},
{
id: "PB_NEWTAB_COOKIE_BANNERS_PROMO",
@@ -1373,8 +1374,9 @@ export const OnboardingMessageProvider = {
return checkDefault && !isDefault;
},
_shouldShowPrivacySegmentationScreen() {
return Services.prefs.getBoolPref(
"browser.privacySegmentation.preferences.show"
// Fall back to pref: browser.privacySegmentation.preferences.show
return lazy.NimbusFeatures.majorRelease2022.getVariable(
"feltPrivacyShowPreferencesSection"
);
},
_doesHomepageNeedReset() {

View File

@@ -1226,6 +1226,47 @@ add_task(async function check_userPrefersReducedMotion() {
);
});
add_task(async function test_mr2022Holdback() {
await ExperimentAPI.ready();
ok(
!ASRouterTargeting.Environment.inMr2022Holdback,
"Should not be in holdback (no experiment)"
);
{
const doExperimentCleanup = await ExperimentFakes.enrollWithFeatureConfig({
featureId: "majorRelease2022",
value: {
onboarding: true,
},
});
ok(
!ASRouterTargeting.Environment.inMr2022Holdback,
"Should not be in holdback (onboarding = true)"
);
await doExperimentCleanup();
}
{
const doExperimentCleanup = await ExperimentFakes.enrollWithFeatureConfig({
featureId: "majorRelease2022",
value: {
onboarding: false,
},
});
ok(
ASRouterTargeting.Environment.inMr2022Holdback,
"Should be in holdback (onboarding = false)"
);
await doExperimentCleanup();
}
});
add_task(async function test_distributionId() {
is(
ASRouterTargeting.Environment.distributionId,

View File

@@ -3227,8 +3227,8 @@ var gPrivacyPane = {
initDataCollection() {
if (
!AppConstants.MOZ_DATA_REPORTING &&
!Services.prefs.getBoolPref(
"browser.privacySegmentation.preferences.show"
!NimbusFeatures.majorRelease2022.getVariable(
"feltPrivacyShowPreferencesSection"
)
) {
// Nothing to control in the data collection section, remove it.
@@ -3255,19 +3255,16 @@ var gPrivacyPane = {
// Section visibility
let section = document.getElementById("privacySegmentationSection");
let updatePrivacySegmentationSectionVisibilityState = () => {
section.hidden = !Services.prefs.getBoolPref(
"browser.privacySegmentation.preferences.show"
section.hidden = !NimbusFeatures.majorRelease2022.getVariable(
"feltPrivacyShowPreferencesSection"
);
};
Services.prefs.addObserver(
"browser.privacySegmentation.preferences.show",
NimbusFeatures.majorRelease2022.onUpdate(
updatePrivacySegmentationSectionVisibilityState
);
window.addEventListener("unload", () => {
Services.prefs.removeObserver(
"browser.privacySegmentation.preferences.show",
NimbusFeatures.majorRelease2022.offUpdate(
updatePrivacySegmentationSectionVisibilityState
);
});

View File

@@ -54,3 +54,57 @@ add_task(async function test_pin_promo() {
await BrowserTestUtils.closeWindow(win3);
await BrowserTestUtils.closeWindow(win4);
});
add_task(async function test_pin_promo_mr2022_holdback() {
ASRouter.resetMessageState();
// Set majorRelease2022 feature onboarding variable fallback pref
// for inMr2022Holdback targeting to evaluate true
await SpecialPowers.pushPrefEnv({
set: [["browser.majorrelease.onboarding", false]],
});
await ASRouter.onPrefChange();
let { win: win1, tab: tab1 } = await openTabAndWaitForRender();
await SpecialPowers.spawn(tab1, [], async function () {
const promoContainer = content.document.querySelector(".promo");
const promoButton = content.document.querySelector(
"#private-browsing-promo-link"
);
ok(promoContainer, "Promo is shown");
Assert.equal(
promoButton.getAttribute("data-l10n-id"),
"about-private-browsing-focus-promo-cta",
"Pin Promo not shown for holdback user"
);
});
await BrowserTestUtils.closeWindow(win1);
});
add_task(async function test_pin_promo_mr2022_not_holdback() {
ASRouter.resetMessageState();
// Set majorRelease2022 feature onboarding variable fallback pref
// for inMr2022Holdback targeting to evaluate false
await SpecialPowers.pushPrefEnv({
set: [["browser.majorrelease.onboarding", true]],
});
await ASRouter.onPrefChange();
let { win: win1, tab: tab1 } = await openTabAndWaitForRender();
await SpecialPowers.spawn(tab1, [], async function () {
const promoContainer = content.document.querySelector(".promo");
const promoHeader = content.document.getElementById("promo-header");
ok(promoContainer, "Promo is shown");
is(
promoHeader.getAttribute("data-l10n-id"),
"about-private-browsing-pin-promo-header",
"Pin Promo is shown"
);
});
await BrowserTestUtils.closeWindow(win1);
});

View File

@@ -1420,6 +1420,33 @@ gleanInternalSdk:
branch: user
pref: telemetry.glean.internal.maxPingsPerMinute
majorRelease2022:
description: Major Release 2022
owner: firefoxview@mozilla.com
hasExposure: false
isEarlyStartup: true
variables:
feltPrivacyPBMDarkTheme:
type: boolean
fallbackPref: "browser.theme.dark-private-windows"
description: "Use dark theme variant for PBM windows. This is only supported if the theme sets darkTheme data."
feltPrivacyShowPreferencesSection:
type: boolean
fallbackPref: "browser.privacySegmentation.preferences.show"
description: "Controls visibility of the privacy segmentation preferences section."
feltPrivacyWindowSeparation:
type: boolean
fallbackPref: "browser.privateWindowSeparation.enabled"
description: "Whether or not private browsing windows use a separate icon in the Windows taskbar"
colorwayCloset:
type: boolean
fallbackPref: "browser.theme.colorway-closet"
description: "Whether or not to show the colorway closet modal"
onboarding:
type: boolean
fallbackPref: "browser.majorrelease.onboarding"
description: "Whether or not to use the MR2022 onboarding settings."
browserLowMemoryPrefs:
description: Prefs which control the browser's behaviour under low memory.
owner: haftandilian@mozilla.com

View File

@@ -25,6 +25,7 @@ NIMBUS_FALLBACK_PREFS = (
# See https://bugzilla.mozilla.org/show_bug.cgi?id=1875331 for details.
ALLOWED_ISEARLYSTARTUP_FEATURE_IDS = {
"aboutwelcome",
"majorRelease2022",
"newtab",
"pocketNewtab",
"searchConfiguration",

View File

@@ -8,6 +8,7 @@ const lazy = {};
// Get the theme variables from the app resource directory.
// This allows per-app variables.
ChromeUtils.defineESModuleGetters(lazy, {
NimbusFeatures: "resource://nimbus/ExperimentAPI.sys.mjs",
PrivateBrowsingUtils: "resource://gre/modules/PrivateBrowsingUtils.sys.mjs",
ThemeContentPropertyList: "resource:///modules/ThemeVariableMap.sys.mjs",
ThemeVariableMap: "resource:///modules/ThemeVariableMap.sys.mjs",
@@ -254,7 +255,9 @@ LightweightThemeConsumer.prototype = {
// If enabled, apply the dark theme variant to private browsing windows.
if (
Services.prefs.getBoolPref("browser.theme.dark-private-windows") ||
!lazy.NimbusFeatures.majorRelease2022.getVariable(
"feltPrivacyPBMDarkTheme"
) ||
!lazy.PrivateBrowsingUtils.isWindowPrivate(this._win) ||
lazy.PrivateBrowsingUtils.permanentPrivateBrowsing
) {

View File

@@ -166,6 +166,7 @@
#include "mozilla/StaticPrefs_ui.h"
#include "mozilla/StaticPrefs_widget.h"
#include "nsNativeAppSupportWin.h"
#include "mozilla/browser/NimbusFeatures.h"
#include "nsIGfxInfo.h"
#include "nsUXThemeConstants.h"
@@ -988,11 +989,13 @@ nsresult nsWindow::Create(nsIWidget* aParent, nsNativeWidget aNativeParent,
}
if (aInitData->mIsPrivate) {
if (NimbusFeatures::GetBool("majorRelease2022"_ns,
"feltPrivacyWindowSeparation"_ns, true) &&
// Although permanent Private Browsing mode is indeed Private Browsing,
// we choose to make it look like regular Firefox in terms of the icon
// it uses (which also means we shouldn't use the Private Browsing
// AUMID).
if (!StaticPrefs::browser_privatebrowsing_autostart()) {
!StaticPrefs::browser_privatebrowsing_autostart()) {
RefPtr<IPropertyStore> pPropStore;
if (!FAILED(SHGetPropertyStoreForWindow(mWnd, IID_IPropertyStore,
getter_AddRefs(pPropStore)))) {