Move the private "#getBrowsingContext" helper method to the RootBiDiModule class
Categories
(Remote Protocol :: WebDriver BiDi, task, P2)
Tracking
(firefox146 fixed)
| Tracking | Status | |
|---|---|---|
| firefox146 | --- | fixed |
People
(Reporter: jdescottes, Assigned: whimboo)
References
Details
(Whiteboard: [webdriver:m18])
Attachments
(1 file)
We currently have a private helper in the root browsingContext module for BiDi which follows https://w3c.github.io/webdriver-bidi/#get-a-browsing-context: https://searchfox.org/mozilla-central/source/remote/webdriver-bidi/modules/root/browsingContext.jsm#429-454
/**
* Retrieves a browsing context based on its id.
*
* @param {Number} contextId
* Id of the browsing context.
* @returns {BrowsingContext=}
* The browsing context or null if <var>contextId</var> is null.
* @throws {NoSuchFrameError}
* If the browsing context cannot be found.
*/
#getBrowsingContext(contextId) {
// The WebDriver BiDi specification expects null to be
// returned if no browsing context id has been specified.
if (contextId === null) {
return null;
}
const context = lazy.TabManager.getBrowsingContextById(contextId);
if (context === null) {
throw new lazy.error.NoSuchFrameError(
`Browsing Context with id ${contextId} not found`
);
}
return context;
}
Getting a browsing context is useful for commands outside of the browsingContext module (eg it's part of getting a realm from a target, relevant in the script module). It would make sense to extract it as a shared helper. To be clear this should probably not be in a BiDi MessageHandler module, but rather in a regular jsm so that we can use the helper with minimal overhead anywhere in the webdriver-bidi codebase.
| Reporter | ||
Updated•3 years ago
|
| Assignee | ||
Comment 1•2 months ago
|
||
This method should actually be moved to the RootBiDiModule.sys.mjs module so that it can be used by all the different WebDriver BiDi root modules without having to specify it in each of these modules as what we do these days.
I would like to have it for bug 1944568 so that we can specify which commands are allowed to run in the parent process and have this check at a single location.
| Assignee | ||
Updated•2 months ago
|
| Assignee | ||
Comment 2•2 months ago
|
||
| Assignee | ||
Updated•2 months ago
|
Comment 4•2 months ago
|
||
| bugherder | ||
Description
•