tor-browser

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

commit 34f05691876f733b795e9125a12fc631d9fef3f5
parent b58eba3b57bd620e48813ca1ac82117b7b697812
Author: Jens Stutte <jstutte@mozilla.com>
Date:   Tue,  7 Oct 2025 07:17:11 +0000

Bug 1991840 - UITour.initForBrowser should addObserver only once. r=omc-reviewers,jprickett

It is unclear if this is something that can only happen during testing, but it seems wise to harden initForBrowser in general.

Differential Revision: https://phabricator.services.mozilla.com/D267199

Diffstat:
Mbrowser/components/uitour/UITour.sys.mjs | 8++++++--
1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/browser/components/uitour/UITour.sys.mjs b/browser/components/uitour/UITour.sys.mjs @@ -72,6 +72,8 @@ export var UITour = { _annotationPanelMutationObservers: new WeakMap(), + _initForBrowserObserverAdded: false, + highlightEffects: ["random", "wobble", "zoom", "color", "focus-outline"], targets: new Map([ [ @@ -644,8 +646,10 @@ export var UITour = { } this.tourBrowsersByWindow.get(window).add(aBrowser); - Services.obs.addObserver(this, "message-manager-close"); - + if (!this._initForBrowserObserverAdded) { + this._initForBrowserObserverAdded = true; + Services.obs.addObserver(this, "message-manager-close"); + } window.addEventListener("SSWindowClosing", this); },