Debian Codegraph @

js/src/tests/test262/built-ins/Promise/reject-ignored-via-abrupt.js

raw
1 // |reftest| async
2 // Copyright (C) 2016 the V8 project authors. All rights reserved.
3 // This code is governed by the BSD license found in the LICENSE file.
4 /*---
5 description: Resolved promises ignore rejections through an abrupt completion
6 es6id: 25.4.3.1
7 info: |
8 [...]
9 9. Let completion be Call(executor, undefined,
10 «resolvingFunctions.[[Resolve]], resolvingFunctions.[[Reject]]»).
11 10. If completion is an abrupt completion, then
12 a. Let status be Call(resolvingFunctions.[[Reject]], undefined,
13 «completion.[[value]]»).
14 b. ReturnIfAbrupt(status).
15 11. Return promise.
16
17 25.4.1.3.1 Promise Reject Functions
18 [...]
19 3. Let alreadyResolved be the value of F's [[AlreadyResolved]] internal
20 slot.
21 4. If alreadyResolved.[[value]] is true, return undefined.
22 flags: [async]
23 ---*/
24
25 var thenable = new Promise(function() {});
26 var p = new Promise(function(resolve) {
27 resolve();
28 throw thenable;
29 });
30
31 p.then(function() {
32 $DONE();
33 }, function() {
34 $DONE('The promise should not be rejected.');
35 });