Skip to content

Commit

Permalink
Close iterator if not done, regardless of action type
Browse files Browse the repository at this point in the history
Close iterator on buggy promise value
  • Loading branch information
mhofman committed Dec 17, 2021
1 parent 1937798 commit 9da23ec
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 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_, *true*).
1. Return ! AsyncFromSyncIteratorContinuation(_result_, _promiseCapability_, _syncIteratorRecord_).
</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_, *false*).
1. Return ! AsyncFromSyncIteratorContinuation(_result_, _promiseCapability_, _syncIteratorRecord_).
</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_, *false*).
1. Return ! AsyncFromSyncIteratorContinuation(_result_, _promiseCapability_, _syncIteratorRecord_).
</emu-alg>
</emu-clause>
</emu-clause>
Expand Down Expand Up @@ -43047,7 +43047,6 @@ <h1>
_result_: unknown,
_promiseCapability_: a PromiseCapability Record,
_syncIteratorRecord_: unknown,
_closeIteratorOnRejection_: a Boolean,
)
</h1>
<dl class="header">
Expand All @@ -43059,12 +43058,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. 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 _closeIteratorOnRejection_ is *false*, or if _done_ is *true*, then
1. If _done_ is *true*, 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 9da23ec

Please sign in to comment.