Open jugglinmike opened 5 years ago
Note that we already have tests which make use of await
:
https://github.com/web-platform-tests/wpt/blob/master/webdriver/tests/execute_script/promise.py
Would those have needed such a spec change before being allowed to land?
The Browser Testing and Tools Working Group just discussed Supporting await in Execute Script
.
There's been some talk about supporting
await
in the Execute Script and potentially Execute Async Script. This could be a great improvement, but it needs a little more definition before we can move on it.The answer to the first question seems to be "yes," but it would be nice to have verification here in the project's issue tracker.
2 is possible if we're willing to make inferences on developer intent based on the type of the return value (i.e. if it's a "thenable", then ignore the callback function).
I think believe that is the only way to implement 2. If that's right, then 3 may not be feasible. If Execute Async Script were interpreted with an async function, then it would always return a thenable, and we would have no way to determine when to wait for the invocation of the callback function.
Personally, I think we should consider Execute Async Script a legacy API and not bother with any enhancements to it.