Skip to content

Commit

Permalink
Do not close when iterator has already been requested closed
Browse files Browse the repository at this point in the history
  • Loading branch information
mhofman committed Dec 20, 2021
1 parent 9da23ec commit 1400ee6
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions spec.html
Original file line number Diff line number Diff line change
Expand Up @@ -42957,7 +42957,7 @@ <h1>%AsyncFromSyncIteratorPrototype%.next ( [ _value_ ] )</h1>
1. Else,
1. Let _result_ be IteratorNext(_syncIteratorRecord_).
1. IfAbruptRejectPromise(_result_, _promiseCapability_).
1. Return ! AsyncFromSyncIteratorContinuation(_result_, _promiseCapability_, _syncIteratorRecord_).
1. Return ! AsyncFromSyncIteratorContinuation(_result_, _promiseCapability_, _syncIteratorRecord_, *true*).
</emu-alg>
</emu-clause>

Expand All @@ -42983,7 +42983,7 @@ <h1>%AsyncFromSyncIteratorPrototype%.return ( [ _value_ ] )</h1>
1. If Type(_result_) is not Object, then
1. Perform ! Call(_promiseCapability_.[[Reject]], *undefined*, &laquo; a newly created *TypeError* object &raquo;).
1. Return _promiseCapability_.[[Promise]].
1. Return ! AsyncFromSyncIteratorContinuation(_result_, _promiseCapability_, _syncIteratorRecord_).
1. Return ! AsyncFromSyncIteratorContinuation(_result_, _promiseCapability_, _syncIteratorRecord_, *false*).
</emu-alg>
</emu-clause>

Expand All @@ -43009,7 +43009,7 @@ <h1>%AsyncFromSyncIteratorPrototype%.throw ( [ _value_ ] )</h1>
1. If Type(_result_) is not Object, then
1. Perform ! Call(_promiseCapability_.[[Reject]], *undefined*, &laquo; a newly created *TypeError* object &raquo;).
1. Return _promiseCapability_.[[Promise]].
1. Return ! AsyncFromSyncIteratorContinuation(_result_, _promiseCapability_, _syncIteratorRecord_).
1. Return ! AsyncFromSyncIteratorContinuation(_result_, _promiseCapability_, _syncIteratorRecord_, *true*).
</emu-alg>
</emu-clause>
</emu-clause>
Expand Down Expand Up @@ -43044,9 +43044,10 @@ <h1>Properties of Async-from-Sync Iterator Instances</h1>
<emu-clause id="sec-asyncfromsynciteratorcontinuation" type="abstract operation" oldids="sec-async-from-sync-iterator-value-unwrap-functions">
<h1>
AsyncFromSyncIteratorContinuation (
_result_: unknown,
_promiseCapability_: a PromiseCapability Record,
_syncIteratorRecord_: unknown,
_result_: unknown,
_promiseCapability_: a PromiseCapability Record,
_syncIteratorRecord_: unknown,
_closeOnRejection_: a Boolean,
)
</h1>
<dl class="header">
Expand All @@ -43058,14 +43059,14 @@ <h1>
1. Let _value_ be IteratorValue(_result_).
1. IfAbruptRejectPromise(_value_, _promiseCapability_).
1. Let _valueWrapper_ be PromiseResolve(%Promise%, _value_).
1. If _valueWrapper_ is an abrupt completion, and _done_ is not *true*, then
1. If _valueWrapper_ is an abrupt completion, _done_ is *false*, and _closeOnRejection_ is *true*, then
1. Set _valueWrapper_ to IteratorClose(_syncIteratorRecord_, _valueWrapper_).
1. IfAbruptRejectPromise(_valueWrapper_, _promiseCapability_).
1. Let _unwrap_ be a new Abstract Closure with parameters (_value_) that captures _done_ and performs the following steps when called:
1. Return ! CreateIterResultObject(_value_, _done_).
1. Let _onFulfilled_ be ! CreateBuiltinFunction(_unwrap_, 1, *""*, &laquo; &raquo;).
1. NOTE: _onFulfilled_ is used when processing the *"value"* property of an IteratorResult object in order to wait for its value if it is a promise and re-package the result in a new "unwrapped" IteratorResult object.
1. If _done_ is *true*, then
1. If _done_ is *true*, or if _closeOnRejection_ is *false*, then
1. Let _onRejected_ be *undefined*.
1. Else,
1. Let _closeIterator_ be a new Abstract Closure with parameters (_error_) that captures _syncIteratorRecord_ and performs the following steps when called:
Expand Down

0 comments on commit 1400ee6

Please sign in to comment.