Debian Codegraph @

js/src/tests/test262/built-ins/Promise/exception-after-resolve-in-executor.js

raw
1 // |reftest| async
2 // Copyright (C) 2015 André Bargull. All rights reserved.
3 // This code is governed by the BSD license found in the LICENSE file.
4
5 /*---
6 es6id: 25.4.3.1
7 description: >
8 Already resolved promise is not rejected when executor throws an exception.
9 info: |
10 Promise ( executor )
11
12 ...
13 8. Let resolvingFunctions be CreateResolvingFunctions(promise).
14 9. Let completion be Call(executor, undefined, «resolvingFunctions.[[Resolve]], resolvingFunctions.[[Reject]]»).
15 10. If completion is an abrupt completion, then
16 a. Let status be Call(resolvingFunctions.[[Reject]], undefined, «completion.[[value]]»).
17 b. ReturnIfAbrupt(status).
18 ...
19 flags: [async]
20 ---*/
21
22 var thenable = {
23 then: function(resolve) {
24 resolve();
25 }
26 };
27
28 function executor(resolve, reject) {
29 resolve(thenable);
30 throw new Error("ignored exception");
31 }
32
33 new Promise(executor).then($DONE, $DONE);