Debian Codegraph @

tests/auto/qml/ecmascripttests/test262/test/built-ins/Promise/resolve-ignored-via-fn-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 Rejected promises ignore resolution after immediate invocation of the
6 provided reject function
7 esid: sec-promise-executor
8 es6id: 25.4.3.3
9 info: |
10 [...]
11 9. Let completion be Call(executor, undefined,
12 «resolvingFunctions.[[Resolve]], resolvingFunctions.[[Reject]]»).
13 10. If completion is an abrupt completion, then
14 [...]
15 11. Return promise.
16
17 25.4.1.3.2 Promise Resolve Functions
18
19 [...]
20 3. Let alreadyResolved be F.[[AlreadyResolved]].
21 4. If alreadyResolved.[[Value]] is true, return undefined.
22 flags: [async]
23 ---*/
24
25 var returnValue = null;
26 var thenable = new Promise(function() {});
27 var p = new Promise(function(resolve, reject) {
28 reject(thenable);
29 returnValue = resolve();
30 });
31
32 assert.sameValue(returnValue, undefined, '"reject" function return value');
33
34 p.then(function() {
35 $DONE('The promise should not be fulfilled.');
36 }, function() {
37 $DONE();
38 });