Bug 1890427 - Part 8: Use an observer to regenerate backups on permission removal. r=backup-reviewers,kpatenio

Differential Revision: https://phabricator.services.mozilla.com/D218878
This commit is contained in:
Mike Conley
2024-09-18 13:32:10 +00:00
parent 1e876ebf64
commit c38ff72c4c
2 changed files with 32 additions and 1 deletions

View File

@@ -3167,6 +3167,7 @@ export class BackupService extends EventTarget {
Services.obs.addObserver(this.#observer, "passwordmgr-storage-changed");
Services.obs.addObserver(this.#observer, "formautofill-storage-changed");
Services.obs.addObserver(this.#observer, "sanitizer-sanitization-complete");
Services.obs.addObserver(this.#observer, "perm-changed");
Services.obs.addObserver(this.#observer, "quit-application-granted");
}
@@ -3197,7 +3198,11 @@ export class BackupService extends EventTarget {
Services.obs.removeObserver(this.#observer, "passwordmgr-storage-changed");
Services.obs.removeObserver(this.#observer, "formautofill-storage-changed");
Services.obs.removeObserver(this.#observer, "sanitizer-sanitization-complete");
Services.obs.removeObserver(
this.#observer,
"sanitizer-sanitization-complete"
);
Services.obs.removeObserver(this.#observer, "perm-changed");
Services.obs.removeObserver(this.#observer, "quit-application-granted");
this.#observer = null;
@@ -3248,6 +3253,12 @@ export class BackupService extends EventTarget {
this.#debounceRegeneration();
break;
}
case "perm-changed": {
if (data == "deleted") {
this.#debounceRegeneration();
}
break;
}
}
}