commit 1a8d9b30805b22941f773d040227828efd32dd99
parent df79ba296568c3aa7b4989f7ef26a049f5452cfb
Author: Max Christian Pohle <mpohle@mozilla.com>
Date: Fri, 7 Nov 2025 18:05:34 +0000
Bug 1998693 - about:welcome backup restore option - Could not get children of 'null' r=cdupuis
Differential Revision: https://phabricator.services.mozilla.com/D271814
Diffstat:
1 file changed, 13 insertions(+), 3 deletions(-)
diff --git a/browser/components/backup/BackupService.sys.mjs b/browser/components/backup/BackupService.sys.mjs
@@ -4316,9 +4316,19 @@ export class BackupService extends EventTarget {
}
try {
- let files = await IOUtils.getChildren(this.#_state.backupDirPath, {
- ignoreAbsent: true,
- });
+ // During the first startup, the browser's backup location is often left
+ // unconfigured; therefore, it defaults to predefined locations to look
+ // for existing backup files.
+ let defaultPath = PathUtils.join(
+ BackupService.DEFAULT_PARENT_DIR_PATH,
+ BackupService.BACKUP_DIR_NAME
+ );
+ let files = await IOUtils.getChildren(
+ this.#_state.backupDirPath ? this.#_state.backupDirPath : defaultPath,
+ {
+ ignoreAbsent: true,
+ }
+ );
// filtering is an O(N) operation, we can return early if there's too many files
// in this folder to filter to avoid a performance bottleneck
if (speedUpHeuristic && files && files.length > 1000) {