Skip to content

Commit

Permalink
Add CreateAsyncContextSnapshot AO
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
andreubotella committed Jul 9, 2024
1 parent 1fd6726 commit 2ed4db2
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions spec.html
Original file line number Diff line number Diff line change
Expand Up @@ -968,6 +968,23 @@ <h1>
1. Return _asyncContextMapping_.
</emu-alg>
</emu-clause>

<emu-clause id="sec-createasynccontextsnapshot" type="abstract operation">
<h1>
CreateAsyncContextSnapshot (
_snapshotMapping_: a List of Async Context Mapping Records
): either a normal completion containing an AsyncContext.Snapshot object or a throw completion
</h1>
<dl class="header">
<dt>description</dt>
<dd>It is used to obtain an AsyncContext.Snapshot object representing the given List of Async Context Mapping Records.</dd>
</dl>
<emu-alg>
1. Let _asyncSnapshot_ be ? OrdinaryCreateFromConstructor(%AsyncContext.Snapshot%, *"%AsyncContext.Snapshot.prototype%"*, « [[AsyncSnapshotMapping]] »).
1. Set _asyncSnapshot_.[[AsyncSnapshotMapping]] to _snapshotMapping_.
1. Return _asyncSnapshot_.
</emu-alg>
</emu-clause>
</emu-clause>

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

0 comments on commit 2ed4db2

Please sign in to comment.