You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
1. [declared="remainingElementsCount"] NOTE: _remainingElementsCount_ starts at 1 instead of 0 to ensure _resultCapability_.[[Reject]] is only called once, even in the presence of a misbehaving *"then"* which calls the passed callback before the input iterator is exhausted.
49466
49467
1. Let _remainingElementsCount_ be the Record { [[Value]]: 1 }.
49467
49468
1. Let _index_ be 0.
49468
49469
1. Repeat,
49469
49470
1. Let _next_ be ? IteratorStepValue(_iteratorRecord_).
49470
49471
1. If _next_ is ~done~, then
49471
49472
1. Set _remainingElementsCount_.[[Value]] to _remainingElementsCount_.[[Value]] - 1.
49472
49473
1. If _remainingElementsCount_.[[Value]] = 0, then
49473
-
1. Let _error_ be a newly created *AggregateError* object.
1. Let _nextPromise_ be ? Call(_promiseResolve_, _constructor_, « _next_ »).
49479
-
1. Let _stepsRejected_ be the algorithm steps defined in <emu-xref href="#sec-promise.any-reject-element-functions" title></emu-xref>.
49480
-
1. Let _lengthRejected_ be the number of non-optional parameters of the function definition in <emu-xref href="#sec-promise.any-reject-element-functions" title></emu-xref>.
49481
-
1. Let _onRejected_ be CreateBuiltinFunction(_stepsRejected_, _lengthRejected_, *""*, « [[AlreadyCalled]], [[Index]], [[Errors]], [[Capability]], [[RemainingElements]] »).
49480
+
1. Let _rejectedSteps_ be a new Abstract Closure with parameters (_error_) that captures _errors_, _resultCapability_, and _remainingElementsCount_ and performs the following steps when called:
49481
+
1. Let _F_ be the active function object.
49482
+
1. If _F_.[[AlreadyCalled]] is *true*, return *undefined*.
49483
+
1. Set _F_.[[AlreadyCalled]] to *true*.
49484
+
1. Set _errors_[_F_.[[Index]]] to _error_.
49485
+
1. Set _remainingElementsCount_.[[Value]] to _remainingElementsCount_.[[Value]] - 1.
49486
+
1. If _remainingElementsCount_.[[Value]] = 0, then
49487
+
1. Let _aggregateError_ be a newly created *AggregateError* object.
<p>A `Promise.any` reject element function is an anonymous built-in function that is used to reject a specific `Promise.any` element. Each `Promise.any` reject element function has [[Index]], [[Errors]], [[Capability]], [[RemainingElements]], and [[AlreadyCalled]] internal slots.</p>
49496
-
<p>When a `Promise.any` reject element function is called with argument _x_, the following steps are taken:</p>
49497
-
<emu-alg>
49498
-
1. Let _F_ be the active function object.
49499
-
1. If _F_.[[AlreadyCalled]] is *true*, return *undefined*.
49500
-
1. Set _F_.[[AlreadyCalled]] to *true*.
49501
-
1. Let _index_ be _F_.[[Index]].
49502
-
1. Let _errors_ be _F_.[[Errors]].
49503
-
1. Let _promiseCapability_ be _F_.[[Capability]].
49504
-
1. Let _remainingElementsCount_ be _F_.[[RemainingElements]].
49505
-
1. Set _errors_[_index_] to _x_.
49506
-
1. Set _remainingElementsCount_.[[Value]] to _remainingElementsCount_.[[Value]] - 1.
49507
-
1. If _remainingElementsCount_.[[Value]] = 0, then
49508
-
1. Let _error_ be a newly created *AggregateError* object.
0 commit comments