tor-browser

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

commit cb5c5285e4692b3d9b15a0e90cab232d684338ba
parent 6c6669e1f2676765138bcff2b2b58aa0d6c68a19
Author: Duncan McIntosh <dmcintosh@mozilla.com>
Date:   Fri, 12 Dec 2025 19:35:12 +0000

Bug 2004791 - Stub out the "state" getter on the backup service singleton, not its prototype. r=fchasen

I'm not sure why this helps, but it does---it seems that the UI otherwise
gets the 'real' backup state, even though it's stubbed out. (I'm wondering
if the BackupService prototype is different at some important point...?)

This change makes the restore-from-backup test fail if
backupFileCoarseLocation is not present, which is what I was confused
about in

  https://phabricator.services.mozilla.com/D274841#inline-1497362

It also resolves a failure in
test_turn_off_scheduled_backups_disables_encryption that would otherwise be
introduced in my patch for bug 1996249.

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

Diffstat:
Mbrowser/components/backup/tests/browser/browser_settings_restore_from_backup.js | 2+-
Mbrowser/components/backup/tests/browser/browser_settings_turn_off_scheduled_backups.js | 2+-
2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/browser/components/backup/tests/browser/browser_settings_restore_from_backup.js b/browser/components/backup/tests/browser/browser_settings_restore_from_backup.js @@ -158,7 +158,7 @@ add_task(async function test_restore_from_backup() { let recoverFromBackupArchiveStub = sandbox .stub(BackupService.prototype, "recoverFromBackupArchive") .resolves(); - sandbox.stub(BackupService.prototype, "state").get(() => mockBackupState); + sandbox.stub(BackupService.get(), "state").get(() => mockBackupState); MockFilePicker.showCallback = () => { Assert.ok(true, "Filepicker shown"); diff --git a/browser/components/backup/tests/browser/browser_settings_turn_off_scheduled_backups.js b/browser/components/backup/tests/browser/browser_settings_turn_off_scheduled_backups.js @@ -121,7 +121,7 @@ add_task(async function test_turn_off_scheduled_backups_disables_encryption() { * out the actual BackupService state, instead of the state passed to backup-settings * since we're not testing UI here. */ const testDefaultName = "test-default-path"; - sandbox.stub(BackupService.prototype, "state").get(() => { + sandbox.stub(BackupService.get(), "state").get(() => { return { encryptionEnabled: true, defaultParent: {