Backed out 2 changesets (bug 1922594) for causing bc failures on browser_sync.js CLOSED TREE

Backed out changeset 32bbfcc1607a (bug 1922594)
Backed out changeset 9372edf868fe (bug 1922594)
This commit is contained in:
Norisz Fay
2024-10-19 03:25:51 +03:00
parent 68cdaf0538
commit 295237067d
17 changed files with 5 additions and 537 deletions

View File

@@ -495,7 +495,6 @@ var gSync = {
"browser/appmenu.ftl",
"browser/sync.ftl",
"browser/syncedTabs.ftl",
"browser/newtab/asrouter.ftl",
],
true
));
@@ -586,7 +585,6 @@ var gSync = {
}
MozXULElement.insertFTLIfNeeded("browser/sync.ftl");
MozXULElement.insertFTLIfNeeded("browser/newtab/asrouter.ftl");
// Label for the sync buttons.
const appMenuLabel = PanelMultiView.getViewNode(
@@ -659,8 +657,6 @@ var gSync = {
"PanelUI-fxa-menu-sendtab-connect-device-button"
).addEventListener("command", this);
PanelUI.mainView.addEventListener("ViewShowing", this);
// If the experiment is enabled, we'll need to update the panels
// to show some different text to the user
if (this.FXA_CTA_MENU_ENABLED) {
@@ -693,11 +689,7 @@ var gSync = {
break;
}
case "ViewShowing": {
if (event.target == PanelUI.mainView) {
this.onAppMenuShowing();
} else {
this.onFxAPanelViewShowing(event.target);
}
break;
}
case "ViewHiding": {
@@ -706,25 +698,6 @@ var gSync = {
}
},
onAppMenuShowing() {
const appMenuHeaderText = PanelMultiView.getViewNode(
document,
"appMenu-fxa-text"
);
const ctaDefaultStringID = "appmenu-fxa-sync-and-save-data2";
const ctaStringID = this.getMenuCtaCopy(NimbusFeatures.fxaAppMenuItem);
document.l10n.setAttributes(
appMenuHeaderText,
ctaStringID || ctaDefaultStringID
);
if (NimbusFeatures.fxaAppMenuItem.getVariable("ctaCopyVariant")) {
NimbusFeatures.fxaAppMenuItem.recordExposureEvent();
}
},
onFxAPanelViewShowing(panelview) {
let messageId = panelview.getAttribute(
MenuMessage.SHOWING_FXA_MENU_MESSAGE_ATTR
@@ -769,14 +742,6 @@ var gSync = {
PanelMultiView.getViewNode(document, "PanelUI-fxa-remotetabs-tabslist"),
PanelMultiView.getViewNode(document, "PanelUI-remote-tabs-separator")
);
// Any variant on the CTA will have been applied inside of updateFxAPanel,
// but now that the panel is showing, we record exposure.
const ctaCopyVariant =
NimbusFeatures.fxaAvatarMenuItem.getVariable("ctaCopyVariant");
if (ctaCopyVariant) {
NimbusFeatures.fxaAvatarMenuItem.recordExposureEvent();
}
},
onFxAPanelViewHiding(panelview) {
@@ -1155,14 +1120,6 @@ var gSync = {
? "fxa-menu-sync-description"
: "appmenu-fxa-signed-in-label";
headerDescription = this.fluentStrings.formatValueSync(headerDescString);
if (this.FXA_CTA_MENU_ENABLED) {
const ctaCopy = this.getMenuCtaCopy(NimbusFeatures.fxaAvatarMenuItem);
if (ctaCopy) {
headerTitleL10nId = ctaCopy.headerTitleL10nId;
headerDescription = ctaCopy.headerDescription;
}
}
} else if (state.status === UIState.STATUS_LOGIN_FAILED) {
stateValue = "login-failed";
headerTitleL10nId = "account-disconnected2";
@@ -2393,91 +2350,6 @@ var gSync = {
PanelUI.hide();
},
/**
* Returns any experimental copy that we want to try for FxA sign-in CTAs in
* the event that the user is enrolled in an experiment.
*
* The only ctaCopyVariant's that are expected are:
*
* - control
* - sync-devices
* - backup-data
* - backup-sync
* - mobile
*
* If "control" is set, `null` is returned to indicate default strings,
* but impressions will still be recorded.
*
* @param {NimbusFeature} feature
* One of either NimbusFeatures.fxaAppMenuItem or
* NimbusFeatures.fxaAvatarMenuItem.
* @returns {object|string|null}
* If feature is NimbusFeatures.fxaAppMenuItem, this will return the Fluent
* string ID for the App Menu CTA to appear for users to sign in.
*
* If feature is NimbusFeatures.fxaAvatarMenuItem, this will return an
* object with two properties:
*
* headerTitleL10nId (string):
* The Fluent ID for the header string for the avatar menu CTA.
* headerDescription (string):
* The raw string for the description for the avatar menu CTA.
*
* If there is no copy variant being tested, this will return null.
*/
getMenuCtaCopy(feature) {
const ctaCopyVariant = feature.getVariable("ctaCopyVariant");
let headerTitleL10nId;
let headerDescription;
switch (ctaCopyVariant) {
case "sync-devices": {
if (feature === NimbusFeatures.fxaAppMenuItem) {
return "fxa-menu-message-sync-devices-collapsed-text";
}
headerTitleL10nId = "fxa-menu-message-sync-devices-primary-text";
headerDescription = this.fluentStrings.formatValueSync(
"fxa-menu-message-sync-devices-secondary-text"
);
break;
}
case "backup-data": {
if (feature === NimbusFeatures.fxaAppMenuItem) {
return "fxa-menu-message-backup-data-collapsed-text";
}
headerTitleL10nId = "fxa-menu-message-backup-data-primary-text";
headerDescription = this.fluentStrings.formatValueSync(
"fxa-menu-message-backup-data-secondary-text"
);
break;
}
case "backup-sync": {
if (feature === NimbusFeatures.fxaAppMenuItem) {
return "fxa-menu-message-backup-sync-collapsed-text";
}
headerTitleL10nId = "fxa-menu-message-backup-sync-primary-text";
headerDescription = this.fluentStrings.formatValueSync(
"fxa-menu-message-backup-sync-secondary-text"
);
break;
}
case "mobile": {
if (feature === NimbusFeatures.fxaAppMenuItem) {
return "fxa-menu-message-mobile-collapsed-text";
}
headerTitleL10nId = "fxa-menu-message-mobile-primary-text";
headerDescription = this.fluentStrings.formatValueSync(
"fxa-menu-message-mobile-secondary-text"
);
break;
}
default: {
return null;
}
}
return { headerTitleL10nId, headerDescription };
},
openLink(url) {
switchToTabHavingURI(url, true, { replaceQueryString: true });
},

View File

@@ -43,10 +43,6 @@ var gExceptionPaths = [
"chrome://browser/content/assets/vpn-logo.svg",
"chrome://browser/content/assets/focus-promo.png",
"chrome://browser/content/assets/klar-qr-code.svg",
"chrome://browser/content/asrouter/assets/fox-with-box-on-cloud.svg",
"chrome://browser/content/asrouter/assets/fox-with-devices.svg",
"chrome://browser/content/asrouter/assets/fox-with-locked-box.svg",
"chrome://browser/content/asrouter/assets/fox-with-mobile.svg",
// toolkit/components/pdfjs/content/build/pdf.js
"resource://pdf.js/web/images/",

View File

@@ -1,10 +1,6 @@
[DEFAULT]
support-files = ["head.js"]
["browser_appmenu_signin_cta_variants.js"]
["browser_avatar_menu_signin_cta_variants.js"]
["browser_contextmenu_sendpage.js"]
["browser_contextmenu_sendtab.js"]

View File

@@ -1,142 +0,0 @@
/* Any copyright is dedicated to the Public Domain.
https://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
const { ExperimentFakes } = ChromeUtils.importESModule(
"resource://testing-common/NimbusTestUtils.sys.mjs"
);
/**
* Tests that we can change the CTA for the FxA sign-in button in the AppMenu
* using Nimbus.
*/
/**
* Closes and re-opens the AppMenu for the current browser window, and returns a
* Promise once the main view fires the "ViewShown" event. The Promise resolves
* to the element in the AppMenu that holds the FxA sign-in CTA.
*
* If the panel is not already open, this just opens it.
*
* @returns {Promise<Element>}
*/
async function reopenAppMenu() {
PanelUI.hide();
let promiseViewShown = BrowserTestUtils.waitForEvent(
PanelUI.panel,
"ViewShown"
);
PanelUI.show();
await promiseViewShown;
return PanelMultiView.getViewNode(document, "appMenu-fxa-text");
}
/**
* Tests that we use the default CTA when not enrolled in an experiment.
*/
add_task(async function test_default() {
let sandbox = sinon.createSandbox();
sandbox.spy(NimbusFeatures.fxaAppMenuItem, "recordExposureEvent");
Assert.equal(
NimbusFeatures.fxaAppMenuItem.getVariable("ctaCopyVariant"),
undefined,
"Should not start with a NimbusFeature set for the CTA copy."
);
let ctaEl = await reopenAppMenu();
Assert.equal(
ctaEl.dataset.l10nId,
"appmenu-fxa-sync-and-save-data2",
"Should have the default CTA text."
);
Assert.ok(
NimbusFeatures.fxaAppMenuItem.recordExposureEvent.notCalled,
"Did not record any exposure."
);
sandbox.restore();
});
/**
* Tests that the control variant uses the default CTA, but also records an
* impression.
*/
add_task(async function test_control() {
let doCleanup = await ExperimentFakes.enrollWithFeatureConfig(
{
featureId: NimbusFeatures.fxaAppMenuItem.featureId,
value: {
ctaCopyVariant: "control",
},
},
{ isRollout: true }
);
let sandbox = sinon.createSandbox();
sandbox.spy(NimbusFeatures.fxaAppMenuItem, "recordExposureEvent");
let ctaEl = await reopenAppMenu();
Assert.equal(
ctaEl.dataset.l10nId,
"appmenu-fxa-sync-and-save-data2",
"Should have the default CTA text."
);
Assert.ok(
NimbusFeatures.fxaAppMenuItem.recordExposureEvent.calledOnce,
"Recorded exposure."
);
await doCleanup();
sandbox.restore();
});
/**
* Tests all variants , and that when we stop experimenting with that variant,
* we revert back to the default CTA.
*/
add_task(async function test_variants() {
let variants = ["sync-devices", "backup-data", "backup-sync", "mobile"];
for (let variant of variants) {
let sandbox = sinon.createSandbox();
sandbox.spy(NimbusFeatures.fxaAppMenuItem, "recordExposureEvent");
let expectedL10nID = `fxa-menu-message-${variant}-collapsed-text`;
// Ensure that a string actually exists for that ID.
try {
Assert.ok(
await document.l10n.formatValue(expectedL10nID),
`Found a string for ${expectedL10nID}`
);
} catch (e) {
Assert.ok(false, `Missing string for ID: ${expectedL10nID}`);
}
let doCleanup = await ExperimentFakes.enrollWithFeatureConfig(
{
featureId: NimbusFeatures.fxaAppMenuItem.featureId,
value: {
ctaCopyVariant: variant,
},
},
{ isRollout: true }
);
let ctaEl = await reopenAppMenu();
Assert.equal(
ctaEl.dataset.l10nId,
expectedL10nID,
"Got the expected string for the variant."
);
await doCleanup();
ctaEl = await reopenAppMenu();
Assert.equal(
ctaEl.dataset.l10nId,
"appmenu-fxa-sync-and-save-data2",
"Should have the default CTA text."
);
Assert.ok(
NimbusFeatures.fxaAppMenuItem.recordExposureEvent.calledOnce,
"Recorded exposure."
);
sandbox.restore();
}
});

View File

@@ -1,171 +0,0 @@
/* Any copyright is dedicated to the Public Domain.
https://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
const { ExperimentFakes } = ChromeUtils.importESModule(
"resource://testing-common/NimbusTestUtils.sys.mjs"
);
/**
* Tests that we can change the CTA for the FxA sign-in button in the avatar
* menu using Nimbus.
*/
const DEFAULT_HEADER = gSync.fluentStrings.formatValueSync(
"synced-tabs-fxa-sign-in"
);
const DEFAULT_DESCRIPTION = gSync.fluentStrings.formatValueSync(
"fxa-menu-sync-description"
);
add_setup(async () => {
gSync.init();
});
/**
* Closes and re-opens the avatar menu for the current browser window, and
* returns a Promise once the main view fires the "ViewShown" event. The Promise
* resolves to the object with properties pointing at the header and the
* description text of the sign-in button.
*
* If the panel is not already open, this just opens it.
*
* @returns {Promise<object>}
*/
async function reopenAvatarMenu() {
let widgetPanel = document.getElementById("customizationui-widget-panel");
// The customizationui-widget-panel is created lazily, and destroyed upon
// closing, meaning that if we didn't find it, it's not open.
if (widgetPanel) {
let panelHidden = BrowserTestUtils.waitForEvent(widgetPanel, "popuphidden");
widgetPanel.hidePopup();
await panelHidden;
}
let promiseViewShown = BrowserTestUtils.waitForEvent(
PanelMultiView.getViewNode(document, "PanelUI-fxa"),
"ViewShown"
);
await gSync.toggleAccountPanel(
document.getElementById("fxa-toolbar-menu-button"),
new MouseEvent("mousedown")
);
await promiseViewShown;
let headerEl = PanelMultiView.getViewNode(document, "fxa-menu-header-title");
let descriptionEl = PanelMultiView.getViewNode(
document,
"fxa-menu-header-description"
);
return {
header: headerEl.value,
description: descriptionEl.value,
};
}
/**
* Tests that we use the default CTA when not enrolled in an experiment.
*/
add_task(async function test_default() {
Assert.equal(
NimbusFeatures.fxaAvatarMenuItem.getVariable("ctaCopyVariant"),
undefined,
"Should not start with a NimbusFeature set for the CTA copy."
);
let sandbox = sinon.createSandbox();
sandbox.spy(NimbusFeatures.fxaAvatarMenuItem, "recordExposureEvent");
let { header, description } = await reopenAvatarMenu();
Assert.equal(header, DEFAULT_HEADER, "Should have the default header.");
Assert.equal(
description,
DEFAULT_DESCRIPTION,
"Should have the default description."
);
Assert.ok(
NimbusFeatures.fxaAvatarMenuItem.recordExposureEvent.notCalled,
"Did not record any exposure."
);
sandbox.restore();
});
/**
* Tests that the control variant uses the default CTA, but also records an
* impression.
*/
add_task(async function test_control() {
let doCleanup = await ExperimentFakes.enrollWithFeatureConfig(
{
featureId: NimbusFeatures.fxaAvatarMenuItem.featureId,
value: {
ctaCopyVariant: "control",
},
},
{ isRollout: true }
);
let sandbox = sinon.createSandbox();
sandbox.spy(NimbusFeatures.fxaAvatarMenuItem, "recordExposureEvent");
let { header, description } = await reopenAvatarMenu();
Assert.equal(header, DEFAULT_HEADER, "Should have the default header.");
Assert.equal(
description,
DEFAULT_DESCRIPTION,
"Should have the default description."
);
Assert.ok(
NimbusFeatures.fxaAvatarMenuItem.recordExposureEvent.calledOnce,
"Recorded exposure."
);
await doCleanup();
sandbox.restore();
});
/**
* Tests all variants , and that when we stop experimenting with that variant,
* we revert back to the default CTA.
*/
add_task(async function test_variants() {
let variants = ["sync-devices", "backup-data", "backup-sync", "mobile"];
for (let variant of variants) {
let sandbox = sinon.createSandbox();
sandbox.spy(NimbusFeatures.fxaAvatarMenuItem, "recordExposureEvent");
let expectedHeader = gSync.fluentStrings.formatValueSync(
`fxa-menu-message-${variant}-primary-text`
);
let expectedDescription = gSync.fluentStrings.formatValueSync(
`fxa-menu-message-${variant}-secondary-text`
);
let doCleanup = await ExperimentFakes.enrollWithFeatureConfig(
{
featureId: NimbusFeatures.fxaAvatarMenuItem.featureId,
value: {
ctaCopyVariant: variant,
},
},
{ isRollout: true }
);
let { header, description } = await reopenAvatarMenu();
Assert.equal(header, expectedHeader, "Should have the expected header.");
Assert.equal(
description,
expectedDescription,
"Should have the expected description."
);
await doCleanup();
({ header, description } = await reopenAvatarMenu());
Assert.equal(header, DEFAULT_HEADER, "Should have the default header.");
Assert.equal(
description,
DEFAULT_DESCRIPTION,
"Should have the default description."
);
Assert.ok(
NimbusFeatures.fxaAvatarMenuItem.recordExposureEvent.calledOnce,
"Recorded exposure."
);
sandbox.restore();
}
});

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 53 KiB

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 32 KiB

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 40 KiB

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 17 KiB

View File

@@ -36,7 +36,6 @@
display: flex;
justify-content: center;
margin-block-start: var(--illustration-margin-block-offset);
margin-block-end: var(--space-xsmall);
pointer-events: none;
}

View File

@@ -96,8 +96,6 @@ export default class FxAMenuMessage extends MozLitElement {
type="primary"
tabindex="1"
autofocus
title="${this.buttonText}"
aria-label="${this.buttonText}"
>${this.buttonText}</moz-button
>
</div>

View File

@@ -36,9 +36,9 @@ export const Default = Template.bind({});
Default.args = {
buttonText: "Sign up",
imageURL:
"chrome://browser/content/asrouter/assets/fox-with-box-on-cloud.svg",
"chrome://activity-stream/content/data/content/assets/fox-doodle-waving-static.png",
primaryText: "Bounce between devices",
secondaryText:
"Sync and encrypt your bookmarks, passwords, and more on all your devices.",
imageVerticalOffset: -20,
imageVerticalOffset: -24,
};

View File

@@ -12,7 +12,3 @@ browser.jar:
content/browser/asrouter/render.js (content/render.js)
content/browser/asrouter/schemas/BackgroundTaskMessagingExperiment.schema.json (content-src/schemas/BackgroundTaskMessagingExperiment.schema.json)
content/browser/asrouter/schemas/MessagingExperiment.schema.json (content-src/schemas/MessagingExperiment.schema.json)
content/browser/asrouter/assets/fox-with-box-on-cloud.svg (content/assets/fox-with-box-on-cloud.svg)
content/browser/asrouter/assets/fox-with-devices.svg (content/assets/fox-with-devices.svg)
content/browser/asrouter/assets/fox-with-locked-box.svg (content/assets/fox-with-locked-box.svg)
content/browser/asrouter/assets/fox-with-mobile.svg (content/assets/fox-with-mobile.svg)

View File

@@ -888,8 +888,8 @@ const MESSAGES = () => [
},
},
imageURL:
"chrome://browser/content/asrouter/assets/fox-with-box-on-cloud.svg",
imageVerticalOffset: -20,
"chrome://activity-stream/content/data/content/assets/fox-doodle-waving-static.png",
imageVerticalOffset: -24,
},
skip_in_tests: "TODO",
trigger: {

View File

@@ -275,21 +275,3 @@ root-certificate-succession-infobar-secondary-button =
fxa-menu-message-close-button =
.title = Close
.aria-label = Close
fxa-menu-message-sign-up-button = Sign up
fxa-menu-message-sync-devices-primary-text = Sync all your devices
fxa-menu-message-sync-devices-secondary-text = Instantly get your info — like bookmarks and passwords — everywhere you use { -brand-short-name }.
fxa-menu-message-sync-devices-collapsed-text = Sync all your devices
fxa-menu-message-backup-data-primary-text = Back up your browser data
fxa-menu-message-backup-data-secondary-text = Automatically protect bookmarks, passwords, and other info on all your devices.
fxa-menu-message-backup-data-collapsed-text = Back up browser data
fxa-menu-message-backup-sync-primary-text = Keep your data safe and synced
fxa-menu-message-backup-sync-secondary-text = Sync backs up most of your data so you can access it everywhere you use { -brand-short-name }.
fxa-menu-message-backup-sync-collapsed-text = Sync and back up data
fxa-menu-message-mobile-primary-text = Send tabs to your phone
fxa-menu-message-mobile-secondary-text = Pick up where you left off instantly when you sync your tabs with a mobile device.
fxa-menu-message-mobile-collapsed-text = Sync with your phone

View File

@@ -802,13 +802,11 @@ toolbarbutton[constrain-size="true"][cui-areatype="panel"] > .toolbarbutton-badg
#fxa-menu-header-title {
color: var(--arrowpanel-color);
text-wrap: wrap;
}
#fxa-menu-header-description {
color: var(--text-color-deemphasized);
font-weight: var(--font-weight-bold);
text-wrap: wrap;
}
#cta-menu-header-description {

View File

@@ -2676,46 +2676,6 @@ fxaClientAssociation:
branch: user
pref: identity.fxaccounts.telemetry.clientAssociationPing.enabled
fxaAppMenuItem:
description: >-
Prefs to control the appearance and copy of the FxA sign-in button in the
AppMenu when signed out.
owner: mconley@mozilla.com
hasExposure: true
exposureDescription: >-
Exposure is recorded when the user is enrolled in an experiment using this
feature and the AppMenu on Firefox Desktop is opened.
variables:
ctaCopyVariant:
description: >-
One of the following values:
- control
- sync-devices
- backup-data
- backup-sync
- mobile
type: string
fxaAvatarMenuItem:
description: >-
Prefs to control the appearance and copy of the FxA sign-in button in the
FxA avatar menu when signed out.
owner: mconley@mozilla.com
hasExposure: true
exposureDescription: >-
Exposure is recorded when the user is enrolled in an experiment using this
feature and the FxA avatar menu on Firefox Desktop is opened.
variables:
ctaCopyVariant:
description: >-
One of the following values:
- control
- sync-devices
- backup-data
- backup-sync
- mobile
type: string
legacyHeartbeat:
description: Normandy Heartbeat exposed to Nimbus
owner: beth@mozilla.com