tor-browser

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

commit 9e80bc22f2168fea0c1cc1b85fbac1dfe73a9d72
parent 44a56571e6eeaa9b27cd2b7fe76152e7a5696ae0
Author: Henrik Skupin <mail@hskupin.info>
Date:   Tue, 11 Nov 2025 10:33:26 +0000

Bug 1848958 - [remote] Ignore error from finalize action if browsing context no longer exists. r=jdescottes

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

Diffstat:
Mremote/marionette/driver.sys.mjs | 14+++++++++-----
Mremote/webdriver-bidi/modules/root/input.sys.mjs | 14+++++++++-----
2 files changed, 18 insertions(+), 10 deletions(-)

diff --git a/remote/marionette/driver.sys.mjs b/remote/marionette/driver.sys.mjs @@ -173,12 +173,16 @@ class ActionsHelper { * * @param {BrowsingContext} browsingContext * The browsing context to dispatch the event to. - * - * @returns {Promise} - * Promise that resolves when the finalization is done. */ - finalizeAction(browsingContext) { - return this.#getActor(browsingContext).finalizeAction(); + async finalizeAction(browsingContext) { + try { + await this.#getActor(browsingContext).finalizeAction(); + } catch (e) { + // Ignore the error if the underlying browsing context is already gone. + if (e.name !== lazy.error.NoSuchWindowError.name) { + throw e; + } + } } /** diff --git a/remote/webdriver-bidi/modules/root/input.sys.mjs b/remote/webdriver-bidi/modules/root/input.sys.mjs @@ -113,12 +113,16 @@ class InputModule extends RootBiDiModule { * * @param {BrowsingContext} context * The browsing context to forward the command to. - * - * @returns {Promise} - * Promise that resolves when the finalization is done. */ - #finalizeAction(context) { - return this._forwardToWindowGlobal("_finalizeAction", context.id); + async #finalizeAction(context) { + try { + await this._forwardToWindowGlobal("_finalizeAction", context.id); + } catch (e) { + // Ignore the error if the underlying browsing context is already gone. + if (e.name !== "DiscardedBrowsingContextError") { + throw e; + } + } } /**