Debian Codegraph @

js/src/tests/test262/built-ins/Promise/all/resolve-ignores-late-rejection.js

raw
1 // |reftest| async
2 // Copyright (C) 2019 Leo Balter, 2020 Rick Waldron. All rights reserved.
3 // This code is governed by the BSD license found in the LICENSE file.
4
5 /*---
6 description: >
7 Resolved promises ignore rejections through immediate invocation of the
8 provided resolving function
9 esid: sec-promise.all
10 info: |
11 Let result be PerformPromiseAll(iteratorRecord, C, promiseCapability).
12
13 Runtime Semantics: PerformPromiseAll
14
15 Repeat
16 ...
17 r. Perform ? Invoke(nextPromise, "then", « resultCapability.[[Resolve]], rejectElement »).
18
19 flags: [async]
20 features: [arrow-function]
21 ---*/
22
23 var resolver = {
24 then(resolve) {
25 resolve(42);
26 }
27 };
28 var lateRejector = {
29 then(resolve, reject) {
30 resolve(33);
31 reject();
32 }
33 };
34
35 Promise.all([resolver, lateRejector])
36 .then(resolution => {
37 assert.sameValue(resolution[0], 42);
38 assert.sameValue(resolution[1], 33);
39 }).then($DONE, $DONE);