Bug 1897278 - Make the backups profile folder a constant accessible off of the BackupService class. r=backup-reviewers,kpatenio
Differential Revision: https://phabricator.services.mozilla.com/D211437
This commit is contained in:
@@ -132,6 +132,16 @@ export class BackupService extends EventTarget {
|
||||
*/
|
||||
#postRecoveryResolver;
|
||||
|
||||
/**
|
||||
* The name of the folder within the profile folder where this service reads
|
||||
* and writes state to.
|
||||
*
|
||||
* @type {string}
|
||||
*/
|
||||
static get PROFILE_FOLDER_NAME() {
|
||||
return "backups";
|
||||
}
|
||||
|
||||
/**
|
||||
* The name of the backup manifest file.
|
||||
*
|
||||
@@ -326,7 +336,10 @@ export class BackupService extends EventTarget {
|
||||
|
||||
// First, check to see if a `backups` directory already exists in the
|
||||
// profile.
|
||||
let backupDirPath = PathUtils.join(profilePath, "backups");
|
||||
let backupDirPath = PathUtils.join(
|
||||
profilePath,
|
||||
BackupService.PROFILE_FOLDER_NAME
|
||||
);
|
||||
lazy.logConsole.debug("Creating backups folder");
|
||||
|
||||
// ignoreExisting: true is the default, but we're being explicit that it's
|
||||
|
||||
@@ -54,7 +54,10 @@ let DebugUI = {
|
||||
break;
|
||||
}
|
||||
case "open-backup-folder": {
|
||||
let backupsDir = PathUtils.join(PathUtils.profileDir, "backups");
|
||||
let backupsDir = PathUtils.join(
|
||||
PathUtils.profileDir,
|
||||
BackupService.PROFILE_FOLDER_NAME
|
||||
);
|
||||
|
||||
let nsLocalFile = Components.Constructor(
|
||||
"@mozilla.org/file/local;1",
|
||||
@@ -71,7 +74,10 @@ let DebugUI = {
|
||||
break;
|
||||
}
|
||||
case "recover-from-staging": {
|
||||
let backupsDir = PathUtils.join(PathUtils.profileDir, "backups");
|
||||
let backupsDir = PathUtils.join(
|
||||
PathUtils.profileDir,
|
||||
BackupService.PROFILE_FOLDER_NAME
|
||||
);
|
||||
let fp = Cc["@mozilla.org/filepicker;1"].createInstance(
|
||||
Ci.nsIFilePicker
|
||||
);
|
||||
|
||||
@@ -111,7 +111,10 @@ async function testCreateBackupHelper(sandbox, taskFn) {
|
||||
|
||||
// We expect the staging folder to exist then be renamed under the fakeProfilePath.
|
||||
// We should also find a folder for each fake BackupResource.
|
||||
let backupsFolderPath = PathUtils.join(fakeProfilePath, "backups");
|
||||
let backupsFolderPath = PathUtils.join(
|
||||
fakeProfilePath,
|
||||
BackupService.PROFILE_FOLDER_NAME
|
||||
);
|
||||
let stagingPath = PathUtils.join(backupsFolderPath, "staging");
|
||||
|
||||
// For now, we expect a single backup only to be saved. There should also be
|
||||
|
||||
Reference in New Issue
Block a user