Skip to content

Handle module scripts that include top-level await.#984

Closed
Ms2ger wants to merge 1 commit into
w3c:masterfrom
Ms2ger:tla-integration
Closed

Handle module scripts that include top-level await.#984
Ms2ger wants to merge 1 commit into
w3c:masterfrom
Ms2ger:tla-integration

Conversation

@Ms2ger
Copy link
Copy Markdown

@Ms2ger Ms2ger commented Apr 24, 2020

No description provided.

@Ms2ger
Copy link
Copy Markdown
Author

Ms2ger commented Apr 24, 2020

This is in response to whatwg/html#4352. @domenic , I'm not sure if this is what we want in terms of behavior, but it's a change, at least :)

Copy link
Copy Markdown
Contributor

@domenic domenic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for working on this! We may need the worklet editors for the semantic question of whether to run the scripts sequentially or not...

Comment thread worklets/Overview.bs
6. Run the <a>responsible event loop</a> specified by |insideSettings|.
9. [=Wait for all=] |scripts|, with success steps and failure steps both given by:

1. Run the <a>responsible event loop</a> specified by |insideSettings|.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this isn't right. Without an inner event loop, the microtask queue (and thus any awaits) cannot run.

I see two possible semantics here:

  • Ignore the promises returned; their errors will be reported appropriately, and that's all one would do with them.
  • Run the module scripts "sequentially", waiting for one to complete (i.e. the promise to settle) before moving on to the next.

I think the first of these is probably more correct, since (IIRC) it aligns with what happens if you have multiple TLA-using <script type=module>s.

Comment thread worklets/Overview.bs
2. If |pendingTaskStruct|'s <a for="pending tasks struct">counter</a> is <b>0</b>, then
resolve |promise|.
2. If |pendingTaskStruct|'s <a for="pending tasks struct">counter</a> is <b>0</b>, then
resolve |promise|.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like you shadowed an existing |promise| variable.

@Ms2ger
Copy link
Copy Markdown
Author

Ms2ger commented Apr 27, 2020

@bfgeek what do you think?

@annevk
Copy link
Copy Markdown
Member

annevk commented Nov 20, 2020

This is now whatwg/html#4352.

@annevk annevk closed this Nov 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants