WebDriver BiDi: support script evaluation (with `awaitPromise`) in worker realm
Categories
(Core :: JavaScript: Debugger API, enhancement, P3)
Tracking
()
People
(Reporter: aslushnikov, Unassigned)
References
Details
User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/150.0.0.0 Safari/537.36
Steps to reproduce:
We (Playwright's Firefox automation, a.k.a. juggler) implement evaluation in
dedicated workers on top of the WorkerDebugger API, and we used the
Debugger.onPromiseSettled hook to await promise-returning evaluations.
That hook was removed in bug 2044167, and there is no replacement that works
in a worker debugger context:
- On the main thread, one can dereference the promise and attach reactions
from the privileged compartment (this is what BiDi'swindowglobalscript
module and the DevTools console do forawaitPromise/ top-level await). - In a worker debugger global there are no Xrays, so the dereferenced promise
is an opaque wrapper and.thenis not callable.
As a workaround, we now attach reactions inside the debuggee that execute a
debugger statement upon settlement, and observe it via the
Debugger.onDebuggerStatement hook — as far as we can tell, the only
remaining way to react to promise settlement from a worker debugger context.
We would love to have a proper way to await evaluation results in worker
contexts. BiDi will need the same primitive once script.evaluate /
script.callFunction support worker realms, which the spec implies via realm
targeting.
Comment 1•3 months ago
|
||
The Bugbug bot thinks this bug should belong to the 'Core::JavaScript Engine' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.
Updated•3 months ago
|
Updated•3 months ago
|
Description
•