diff --git a/spec.html b/spec.html index 4c52fc3..8ceeb63 100644 --- a/spec.html +++ b/spec.html @@ -123,7 +123,7 @@

Agents

a List of Async Context Mapping Records - A map from the AsyncContext.Variable instances to the saved ECMAScript language value. Every Record in the List contains a unique [[AsyncContextKey]]. The map is initially empty. + A map from the AsyncContext.Variable instances to the saved ECMAScript language value. Every Record in the List contains a unique [[AsyncContextKey]]. The map is initially the return value of HostGetTopLevelAsyncContextMapping(*null*). @@ -255,6 +255,59 @@

+ +

ECMAScript Language: Scripts and Modules

+ + +

Modules

+ + +

Module Semantics

+ + +

Source Text Module Records

+ +

+ ExecuteModule ( + optional _capability_: a PromiseCapability Record, + ): either a normal completion containing ~unused~ or a throw completion +

+
+
for
+
a Source Text Module Record _module_
+
+ + + 1. Let _moduleContext_ be a new ECMAScript code execution context. + 1. Set the Function of _moduleContext_ to *null*. + 1. Set the Realm of _moduleContext_ to _module_.[[Realm]]. + 1. Set the ScriptOrModule of _moduleContext_ to _module_. + 1. Assert: _module_ has been linked and declarations in its module environment have been instantiated. + 1. Set the VariableEnvironment of _moduleContext_ to _module_.[[Environment]]. + 1. Set the LexicalEnvironment of _moduleContext_ to _module_.[[Environment]]. + 1. Suspend the running execution context. + 1. Let _previousContextMapping_ be AsyncContextSwap(HostGetTopLevelAsyncContextMapping(_module_)). + 1. If _module_.[[HasTLA]] is *false*, then + 1. Assert: _capability_ is not present. + 1. Push _moduleContext_ onto the execution context stack; _moduleContext_ is now the running execution context. + 1. Let _result_ be Completion(Evaluation of _module_.[[ECMAScriptCode]]). + 1. AsyncContextSwap(_previousContextMapping_). + 1. Suspend _moduleContext_ and remove it from the execution context stack. + 1. Resume the context that is now on the top of the execution context stack as the running execution context. + 1. If _result_ is an abrupt completion, then + 1. Return ? _result_. + 1. Else, + 1. Assert: _capability_ is a PromiseCapability Record. + 1. Perform AsyncBlockStart(_capability_, _module_.[[ECMAScriptCode]], _moduleContext_). + 1. AsyncContextSwap(_previousContextMapping_). + 1. Return ~unused~. + +
+
+
+
+
+

Control Abstraction Objects

@@ -936,6 +989,25 @@

The AsyncContext Object

AsyncContext Abstract Operations

+ + +

+ HostGetTopLevelAsyncContextMapping ( + _module_: a Module Record or *null* + ): a List of Async Context Mapping Records

+
+
description
+
It allows hosts to provide the top level async context mapping for a given module record.
+
+

The default implementation of HostGetTopLevelAsyncContextMapping performs the following steps when called:

+ + 1. Return a new empty List. + + +

ECMAScript hosts may add host defined async context mapping entries to the list.

+
+
+

AsyncContextSnapshot ( @@ -1358,3 +1430,27 @@

FinalizationRegistry ( _cleanupCallback_ )

+ + +

Host Layering Points

+ + +

Host Hooks

+

HostCallJobCallback(...)

+

HostEnqueueFinalizationRegistryCleanupJob(...)

+

HostEnqueueGenericJob(...)

+

HostEnqueuePromiseJob(...)

+

HostEnqueueTimeoutJob(...)

+

HostEnsureCanCompileStrings(...)

+

HostFinalizeImportMeta(...)

+

HostGetImportMetaProperties(...)

+

HostGetTopLevelAsyncContextMapping(...)

+

HostGrowSharedArrayBuffer(...)

+

HostHasSourceTextAvailable(...)

+

HostLoadImportedModule(...)

+

HostMakeJobCallback(...)

+

HostPromiseRejectionTracker(...)

+

HostResizeArrayBuffer(...)

+

InitializeHostDefinedRealm(...)

+
+