tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

commit 33584039d03c268fb426604ed112575232956e04
parent 4bea37064d144212e87dddfde7d32aec73f31541
Author: Alexandru Marc <amarc@mozilla.com>
Date:   Wed, 26 Nov 2025 19:27:17 +0200

Revert "Bug 2002527 - Use the actor object itself as nsIObserver in BackupUIParent. r=mconley" for being landed accidentally

This reverts commit d830a6495d70c0ccebef13bbdc5e79499a9feddd.

Diffstat:
Mbrowser/components/backup/actors/BackupUIParent.sys.mjs | 27++++++++++++++-------------
1 file changed, 14 insertions(+), 13 deletions(-)

diff --git a/browser/components/backup/actors/BackupUIParent.sys.mjs b/browser/components/backup/actors/BackupUIParent.sys.mjs @@ -51,7 +51,7 @@ export class BackupUIParent extends JSWindowActorParent { */ actorCreated() { this.#bs.addEventListener("BackupService:StateUpdate", this); - Services.obs.addObserver(this, "backup-service-status-updated"); + Services.obs.addObserver(this.sendState, "backup-service-status-updated"); // Note that loadEncryptionState is an async function. // This function is no-op if the encryption state was already loaded. this.#bs.loadEncryptionState(); @@ -62,7 +62,10 @@ export class BackupUIParent extends JSWindowActorParent { */ didDestroy() { this.#bs.removeEventListener("BackupService:StateUpdate", this); - Services.obs.removeObserver(this, "backup-service-status-updated"); + Services.obs.removeObserver( + this.sendState, + "backup-service-status-updated" + ); } /** @@ -108,9 +111,7 @@ export class BackupUIParent extends JSWindowActorParent { */ async receiveMessage(message) { if (message.name == "RequestState") { - this.sendAsyncMessage("StateUpdate", { - state: this.#bs.state, - }); + this.sendState(); } else if (message.name == "TriggerCreateBackup") { return await this.#triggerCreateBackup({ reason: "manual" }); } else if (message.name == "EnableScheduledBackups") { @@ -280,13 +281,13 @@ export class BackupUIParent extends JSWindowActorParent { return null; } - observe(_subject, topic, _data) { - if (topic == "backup-service-status-updated") { - // Send the StateUpdate message to the BackupUIChild, along with the most - // recent state object from BackupService. - this.sendAsyncMessage("StateUpdate", { - state: this.#bs.state, - }); - } + /** + * Sends the StateUpdate message to the BackupUIChild, along with the most + * recent state object from BackupService. + */ + sendState() { + this.sendAsyncMessage("StateUpdate", { + state: this.#bs.state, + }); } }