commit a69b0adb399ce162b471b284e3010758f3d146b6
parent 686ce3b4a3d0cdcdda26395df2cfb41628f9e493
Author: Harsheet <hsohaney@mozilla.com>
Date: Sun, 16 Nov 2025 21:14:13 +0000
Bug 1999836 - Trigger handleAction to move to the new password spotlight screen when backing up all data. r=omc-reviewers,sthompson,emcminn,cdupuis
Differential Revision: https://phabricator.services.mozilla.com/D272488
Diffstat:
4 files changed, 58 insertions(+), 8 deletions(-)
diff --git a/browser/components/aboutwelcome/content-src/components/EmbeddedFxBackupOptIn.jsx b/browser/components/aboutwelcome/content-src/components/EmbeddedFxBackupOptIn.jsx
@@ -23,14 +23,22 @@ export const EmbeddedFxBackupOptIn = ({
useEffect(() => {
const { current } = backupRef;
-
- const handleBackupEvent = () => {
+ const handleEnableScheduledBackups = () => {
handleAction({
currentTarget: { value: "tile_button" },
action: { navigate: true },
source: "backup_enabled",
});
};
+
+ const handleAdvanceScreens = () => {
+ handleAction({
+ currentTarget: { value: "tile_button" },
+ action: { navigate: true },
+ source: "advance_screens",
+ });
+ };
+
const handleStateUpdate = ({ detail: { state } }) => {
if (!current || !state) {
return;
@@ -45,17 +53,26 @@ export const EmbeddedFxBackupOptIn = ({
current?.addEventListener("BackupUI:StateWasUpdated", handleStateUpdate);
current?.addEventListener(
"BackupUI:EnableScheduledBackups",
- handleBackupEvent
+ handleEnableScheduledBackups
+ );
+ current?.addEventListener(
+ "SpotlightOnboardingAdvanceScreens",
+ handleAdvanceScreens
);
+
return () => {
current?.removeEventListener(
"BackupUI:EnableScheduledBackups",
- handleBackupEvent
+ handleEnableScheduledBackups
);
current?.removeEventListener(
"BackupUI:StateWasUpdated",
handleStateUpdate
);
+ current?.removeEventListener(
+ "SpotlightOnboardingAdvanceScreens",
+ handleAdvanceScreens
+ );
};
}, []); // eslint-disable-line react-hooks/exhaustive-deps
@@ -73,6 +90,7 @@ export const EmbeddedFxBackupOptIn = ({
isEncryptedBackup && !hide_password_input ? "" : undefined
}
embedded-fx-backup-opt-in={""}
+ backup-is-encrypted={isEncryptedBackup ? "" : undefined}
file-path-label-l10n-id={file_path_label}
turn-on-backup-header-l10n-id={turn_on_backup_header}
create-password-label-l10n-id={create_password_label}
diff --git a/browser/components/aboutwelcome/content/aboutwelcome.bundle.js b/browser/components/aboutwelcome/content/aboutwelcome.bundle.js
@@ -3431,7 +3431,7 @@ const EmbeddedFxBackupOptIn = ({
const {
current
} = backupRef;
- const handleBackupEvent = () => {
+ const handleEnableScheduledBackups = () => {
handleAction({
currentTarget: {
value: "tile_button"
@@ -3442,6 +3442,17 @@ const EmbeddedFxBackupOptIn = ({
source: "backup_enabled"
});
};
+ const handleAdvanceScreens = () => {
+ handleAction({
+ currentTarget: {
+ value: "tile_button"
+ },
+ action: {
+ navigate: true
+ },
+ source: "advance_screens"
+ });
+ };
const handleStateUpdate = ({
detail: {
state
@@ -3461,10 +3472,12 @@ const EmbeddedFxBackupOptIn = ({
current.supportBaseLink = state.supportBaseLink;
};
current?.addEventListener("BackupUI:StateWasUpdated", handleStateUpdate);
- current?.addEventListener("BackupUI:EnableScheduledBackups", handleBackupEvent);
+ current?.addEventListener("BackupUI:EnableScheduledBackups", handleEnableScheduledBackups);
+ current?.addEventListener("SpotlightOnboardingAdvanceScreens", handleAdvanceScreens);
return () => {
- current?.removeEventListener("BackupUI:EnableScheduledBackups", handleBackupEvent);
+ current?.removeEventListener("BackupUI:EnableScheduledBackups", handleEnableScheduledBackups);
current?.removeEventListener("BackupUI:StateWasUpdated", handleStateUpdate);
+ current?.removeEventListener("SpotlightOnboardingAdvanceScreens", handleAdvanceScreens);
};
}, []); // eslint-disable-line react-hooks/exhaustive-deps
@@ -3475,6 +3488,7 @@ const EmbeddedFxBackupOptIn = ({
"hide-secondary-button": !isEncryptedBackup || hide_secondary_button ? "" : undefined,
"hide-file-path-chooser": isEncryptedBackup && !hide_password_input ? "" : undefined,
"embedded-fx-backup-opt-in": "",
+ "backup-is-encrypted": isEncryptedBackup ? "" : undefined,
"file-path-label-l10n-id": file_path_label,
"turn-on-backup-header-l10n-id": turn_on_backup_header,
"create-password-label-l10n-id": create_password_label,
diff --git a/browser/components/aboutwelcome/karma.mc.config.js b/browser/components/aboutwelcome/karma.mc.config.js
@@ -132,7 +132,7 @@ module.exports = function (config) {
"content-src/components/EmbeddedFxBackupOptIn.jsx": {
statements: 60,
lines: 60,
- functions: 60,
+ functions: 50,
branches: 60,
},
"content-src/components/MSLocalized.jsx": {
diff --git a/browser/components/backup/content/turn-on-scheduled-backups.mjs b/browser/components/backup/content/turn-on-scheduled-backups.mjs
@@ -57,6 +57,11 @@ export default class TurnOnScheduledBackups extends MozLitElement {
reflect: true,
attribute: "hide-secondary-button",
},
+ backupIsEncrypted: {
+ type: Boolean,
+ reflect: true,
+ attribute: "backup-is-encrypted",
+ },
filePathLabelL10nId: {
type: String,
reflect: true,
@@ -194,6 +199,19 @@ export default class TurnOnScheduledBackups extends MozLitElement {
detail.password = this._inputPassValue;
}
+ if (
+ this.embeddedFxBackupOptIn &&
+ this.backupIsEncrypted &&
+ !detail.password
+ ) {
+ // We're in the embedded component and we haven't set a password yet when
+ // one is expected, let's not do a confirm action yet!
+ this.dispatchEvent(
+ new CustomEvent("SpotlightOnboardingAdvanceScreens", { bubbles: true })
+ );
+ return;
+ }
+
this.dispatchEvent(
new CustomEvent("BackupUI:EnableScheduledBackups", {
bubbles: true,