Skip to content

Commit

Permalink
Editorial: unify term async context mapping (#99)
Browse files Browse the repository at this point in the history
  • Loading branch information
legendecas authored Sep 4, 2024
1 parent eadad3d commit 0f64be9
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions spec.html
Original file line number Diff line number Diff line change
Expand Up @@ -140,13 +140,13 @@ <h1>
</dl>
<emu-alg>
1. <del>Assert: _finalizationRegistry_ has [[Cells]] and [[CleanupCallback]] internal slots.</del>
1. <ins>Assert: _finalizationRegistry_ has [[Cells]], [[CleanupCallback]], and [[FinalizationRegistryAsyncContextSnapshot]] internal slots.</ins>
1. <ins>Assert: _finalizationRegistry_ has [[Cells]], [[CleanupCallback]], and [[FinalizationRegistryAsyncContextMapping]] internal slots.</ins>
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. <del>Perform ? HostCallJobCallback(_callback_, *undefined*, « _cell_.[[HeldValue]] »).</del>
1. <ins>Let _previousContextMapping_ be AsyncContextSwap(_finalizationRegistry_.[[FinalizationRegistryAsyncContextSnapshot]]).</ins>
1. <ins>Let _previousContextMapping_ be AsyncContextSwap(_finalizationRegistry_.[[FinalizationRegistryAsyncContextMapping]]).</ins>
1. <ins>Let _result_ be Completion(HostCallJobCallback(_callback_, *undefined*, « _cell_.[[HeldValue]] »)).</ins>
1. <ins>AsyncContextSwap(_previousContextMapping_).</ins>
1. <ins>Perform ? _result_.</ins>
Expand Down Expand Up @@ -316,7 +316,7 @@ <h1>PromiseReaction Records</h1>
</tr>
<tr>
<td>
<ins>[[PromiseAsyncContextSnapshot]]</ins>
<ins>[[PromiseAsyncContextMapping]]</ins>
</td>
<td>
<ins>a List of Async Context Mapping Records</ins>
Expand Down Expand Up @@ -377,7 +377,7 @@ <h1>
1. Let _promiseCapability_ be _reaction_.[[Capability]].
1. Let _type_ be _reaction_.[[Type]].
1. Let _handler_ be _reaction_.[[Handler]].
1. <ins>Let _previousContextMapping_ be AsyncContextSwap(_reaction_.[[PromiseAsyncContextSnapshot]]).</ins>
1. <ins>Let _previousContextMapping_ be AsyncContextSwap(_reaction_.[[PromiseAsyncContextMapping]]).</ins>
1. If _handler_ is ~empty~, then
1. If _type_ is ~fulfill~, then
1. let _handlerResult_ be NormalCompletion(_argument_).
Expand Down Expand Up @@ -420,10 +420,10 @@ <h1>
<dl class="header">
</dl>
<emu-alg>
1. <ins>Let _snapshot_ be AsyncContextSnapshot().</ins>
1. Let _job_ be a new Job Abstract Closure with no parameters that captures _promiseToResolve_, _thenable_, _then_, <ins>and _snapshot_</ins> and performs the following steps when called:
1. <ins>Let _mapping_ be AsyncContextSnapshot().</ins>
1. Let _job_ be a new Job Abstract Closure with no parameters that captures _promiseToResolve_, _thenable_, _then_, <ins>and _mapping_</ins> and performs the following steps when called:
1. Let _resolvingFunctions_ be CreateResolvingFunctions(_promiseToResolve_).
1. <ins>Let _previousContextMapping_ be AsyncContextSwap(_snapshot_).</ins>
1. <ins>Let _previousContextMapping_ be AsyncContextSwap(_mapping_).</ins>
1. Let _thenCallResult_ be Completion(HostCallJobCallback(_then_, _thenable_, « _resolvingFunctions_.[[Resolve]], _resolvingFunctions_.[[Reject]] »)).
1. If _thenCallResult_ is an abrupt completion, then
1. <del>Return ? Call(_resolvingFunctions_.[[Reject]], *undefined*, « _thenCallResult_.[[Value]] »).</del>
Expand Down Expand Up @@ -490,9 +490,9 @@ <h1>
1. Let _onRejectedJobCallback_ be ~empty~.
1. Else,
1. Let _onRejectedJobCallback_ be HostMakeJobCallback(_onRejected_).
1. <ins>Let _snapshot_ be AsyncContextSnapshot().</ins>
1. Let _fulfillReaction_ be the PromiseReaction Record { [[Capability]]: _resultCapability_, [[Type]]: ~fulfill~, [[Handler]]: _onFulfilledJobCallback_, <ins>[[PromiseAsyncContextSnapshot]]: _snapshot_</ins> }.
1. Let _rejectReaction_ be the PromiseReaction Record { [[Capability]]: _resultCapability_, [[Type]]: ~reject~, [[Handler]]: _onRejectedJobCallback_, <ins>[[PromiseAsyncContextSnapshot]]: _snapshot_</ins>}.
1. <ins>Let _mapping_ be AsyncContextSnapshot().</ins>
1. Let _fulfillReaction_ be the PromiseReaction Record { [[Capability]]: _resultCapability_, [[Type]]: ~fulfill~, [[Handler]]: _onFulfilledJobCallback_, <ins>[[PromiseAsyncContextMapping]]: _mapping_</ins> }.
1. Let _rejectReaction_ be the PromiseReaction Record { [[Capability]]: _resultCapability_, [[Type]]: ~reject~, [[Handler]]: _onRejectedJobCallback_, <ins>[[PromiseAsyncContextMapping]]: _mapping_</ins>}.
1. If _promise_.[[PromiseState]] is ~pending~, then
1. Append _fulfillReaction_ to _promise_.[[PromiseFulfillReactions]].
1. Append _rejectReaction_ to _promise_.[[PromiseRejectReactions]].
Expand Down Expand Up @@ -1063,10 +1063,10 @@ <h1>AsyncContext.Snapshot.wrap ( _fn_ )</h1>

<emu-alg>
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_.
Expand Down Expand Up @@ -1346,12 +1346,12 @@ <h1>FinalizationRegistry ( _cleanupCallback_ )</h1>
<emu-alg>
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. <ins>Set _finalizationRegistry_.[[FinalizationRegistryAsyncContextSnapshot]] to AsyncContextSnapshot().</ins>
1. <ins>Set _finalizationRegistry_.[[FinalizationRegistryAsyncContextMapping]] to AsyncContextSnapshot().</ins>
1. Return _finalizationRegistry_.
</emu-alg>
</emu-clause>
Expand Down

0 comments on commit 0f64be9

Please sign in to comment.