Skip to content

Commit 3243915

Browse files
Add CreateAsyncContextSnapshot AO (#97)
In the web integration of AsyncContext, web specs will need to create `AsyncContext.Snapshot` objects from an AsyncContext mapping; and we expect this to be necessary for other kinds of hosts as well, such as Node.js. Currently the spec text does not provide any way to do that other than manually creating the object and populating its `[[AsyncContextMapping]]` slot, since the `AsyncContext.Snapshot` constructor always uses the current mapping. So this patch adds an abstract operation called `CreateAsyncContextSnapshot` that provides this capability.
1 parent 1fd6726 commit 3243915

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

spec.html

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -968,6 +968,26 @@ <h1>
968968
1. Return _asyncContextMapping_.
969969
</emu-alg>
970970
</emu-clause>
971+
972+
<emu-clause id="sec-createasynccontextsnapshot" type="abstract operation">
973+
<h1>
974+
CreateAsyncContextSnapshot (
975+
_snapshotMapping_: a List of Async Context Mapping Records
976+
): either a normal completion containing an AsyncContext.Snapshot object or a throw completion
977+
</h1>
978+
<dl class="header">
979+
<dt>description</dt>
980+
<dd>It is used to obtain an AsyncContext.Snapshot object representing the given List of Async Context Mapping Records.</dd>
981+
</dl>
982+
<emu-alg>
983+
1. Let _asyncSnapshot_ be ? OrdinaryCreateFromConstructor(%AsyncContext.Snapshot%, *"%AsyncContext.Snapshot.prototype%"*, « [[AsyncSnapshotMapping]] »).
984+
1. Set _asyncSnapshot_.[[AsyncSnapshotMapping]] to _snapshotMapping_.
985+
1. Return _asyncSnapshot_.
986+
</emu-alg>
987+
<emu-note>
988+
<p>This abstract operation is meant for hosts to use, and it is not used in this specification.</p>
989+
</emu-note>
990+
</emu-clause>
971991
</emu-clause>
972992

973993
<emu-clause id="sec-constructor-properties-of-the-asynccontext-object">

0 commit comments

Comments
 (0)