diff --git a/remote/webdriver-bidi/modules/root/input.sys.mjs b/remote/webdriver-bidi/modules/root/input.sys.mjs index a84f2aa6d46e..6a58d7611df2 100644 --- a/remote/webdriver-bidi/modules/root/input.sys.mjs +++ b/remote/webdriver-bidi/modules/root/input.sys.mjs @@ -27,6 +27,13 @@ class InputModule extends Module { ); const context = lazy.TabManager.getBrowsingContextById(contextId); + if (!context) { + throw new lazy.error.NoSuchFrameError( + `Browsing context with id ${contextId} not found` + ); + } + + // Bug 1821460: Fetch top-level browsing context. await this.messageHandler.forwardCommand({ moduleName: "input",