summaryrefslogtreecommitdiffstats
path: root/toolkit/modules/ProfileAge.sys.mjs
diff options
context:
space:
mode:
Diffstat (limited to 'toolkit/modules/ProfileAge.sys.mjs')
-rw-r--r--toolkit/modules/ProfileAge.sys.mjs21
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.