Skip to content

[Editorial review] BiDi script module - disown, addPreloadScript, removePreloadScript - #46094

Merged
dipikabh merged 7 commits into
mdn:mainfrom
dipikabh:bidi-script-4
Oct 19, 2026
Merged

dipikabh merged 7 commits into
mdn:mainfrom
dipikabh:bidi-script-4

Conversation

@dipikabh

Copy link
Copy Markdown
Contributor

Description

  • Added pages for the following commands of the script module (with corresponding updates to the sidebar and script module landing page):

    • script.disown
    • script.addPreloadScript
    • script.removePreloadScript
  • Added sections to the script module landing page to explain "preload scripts" and "channels" in the context of BiDi.

  • Some minor consistency fixes in browsingContext.create and session.subscribe to move the ID lookup sentence to end of the field description

Spec links

Related issue

Doc issue: mdn/mdn#851

@dipikabh
dipikabh requested a review from a team October 10, 2026 14:16
@dipikabh
dipikabh requested review from a team as code owners October 10, 2026 14:16
@dipikabh
dipikabh requested review from chrisdavidmills and pepelsbey and removed request for a team October 10, 2026 14:16
@github-actions github-actions Bot added the Content:WebDriver WebDriver docs label Oct 10, 2026
@dipikabh
dipikabh requested review from a team and pepelsbey and removed request for a team, chrisdavidmills and pepelsbey October 10, 2026 14:16
@github-actions github-actions Bot added the size/l [PR only] 501-1000 LoC changed label Oct 10, 2026
@dipikabh
dipikabh removed the request for review from pepelsbey October 10, 2026 14:16
@github-actions

github-actions Bot commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor
Preview URLs (8 pages)
Flaws (20)

Note! 2 documents with no flaws that don't need to be listed. 🎉

Found an unexpected or unresolvable flaw? Please report it here.

URL: /en-US/docs/Web/WebDriver/Reference/BiDi/Modules/browsingContext/locateNodes
Title: browsingContext.locateNodes command
Flaw count: 3

  • broken_links:
    • Link /en-US/docs/Web/WebDriver/Reference/BiDi/Modules/script/callFunction doesn't resolve
    • Link /en-US/docs/Web/WebDriver/Reference/BiDi/Modules/script/callFunction doesn't resolve
    • Link /en-US/docs/Web/WebDriver/Reference/BiDi/Modules/script/callFunction doesn't resolve

URL: /en-US/docs/Web/WebDriver/Reference/BiDi/Modules/script
Title: script module
Flaw count: 3

  • broken_links:
    • Link /en-US/docs/Web/WebDriver/Reference/BiDi/Modules/script/callFunction doesn't resolve
    • Link /en-US/docs/Web/WebDriver/Reference/BiDi/Modules/script/callFunction#target doesn't resolve
    • Link /en-US/docs/Web/WebDriver/Reference/BiDi/Modules/script/callFunction doesn't resolve

URL: /en-US/docs/Web/WebDriver/Reference/BiDi/Modules/script/addPreloadScript
Title: script.addPreloadScript command
Flaw count: 7

  • broken_links:
    • Link /en-US/docs/Web/WebDriver/Reference/BiDi/Modules/script/message doesn't resolve
    • Link /en-US/docs/Web/WebDriver/Reference/BiDi/Modules/script/message doesn't resolve
    • Link /en-US/docs/Web/WebDriver/Reference/BiDi/Modules/script/message#data doesn't resolve
    • Link /en-US/docs/Web/WebDriver/Reference/BiDi/Modules/script/callFunction#arguments doesn't resolve
    • Link /en-US/docs/Web/WebDriver/Reference/BiDi/Modules/script/message doesn't resolve
    • and 2 more flaws omitted

URL: /en-US/docs/Web/WebDriver/Reference/BiDi/Modules/script/disown
Title: script.disown command
Flaw count: 4

  • broken_links:
    • Link /en-US/docs/Web/WebDriver/Reference/BiDi/Modules/script/callFunction doesn't resolve
    • Link /en-US/docs/Web/WebDriver/Reference/BiDi/Modules/script/message doesn't resolve
    • Link /en-US/docs/Web/WebDriver/Reference/BiDi/Modules/script/callFunction doesn't resolve
    • Link /en-US/docs/Web/WebDriver/Reference/BiDi/Modules/script/callFunction doesn't resolve

