Skip to content

Commit 25745fe

Browse files
gsathyaljharb
authored andcommitted
Normative: Lookup constructor.resolve only once (#1506)
1 parent 94c6f97 commit 25745fe

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

spec.html

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38347,6 +38347,8 @@ <h1>Runtime Semantics: PerformPromiseAll ( _iteratorRecord_, _constructor_, _res
3834738347
1. Assert: _resultCapability_ is a PromiseCapability Record.
3834838348
1. Let _values_ be a new empty List.
3834938349
1. Let _remainingElementsCount_ be a new Record { [[Value]]: 1 }.
38350+
1. Let _promiseResolve_ be ? Get(_constructor_, `"resolve"`).
38351+
1. If ! IsCallable(_promiseResolve_) is *false*, throw a *TypeError* exception.
3835038352
1. Let _index_ be 0.
3835138353
1. Repeat,
3835238354
1. Let _next_ be IteratorStep(_iteratorRecord_).
@@ -38363,7 +38365,7 @@ <h1>Runtime Semantics: PerformPromiseAll ( _iteratorRecord_, _constructor_, _res
3836338365
1. If _nextValue_ is an abrupt completion, set _iteratorRecord_.[[Done]] to *true*.
3836438366
1. ReturnIfAbrupt(_nextValue_).
3836538367
1. Append *undefined* to _values_.
38366-
1. Let _nextPromise_ be ? Invoke(_constructor_, `"resolve"`, &laquo; _nextValue_ &raquo;).
38368+
1. Let _nextPromise_ be ? Call(_promiseResolve_, _constructor_, &laquo; _nextValue_ &raquo;).
3836738369
1. Let _steps_ be the algorithm steps defined in <emu-xref href="#sec-promise.all-resolve-element-functions" title></emu-xref>.
3836838370
1. Let _resolveElement_ be CreateBuiltinFunction(_steps_, &laquo; [[AlreadyCalled]], [[Index]], [[Values]], [[Capability]], [[RemainingElements]] &raquo;).
3836938371
1. Set _resolveElement_.[[AlreadyCalled]] to a new Record { [[Value]]: *false* }.
@@ -38434,6 +38436,8 @@ <h1>Runtime Semantics: PerformPromiseRace ( _iteratorRecord_, _constructor_, _re
3843438436
<emu-alg>
3843538437
1. Assert: IsConstructor(_constructor_) is *true*.
3843638438
1. Assert: _resultCapability_ is a PromiseCapability Record.
38439+
1. Let _promiseResolve_ be ? Get(_constructor_, `"resolve"`).
38440+
1. If ! IsCallable(_promiseResolve_) is *false*, throw a *TypeError* exception.
3843738441
1. Repeat,
3843838442
1. Let _next_ be IteratorStep(_iteratorRecord_).
3843938443
1. If _next_ is an abrupt completion, set _iteratorRecord_.[[Done]] to *true*.
@@ -38444,7 +38448,7 @@ <h1>Runtime Semantics: PerformPromiseRace ( _iteratorRecord_, _constructor_, _re
3844438448
1. Let _nextValue_ be IteratorValue(_next_).
3844538449
1. If _nextValue_ is an abrupt completion, set _iteratorRecord_.[[Done]] to *true*.
3844638450
1. ReturnIfAbrupt(_nextValue_).
38447-
1. Let _nextPromise_ be ? Invoke(_constructor_, `"resolve"`, &laquo; _nextValue_ &raquo;).
38451+
1. Let _nextPromise_ be ? Call(_promiseResolve_, _constructor_, &laquo; _nextValue_ &raquo;).
3844838452
1. Perform ? Invoke(_nextPromise_, `"then"`, &laquo; _resultCapability_.[[Resolve]], _resultCapability_.[[Reject]] &raquo;).
3844938453
</emu-alg>
3845038454
</emu-clause>

0 commit comments

Comments
 (0)