Debian Codegraph @

tests/auto/qml/ecmascripttests/test262/test/built-ins/Promise/reject-ignored-via-abrupt.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: Resolved promises ignore rejections through an abrupt completion
5 es6id: 25.4.3.1
6 info: |
7 [...]
8 9. Let completion be Call(executor, undefined,
9 «resolvingFunctions.[[Resolve]], resolvingFunctions.[[Reject]]»).
10 10. If completion is an abrupt completion, then
11 a. Let status be Call(resolvingFunctions.[[Reject]], undefined,
12 «completion.[[value]]»).
13 b. ReturnIfAbrupt(status).
14 11. Return promise.
15
16 25.4.1.3.1 Promise Reject Functions
17 [...]
18 3. Let alreadyResolved be the value of F's [[AlreadyResolved]] internal
19 slot.
20 4. If alreadyResolved.[[value]] is true, return undefined.
21 flags: [async]
22 ---*/
23
24 var thenable = new Promise(function() {});
25 var p = new Promise(function(resolve) {
26 resolve();
27 throw thenable;
28 });
29
30 p.then(function() {
31 $DONE();
32 }, function() {
33 $DONE('The promise should not be rejected.');
34 });