Repository navigation
[Editorial review] BiDi script module - disown, addPreloadScript, removePreloadScript - #46094
Conversation
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:
URL:
URL:
URL:
URL:
URL:
(comment last updated: 2026-10-19 17:01:15) |
|
This pull request has merge conflicts that must be resolved before it can be merged. |
chrisdavidmills
left a comment
There was a problem hiding this comment.
Hi, @dipikabh! This looks mostly good; I just have a few comments.
| 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: |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 usingbrowsingContext.getTree.Suppose you evaluate
({ count: 2 })in the tab by usingscript.evaluate.
In that command, you pass the context ID in thetargetparameter and set theresultOwnershipparameter 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:
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
ad309b6 to
39ad55a
Compare
|
Thanks for the review, Chris. This is ready for another look. |
chrisdavidmills
left a comment
There was a problem hiding this comment.
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
left a comment
There was a problem hiding this comment.
Thanks! That looks good to me!
|
Thanks for reviewing, @lutien. |
disown, addPreloadScript, removePreloadScriptdisown, addPreloadScript, removePreloadScript
70b417e to
63ee7f7
Compare
|
Thanks @chrisdavidmills for going over the fixes! |
Description
Added pages for the following commands of the
scriptmodule (with corresponding updates to the sidebar andscriptmodule landing page):script.disownscript.addPreloadScriptscript.removePreloadScriptAdded sections to the
scriptmodule landing page to explain "preload scripts" and "channels" in the context of BiDi.Some minor consistency fixes in
browsingContext.createandsession.subscribeto move the ID lookup sentence to end of the field descriptionSpec links
Related issue
Doc issue: mdn/mdn#851