tor-browser

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

commit a6a9422f1d15c9c94aa13fe045c23c880281f558
parent 99a1153fdbea4970c6d37dc34370b5645a1ab53f
Author: Henrik Skupin <mail@hskupin.info>
Date:   Thu, 13 Nov 2025 08:14:46 +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; + } + } } /**