Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Normative: Mark sync module evaluation promise as handled #3535

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 23 additions & 4 deletions spec.html
Original file line number Diff line number Diff line change
Expand Up @@ -26620,6 +26620,28 @@ <h1>Abstract Module Records</h1>
</tr>
</table>
</emu-table>

<emu-clause id="sec-EvaluateModuleSync" type="abstract operation">
<h1>
EvaluateModuleSync (
_module_: a Module Record,
): either a normal completion containing ~unused~ or a throw completion
</h1>
<dl class="header">
<dt>description</dt>
<dd>It synchronously evaluates _module_, provided that the caller guarantees that _module_'s evaluation will return an already settled promise.</dd>
</dl>

<emu-alg>
1. Assert: _module_ is not a Cyclic Module Record.
1. Let _promise_ be _module_.Evaluate().
1. Assert: _promise_.[[PromiseState]] is either ~fulfilled~ or ~rejected~.
1. If _promise_.[[PromiseState]] is ~rejected~, then
1. Perform HostPromiseRejectionTracker(_promise_, *"handle"*).
1. Return ThrowCompletion(_promise_.[[PromiseResult]]).
1. Return ~unused~.
</emu-alg>
</emu-clause>
</emu-clause>

<emu-clause id="sec-cyclic-module-records">
Expand Down Expand Up @@ -27098,10 +27120,7 @@ <h1>

<emu-alg>
1. If _module_ is not a Cyclic Module Record, then
1. Let _promise_ be ! _module_.Evaluate().
1. Assert: _promise_.[[PromiseState]] is not ~pending~.
1. If _promise_.[[PromiseState]] is ~rejected~, then
1. Return ThrowCompletion(_promise_.[[PromiseResult]]).
1. Perform ? EvaluateModuleSync(_module_).
1. Return _index_.
1. If _module_.[[Status]] is either ~evaluating-async~ or ~evaluated~, then
1. If _module_.[[EvaluationError]] is ~empty~, return _index_.
Expand Down