diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-12 05:35:29 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-12 05:35:29 +0000 |
commit | 59203c63bb777a3bacec32fb8830fba33540e809 (patch) | |
tree | 58298e711c0ff0575818c30485b44a2f21bf28a0 /toolkit/modules/ProfileAge.sys.mjs | |
parent | Adding upstream version 126.0.1. (diff) | |
download | firefox-59203c63bb777a3bacec32fb8830fba33540e809.tar.xz firefox-59203c63bb777a3bacec32fb8830fba33540e809.zip |
Adding upstream version 127.0.upstream/127.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'toolkit/modules/ProfileAge.sys.mjs')
-rw-r--r-- | toolkit/modules/ProfileAge.sys.mjs | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/toolkit/modules/ProfileAge.sys.mjs b/toolkit/modules/ProfileAge.sys.mjs index ea824f5a91..94e991749f 100644 --- a/toolkit/modules/ProfileAge.sys.mjs +++ b/toolkit/modules/ProfileAge.sys.mjs @@ -161,6 +161,27 @@ class ProfileAgeImpl { } return Promise.resolve(undefined); } + + /** + * Record (and persist) when a backup recovery happened. We just store a + * single value - the timestamp at the time of recovery. + * + * Returns a promise that is resolved once the file has been written. + */ + recordRecoveredFromBackup(time = Date.now()) { + this._times.recoveredFromBackup = time; + return this.writeTimes(); + } + + /* Returns a promise that resolves to the time the profile was recovered from + * a backup or undefined if not recorded. + */ + get recoveredFromBackup() { + if ("recoveredFromBackup" in this._times) { + return Promise.resolve(this._times.recoveredFromBackup); + } + return Promise.resolve(undefined); + } } // A Map from profile directory to a promise that resolves to the ProfileAgeImpl. |