From 0f64be97d18be16471e8dff19f758d020d380282 Mon Sep 17 00:00:00 2001 From: Chengzhong Wu Date: Wed, 4 Sep 2024 10:50:41 +0100 Subject: [PATCH] Editorial: unify term async context mapping (#99) --- spec.html | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/spec.html b/spec.html index 4c52fc3..0dbb8a4 100644 --- a/spec.html +++ b/spec.html @@ -140,13 +140,13 @@

1. Assert: _finalizationRegistry_ has [[Cells]] and [[CleanupCallback]] internal slots. - 1. Assert: _finalizationRegistry_ has [[Cells]], [[CleanupCallback]], and [[FinalizationRegistryAsyncContextSnapshot]] internal slots. + 1. Assert: _finalizationRegistry_ has [[Cells]], [[CleanupCallback]], and [[FinalizationRegistryAsyncContextMapping]] internal slots. 1. Let _callback_ be _finalizationRegistry_.[[CleanupCallback]]. 1. While _finalizationRegistry_.[[Cells]] contains a Record _cell_ such that _cell_.[[WeakRefTarget]] is ~empty~, an implementation may perform the following steps: 1. Choose any such _cell_. 1. Remove _cell_ from _finalizationRegistry_.[[Cells]]. 1. Perform ? HostCallJobCallback(_callback_, *undefined*, « _cell_.[[HeldValue]] »). - 1. Let _previousContextMapping_ be AsyncContextSwap(_finalizationRegistry_.[[FinalizationRegistryAsyncContextSnapshot]]). + 1. Let _previousContextMapping_ be AsyncContextSwap(_finalizationRegistry_.[[FinalizationRegistryAsyncContextMapping]]). 1. Let _result_ be Completion(HostCallJobCallback(_callback_, *undefined*, « _cell_.[[HeldValue]] »)). 1. AsyncContextSwap(_previousContextMapping_). 1. Perform ? _result_. @@ -316,7 +316,7 @@

PromiseReaction Records

- [[PromiseAsyncContextSnapshot]] + [[PromiseAsyncContextMapping]] a List of Async Context Mapping Records @@ -377,7 +377,7 @@

1. Let _promiseCapability_ be _reaction_.[[Capability]]. 1. Let _type_ be _reaction_.[[Type]]. 1. Let _handler_ be _reaction_.[[Handler]]. - 1. Let _previousContextMapping_ be AsyncContextSwap(_reaction_.[[PromiseAsyncContextSnapshot]]). + 1. Let _previousContextMapping_ be AsyncContextSwap(_reaction_.[[PromiseAsyncContextMapping]]). 1. If _handler_ is ~empty~, then 1. If _type_ is ~fulfill~, then 1. let _handlerResult_ be NormalCompletion(_argument_). @@ -420,10 +420,10 @@

- 1. Let _snapshot_ be AsyncContextSnapshot(). - 1. Let _job_ be a new Job Abstract Closure with no parameters that captures _promiseToResolve_, _thenable_, _then_, and _snapshot_ and performs the following steps when called: + 1. Let _mapping_ be AsyncContextSnapshot(). + 1. Let _job_ be a new Job Abstract Closure with no parameters that captures _promiseToResolve_, _thenable_, _then_, and _mapping_ and performs the following steps when called: 1. Let _resolvingFunctions_ be CreateResolvingFunctions(_promiseToResolve_). - 1. Let _previousContextMapping_ be AsyncContextSwap(_snapshot_). + 1. Let _previousContextMapping_ be AsyncContextSwap(_mapping_). 1. Let _thenCallResult_ be Completion(HostCallJobCallback(_then_, _thenable_, « _resolvingFunctions_.[[Resolve]], _resolvingFunctions_.[[Reject]] »)). 1. If _thenCallResult_ is an abrupt completion, then 1. Return ? Call(_resolvingFunctions_.[[Reject]], *undefined*, « _thenCallResult_.[[Value]] »). @@ -490,9 +490,9 @@

1. Let _onRejectedJobCallback_ be ~empty~. 1. Else, 1. Let _onRejectedJobCallback_ be HostMakeJobCallback(_onRejected_). - 1. Let _snapshot_ be AsyncContextSnapshot(). - 1. Let _fulfillReaction_ be the PromiseReaction Record { [[Capability]]: _resultCapability_, [[Type]]: ~fulfill~, [[Handler]]: _onFulfilledJobCallback_, [[PromiseAsyncContextSnapshot]]: _snapshot_ }. - 1. Let _rejectReaction_ be the PromiseReaction Record { [[Capability]]: _resultCapability_, [[Type]]: ~reject~, [[Handler]]: _onRejectedJobCallback_, [[PromiseAsyncContextSnapshot]]: _snapshot_}. + 1. Let _mapping_ be AsyncContextSnapshot(). + 1. Let _fulfillReaction_ be the PromiseReaction Record { [[Capability]]: _resultCapability_, [[Type]]: ~fulfill~, [[Handler]]: _onFulfilledJobCallback_, [[PromiseAsyncContextMapping]]: _mapping_ }. + 1. Let _rejectReaction_ be the PromiseReaction Record { [[Capability]]: _resultCapability_, [[Type]]: ~reject~, [[Handler]]: _onRejectedJobCallback_, [[PromiseAsyncContextMapping]]: _mapping_}. 1. If _promise_.[[PromiseState]] is ~pending~, then 1. Append _fulfillReaction_ to _promise_.[[PromiseFulfillReactions]]. 1. Append _rejectReaction_ to _promise_.[[PromiseRejectReactions]]. @@ -1063,10 +1063,10 @@

AsyncContext.Snapshot.wrap ( _fn_ )

1. If IsCallable(_fn_) is *false*, throw a *TypeError* exception. - 1. Let _snapshot_ be AsyncContextSnapshot(). - 1. Let _closure_ be a new Abstract Closure with parameters (..._args_) that captures _fn_ and _snapshot_ and performs the following steps when called: + 1. Let _mapping_ be AsyncContextSnapshot(). + 1. Let _closure_ be a new Abstract Closure with parameters (..._args_) that captures _fn_ and _mapping_ and performs the following steps when called: 1. Let _thisArgument_ be the *this* value. - 1. Let _previousContextMapping_ be AsyncContextSwap(_snapshot_). + 1. Let _previousContextMapping_ be AsyncContextSwap(_mapping_). 1. Let _result_ be Completion(Call(_fn_, _thisArgument_, _args_)). 1. AsyncContextSwap(_previousContextMapping_). 1. Return _result_. @@ -1346,12 +1346,12 @@

FinalizationRegistry ( _cleanupCallback_ )

1. If NewTarget is *undefined*, throw a *TypeError* exception. 1. If IsCallable(_cleanupCallback_) is *false*, throw a *TypeError* exception. - 1. Let _finalizationRegistry_ be ? OrdinaryCreateFromConstructor(NewTarget, *"%FinalizationRegistry.prototype%"*, « [[Realm]], [[CleanupCallback]], [[Cells]], [[FinalizationRegistryAsyncContextSnapshot]] »). + 1. Let _finalizationRegistry_ be ? OrdinaryCreateFromConstructor(NewTarget, *"%FinalizationRegistry.prototype%"*, « [[Realm]], [[CleanupCallback]], [[Cells]], [[FinalizationRegistryAsyncContextMapping]] »). 1. Let _fn_ be the active function object. 1. Set _finalizationRegistry_.[[Realm]] to _fn_.[[Realm]]. 1. Set _finalizationRegistry_.[[CleanupCallback]] to HostMakeJobCallback(_cleanupCallback_). 1. Set _finalizationRegistry_.[[Cells]] to a new empty List. - 1. Set _finalizationRegistry_.[[FinalizationRegistryAsyncContextSnapshot]] to AsyncContextSnapshot(). + 1. Set _finalizationRegistry_.[[FinalizationRegistryAsyncContextMapping]] to AsyncContextSnapshot(). 1. Return _finalizationRegistry_.