[WebDriver BiDi] preload scripts channel messages from a window.open popup have no context
Categories
(Remote Protocol :: WebDriver BiDi, defect, P3)
Tracking
(firefox160 fixed)
| Tracking | Status | |
|---|---|---|
| firefox160 | --- | fixed |
People
(Reporter: james.h.evans.jr, Assigned: Sasha)
References
Details
(Whiteboard: [webdriver:m22], [wptsync upstream][webdriver:relnote])
Attachments
(2 external files)
User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:157.0) Gecko/20100101 Firefox/157.0
Steps to reproduce
Environment: Firefox Nightly 159.0a1, started with firefox --remote-debugging-port 0 --profile <new profile> --headless
Steps to reproduce
- Set up a web server to listen on port
<port>, and respond to the following paths with the corresponding HTML documents:
/before:<!DOCTYPE html><title>Before</title><p>Before</p>/recorded:<!DOCTYPE html><title>Recorded</title><button id="open" onclick="window.open('/popup')" style="width:200px;height:50px">Open</button><iframe src="/frame"></iframe>/frame:<!DOCTYPE html><title>Frame</title><p>Frame</p>/popup:<!DOCTYPE html><title>Popup</title><p>Popup</p>
-
Let
<function>be the following JavaScript function:(send) => { document.addEventListener('click', (event) => send({ kind: 'click', target: event.target.id, trusted: event.isTrusted }), true); send({ kind: 'installed', url: location.href, top: window === window.top }); } -
Issue the WebDriver BiDi command
session.newwith parameters{"capabilities":{}} -
Issue the WebDriver BiDi command
browsingContext.getTreewith parameters{}and extract the browsing context (<context-1>from the response -
Issue the WebDriver BiDi command
session.subscribewith parameters{"events":["script.message","browsingContext.contextCreated","browsingContext.load"]} -
Issue the WebDriver BiDi command
browsingContext.navigatewith parameters{"context":"<context-1>","url":"http://127.0.0.1:<port>/before","wait":"complete"} -
Issue the WebDriver BiDi command
script.callFunctionwith parameters{"functionDeclaration": "<function>", "arguments":[{"type":"channel","value":{"channel":"recorder"}}], "target":{"context":"<context-1>","sandbox":"probe"}}, and verify that one "installed" message arrives. -
Issue the WebDriver BiDi command
script.addPreloadScriptwith parameters{"functionDeclaration": "<function>", "arguments":[{"type":"channel","value":{"channel":"recorder"}}], "target":{"context":"<context-1>","sandbox":"probe"}} -
Issue the WebDriver BiDi command
browsingContext.navigatewith parameters{"context":"<context-1>","url":"http://127.0.0.1:<port>/recorded","wait":"complete"}, and verify that "installed" messages arrive from the page and its iframe -
Issue the WebDriver BiDi command
script.evaluatewith parameters{"expression":"document.getElementById('open')","target":{"context":"<context-1>"},"awaitPromise":false}and extract the element shared ID (<sharedId-1>) from the response -
Issue the WebDriver BiDi command
input.performActionswith parameters{"context":"<context-1>","actions":[{"type":"pointer","id":"mouse","actions":[{"type":"pointerMove","x":0,"y":0,"origin":{"type":"element","element":{"sharedId":"<sharedId-1>"}}},{"type":"pointerDown","button":0},{"type":"pointerUp","button":0}]}]}and capture the popup context (<context-2>) from thebrowsingContext.contextCreatedevent data -
After the popup's
browsingContext.loadfor/popup, issue the WebDriver BiDi commandscript.evaluatewith parameters{"expression":"document.body.id = 'popup-body'; document.body.click()","target":{"context":"<context-2>"},"awaitPromise":false}
Actual results
two messages from the popup's initial documents arrive before its browsingContext.contextCreated, with source.context: null. Nothing arrives from the loaded /popup document, although step 11 succeeds. The same happens with the preload script in the main realm instead of a sandbox.
Expected results
script.message from the popup's documents with source.context set to the popup's browsing context, including the click in its loaded document, as the messages from the opener page and its iframe do.
| Assignee | ||
Comment 1•1 month ago
|
||
| Assignee | ||
Comment 2•1 month ago
|
||
Updated•1 month ago
|
| Assignee | ||
Updated•1 month ago
|
https://hg.mozilla.org/mozilla-central/rev/1589d32b83dd
https://hg.mozilla.org/mozilla-central/rev/a2e7b6e54d7e
Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/63673 for changes under testing/web-platform/tests
Upstream PR merged by moz-wptsync-bot
Updated•15 days ago
|
Description
•