Skip to content
This repository was archived by the owner on Jan 25, 2022. It is now read-only.
Closed
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
15 changes: 9 additions & 6 deletions spec.html
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ <h1><ins>Runtime Semantics: HostImportModuleDynamically ( _referencingScriptOrMo

<dd>
<ul>
<li>At some future time, the host environment must perform FinishDynamicImport(_referencingScriptOrModule_, _specifier_, _promiseCapability_, NormalCompletion(*undefined*)).</li>
<li>At some future time, the host environment must perform FinishDynamicImport(_referencingScriptOrModule_, _specifier_, _promiseCapability_, _promise_), where _promise_ is a Promise resolved with *undefined*.</li>

<li>Any subsequent call to HostResolveImportedModule after FinishDynamicImport has completed, given the arguments _referencingScriptOrModule_ and _specifier_, must complete normally.</li>

Expand All @@ -82,7 +82,7 @@ <h1><ins>Runtime Semantics: HostImportModuleDynamically ( _referencingScriptOrMo

<dd>
<ul>
<li>At some future time, the host environment must perform FinishDynamicImport(_referencingScriptOrModule_, _specifier_, _promiseCapability_, an abrupt completion), with the abrupt completion representing the cause of failure.</li>
<li>At some future time, the host environment must perform FinishDynamicImport(_referencingScriptOrModule_, _specifier_, _promiseCapability_, _promise_), where _promise_ is a Promise rejected with an error representing the cause of failure.</li>
</ul>
</dd>
</dl>
Expand All @@ -101,19 +101,22 @@ <h1><ins>Runtime Semantics: HostImportModuleDynamically ( _referencingScriptOrMo
</emu-clause>

<emu-clause id="sec-finishdynamicimport" aoid="FinishDynamicImport">
<h1><ins>Runtime Semantics: FinishDynamicImport ( _referencingScriptOrModule_, _specifier_, _promiseCapability_, _completion_ )</ins></h1>
<h1><ins>Runtime Semantics: FinishDynamicImport ( _referencingScriptOrModule_, _specifier_, _promiseCapability_, _innerPromise_ )</ins></h1>

<p>FinishDynamicImport completes the process of a dynamic import originally started by an `import()` call, resolving or rejecting the promise returned by that call as appropriate according to _completion_. It is performed by host environments as part of HostImportModuleDynamically.</p>

<emu-alg>
1. If _completion_ is an abrupt completion, then perform ! Call(_promiseCapability_.[[Reject]], *undefined*, « _completion_.[[Value]] »).
1. Otherwise,
1. Assert: _completion_ is a normal completion and _completion_.[[Value]] is *undefined*.
1. Let _onFulfilled_ be ! CreateBuiltinFunction(the following steps with argument _v_, « »).
1. Assert: _v_ is *undefined*.
1. Let _moduleRecord_ be ! HostResolveImportedModule(_referencingScriptOrModule_, _specifier_).
1. Assert: Evaluate has already been invoked on _moduleRecord_ and successfully completed.
1. Assert: _moduleRecord_.[[ExecPromise]] is resolved.
1. Let _namespace_ be GetModuleNamespace(_moduleRecord_).
1. If _namespace_ is an abrupt completion, perform ! Call(_promiseCapability_.[[Reject]], *undefined*, « _namespace_.[[Value]] »).
1. Otherwise, perform ! Call(_promiseCapability_.[[Resolve]], *undefined*, « _namespace_.[[Value]] »).
1. Let _onRejected_ be ! CreateBuiltinFunction(the following steps with argument _r_, « »).
1. Perform ! Call(_promiseCapability_.[[Reject]], *undefined*, « _r_ »).
1. ! PerformPromiseThen(_innerPromise_, _onFulfilled_, _onRejected_).
</emu-alg>
</emu-clause>
</emu-clause>
Expand Down