Files
tubestation/browser/components/backup/resources/CookiesBackupResource.sys.mjs
Sandor Molnar f5cc48988c Backed out 5 changesets (bug 1901534, bug 1891854, bug 1901520) for causing xpc failures @ test_BackupService_renderTemplate.js CLOSED TREE
Backed out changeset 5e494cb0aff6 (bug 1901534)
Backed out changeset e8773eda97c1 (bug 1891854)
Backed out changeset 4b079909d830 (bug 1901520)
Backed out changeset 5509d1905d2c (bug 1901520)
Backed out changeset 6d98566735ad (bug 1901520)
2024-06-25 01:24:56 +03:00

40 lines
1.1 KiB
JavaScript

/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
import { BackupResource } from "resource:///modules/backup/BackupResource.sys.mjs";
/**
* Class representing Cookies database within a user profile.
*/
export class CookiesBackupResource extends BackupResource {
static get key() {
return "cookies";
}
static get requiresEncryption() {
return true;
}
async backup(stagingPath, profilePath = PathUtils.profileDir) {
await BackupResource.copySqliteDatabases(profilePath, stagingPath, [
"cookies.sqlite",
]);
return null;
}
async recover(_manifestEntry, recoveryPath, destProfilePath) {
await BackupResource.copyFiles(recoveryPath, destProfilePath, [
"cookies.sqlite",
]);
return null;
}
async measure(profilePath = PathUtils.profileDir) {
let cookiesDBPath = PathUtils.join(profilePath, "cookies.sqlite");
let cookiesSize = await BackupResource.getFileSize(cookiesDBPath);
Glean.browserBackup.cookiesSize.set(cookiesSize);
}
}