tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

commit d61b3c3c26632044174cbfa158215f1cd4cadaa0
parent 5b0a1c63df41ecf33ba74e35bc91e4ed69370509
Author: Duncan McIntosh <dmcintosh@mozilla.com>
Date:   Wed, 12 Nov 2025 15:10:38 +0000

Bug 1999385 - Trigger a backup when the password changes. r=hsohaney,cdupuis

Differential Revision: https://phabricator.services.mozilla.com/D272087

Diffstat:
Mbrowser/components/backup/actors/BackupUIParent.sys.mjs | 7++-----
Mbrowser/components/backup/tests/browser/browser_settings_enable_backup_encryption.js | 7+++++++
2 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/browser/components/backup/actors/BackupUIParent.sys.mjs b/browser/components/backup/actors/BackupUIParent.sys.mjs @@ -236,11 +236,8 @@ export class BackupUIParent extends JSWindowActorParent { lazy.logConsole.error(`Failed to rerun encryption`, e); return { success: false, errorCode: e.cause || lazy.ERRORS.UNKNOWN }; } - /** - * TODO: (Bug 1901640) after enabling encryption, recreate the backup, - * this time with the new password. - */ - return { success: true }; + + return await this.#triggerCreateBackup({ reason: "encryption" }); } else if (message.name == "ShowBackupLocation") { this.#bs.showBackupLocation(); } else if (message.name == "EditBackupLocation") { diff --git a/browser/components/backup/tests/browser/browser_settings_enable_backup_encryption.js b/browser/components/backup/tests/browser/browser_settings_enable_backup_encryption.js @@ -158,6 +158,9 @@ add_task( let disableEncryptionStub = sandbox .stub(BackupService.prototype, "disableEncryption") .resolves(true); + let createBackupStub = sandbox + .stub(BackupService.prototype, "createBackup") + .resolves(true); await SpecialPowers.pushPrefEnv({ set: [[SCHEDULED_BACKUPS_ENABLED_PREF, true]], @@ -240,6 +243,10 @@ add_task( enableEncryptionStub.calledOnceWith(MOCK_PASSWORD), "BackupService was called to re-run encryption with changed password" ); + Assert.ok( + createBackupStub.calledOnceWith({ reason: "encryption" }), + "A new backup was started for the right reason" + ); let legacyEvents = TelemetryTestUtils.getEvents( {