tor-browser

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

commit 58266a6f6642090496bb3daeec323f3e6e160bfe
parent 33ffbbf1b530d1d0a1e037687166a08e5da2036b
Author: Alexandre Poirot <poirot.alex@gmail.com>
Date:   Mon,  6 Oct 2025 10:19:18 +0000

Bug 1991420 - [devtools] Properly unregister listeners on console closing. r=devtools-reviewers,nchevobbe

The blur listener wasn't removed and would still be fired on toolbox closing.
But now the action throws and pollutes tests output.

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

Diffstat:
Mdevtools/client/webconsole/components/App.js | 14++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/devtools/client/webconsole/components/App.js b/devtools/client/webconsole/components/App.js @@ -134,9 +134,17 @@ class App extends Component { } componentDidMount() { - window.addEventListener("blur", this.onBlur); + window.addEventListener("blur", this.onBlur, { + signal: this.#abortController.signal, + }); + } + + componentWillUnmount() { + this.#abortController.abort(); } + #abortController = new AbortController(); + onBlur() { this.props.dispatch(actions.autocompleteClear()); } @@ -274,7 +282,9 @@ class App extends Component { } }; - input.addEventListener("keyup", pasteKeyUpHandler); + input.addEventListener("keyup", pasteKeyUpHandler, { + signal: this.#abortController.signal, + }); } renderChromeDebugToolbar() {