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