URL: /en-US/docs/Web/WebDriver/Reference/BiDi/Modules/script/evaluate
Title: script.evaluate command
Flaw count: 2

  • broken_links:
    • Link /en-US/docs/Web/WebDriver/Reference/BiDi/Modules/script/callFunction#arguments doesn't resolve
    • Link /en-US/docs/Web/WebDriver/Reference/BiDi/Modules/script/callFunction doesn't resolve

URL: /en-US/docs/Web/WebDriver/Reference/BiDi/Modules/script/removePreloadScript
Title: script.removePreloadScript command
Flaw count: 1

  • broken_links:
    • Link /en-US/docs/Web/WebDriver/Reference/BiDi/Modules/script/callFunction doesn't resolve

(comment last updated: 2026-10-19 17:01:15)

@github-actions github-actions Bot added the merge conflicts 🚧 [PR only] label Oct 12, 2026
@github-actions

Copy link
Copy Markdown
Contributor

This pull request has merge conflicts that must be resolved before it can be merged.

@chrisdavidmills chrisdavidmills left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, @dipikabh! This looks mostly good; I just have a few comments.

Comment thread files/en-us/web/webdriver/reference/bidi/modules/script/addpreloadscript/index.md Outdated
Comment thread files/en-us/web/webdriver/reference/bidi/modules/script/addpreloadscript/index.md Outdated
Comment thread files/en-us/web/webdriver/reference/bidi/modules/script/addpreloadscript/index.md Outdated
Comment thread files/en-us/web/webdriver/reference/bidi/modules/script/disown/index.md Outdated
The browser returns a handle for the resulting object.

When you no longer need the handle, send the following message to release it.
Use the same context ID as in the earlier `script.evaluate` command, without navigating or reloading the page between the two commands:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not clear what you mean by "earlier script.evaluate command" - the script.evaluate command shown earlier doesn't seem to have a context ID.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch! That piece of detail was missing. Added getting context ID to the scenario and adjusted existing prose:

Assume you have a WebDriver BiDi connection and an active session.
You get an open tab's context ID by using browsingContext.getTree.

Suppose you evaluate ({ count: 2 }) in the tab by using script.evaluate.
In that command, you pass the context ID in the target parameter and set the resultOwnership parameter to "root".
The browser returns a handle for the resulting object.

When you no longer need the handle, send the following message to release it.
Use the tab's context ID and the returned handle, without navigating or reloading the page between the two commands:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good. The only thing I'd query further here is { count: 2 } — I'm not sure what that means. count is not mentioned anywhere in the script.evaluate page. Is this supposed to be the expression that script.evaluate is evaluating, in which case wouldn't something more obvious like document.title be better?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, ({ count: 2 }) was supposed to be the expression to evaluate. It creates an object with a count property.

Getting a handle requires both these conditions to be satisfied: "resultOwnership": "root" and a returned value that supports a handle (strings don't support handles, so document.title wouldn’t provide one we need for this example.).

Taking your comment into consideration, I’ve replaced it with document.querySelector('button'), an expression that's already used on the script.evaluate page. I've also expanded the example prose to clarify that the returned element is a DOM node and that it supports a handle.

Update is in 63ee7f7.

Comment thread files/en-us/web/webdriver/reference/bidi/modules/script/index.md Outdated
Comment thread files/en-us/web/webdriver/reference/bidi/modules/script/index.md Outdated
@dipikabh

dipikabh commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor Author

Thanks for the review, Chris. This is ready for another look.

@chrisdavidmills chrisdavidmills left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great, @dipikabh, nice work. I've added a few further counter-comments, but no new ones. I'll approve this so you can merge once you've looked them over.

@lutien lutien left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! That looks good to me!

@dipikabh

Copy link
Copy Markdown
Contributor Author

Thanks for reviewing, @lutien.

@dipikabh dipikabh changed the title [Technical review] BiDi script module - disown, addPreloadScript, removePreloadScript [Editorial review] BiDi script module - disown, addPreloadScript, removePreloadScript Oct 19, 2026
@dipikabh

Copy link
Copy Markdown
Contributor Author

Thanks @chrisdavidmills for going over the fixes!

@dipikabh
dipikabh merged commit eb95035 into mdn:main Oct 19, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Content:WebDriver WebDriver docs size/l [PR only] 501-1000 LoC changed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants