Bug 1902020 - Fix a math error in calculating binary blob content length when it divides evenly by chunk size. r=backup-reviewers,fchasen

Differential Revision: https://phabricator.services.mozilla.com/D213481
This commit is contained in:
Mike Conley
2024-06-21 14:07:28 +00:00
parent 86e875c137
commit 02de0e2758
3 changed files with 91 additions and 19 deletions

View File

@@ -1023,19 +1023,27 @@ export class BackupService extends EventTarget {
* @param {object} backupMetadata
* The metadata for the backup, which is also stored in the backup manifest
* of the compressed backup snapshot.
* @param {object} options
* Options to pass to the worker, mainly for testing.
* @param {object} [options.chunkSize=ArchiveUtils.ARCHIVE_CHUNK_MAX_BYTES_SIZE]
* The chunk size to break the bytes into.
*/
async createArchive(
archivePath,
templateURI,
compressedBackupSnapshotPath,
encState,
backupMetadata
backupMetadata,
options = {}
) {
let worker = new lazy.BasePromiseWorker(
"resource:///modules/backup/Archive.worker.mjs",
{ type: "module" }
);
let chunkSize =
options.chunkSize || lazy.ArchiveUtils.ARCHIVE_CHUNK_MAX_BYTES_SIZE;
try {
let encryptionArgs = encState
? {
@@ -1054,6 +1062,7 @@ export class BackupService extends EventTarget {
backupMetadata,
compressedBackupSnapshotPath,
encryptionArgs,
chunkSize,
},
]);
} finally {