Debian Codegraph @

tests/auto/qml/ecmascripttests/test262/test/built-ins/Promise/all/reject-ignored-immed.js

raw
1 // Copyright (C) 2016 the V8 project authors. All rights reserved.
2 // This code is governed by the BSD license found in the LICENSE file.
3 /*---
4 description: >
5 Resolved promises ignore rejections through immediate invocation of the
6 provided resolving function
7 es6id: 25.4.4.1
8 info: |
9 [...]
10 6. Let promiseCapability be NewPromiseCapability(C).
11 [...]
12 11. Let result be PerformPromiseAll(iteratorRecord, promiseCapability, C).
13 [...]
14
15 25.4.4.1.1 Runtime Semantics: PerformPromiseAll
16 [...]
17 6. Repeat
18 [...]
19 r. Let result be Invoke(nextPromise, "then", resolveElement,
20 promiseCapability.[[Reject]]»).
21
22 25.4.1.3.1 Promise Reject Functions
23 [...]
24 2. Let promise be the value of F's [[Promise]] internal slot.
25 3. Let alreadyResolved be the value of F's [[AlreadyResolved]] internal
26 slot.
27 4. If alreadyResolved.[[value]] is true, return undefined.
28 flags: [async]
29 ---*/
30
31 var fulfiller = {
32 then: function(resolve) {
33 resolve();
34 }
35 };
36 var lateRejector = {
37 then: function(resolve, reject) {
38 resolve();
39 reject();
40 }
41 };
42
43 Promise.all([fulfiller, lateRejector])
44 .then(function() {
45 $DONE();
46 }, function() {
47 $DONE('The promise should not be rejected.');
48 });