Skip to content

Supporting await in Execute Script #1436

Open
@jugglinmike

Description

@jugglinmike

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.

  • Should "Execute Script" be interpreted with an async function?
  • Should "Execute Async Script" honor Promise return values?
  • Should "Execute Async Script" be interpreted with an async function?

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions