From 32439151c7a06df9bba38ecdfcf2f2400ec81080 Mon Sep 17 00:00:00 2001 From: Andreu Botella Date: Wed, 10 Jul 2024 17:09:33 +0200 Subject: [PATCH] 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. --- spec.html | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/spec.html b/spec.html index 5cfa730..4c52fc3 100644 --- a/spec.html +++ b/spec.html @@ -968,6 +968,26 @@

1. Return _asyncContextMapping_. + + +

+ CreateAsyncContextSnapshot ( + _snapshotMapping_: a List of Async Context Mapping Records + ): either a normal completion containing an AsyncContext.Snapshot object or a throw completion +

+
+
description
+
It is used to obtain an AsyncContext.Snapshot object representing the given List of Async Context Mapping Records.
+
+ + 1. Let _asyncSnapshot_ be ? OrdinaryCreateFromConstructor(%AsyncContext.Snapshot%, *"%AsyncContext.Snapshot.prototype%"*, « [[AsyncSnapshotMapping]] »). + 1. Set _asyncSnapshot_.[[AsyncSnapshotMapping]] to _snapshotMapping_. + 1. Return _asyncSnapshot_. + + +

This abstract operation is meant for hosts to use, and it is not used in this specification.

+
+