| 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: Rejecting through deferred invocation of the provided resolving function |
| 5 |
es6id: 25.4.4.1 |
| 6 |
info: | |
| 7 |
[...] |
| 8 |
6. Let promiseCapability be NewPromiseCapability(C). |
| 9 |
[...] |
| 10 |
11. Let result be PerformPromiseAll(iteratorRecord, promiseCapability, C). |
| 11 |
[...] |
| 12 |
|
| 13 |
25.4.4.1.1 Runtime Semantics: PerformPromiseAll |
| 14 |
[...] |
| 15 |
6. Repeat |
| 16 |
[...] |
| 17 |
r. Let result be Invoke(nextPromise, "then", resolveElement, |
| 18 |
promiseCapability.[[Reject]]»). |
| 19 |
|
| 20 |
25.4.1.3.1 Promise Reject Functions |
| 21 |
[...] |
| 22 |
6. Return RejectPromise(promise, reason). |
| 23 |
flags: [async] |
| 24 |
---*/ |
| 25 |
|
| 26 |
var thenable = { |
| 27 |
then: function(_, reject) { |
| 28 |
new Promise(function(resolve) { |
| 29 |
resolve(); |
| 30 |
}) |
| 31 |
.then(function() { |
| 32 |
reject(); |
| 33 |
}); |
| 34 |
} |
| 35 |
}; |
| 36 |
|
| 37 |
Promise.all([thenable]) |
| 38 |
.then(function() { |
| 39 |
$DONE('The promise should not be fulfilled.'); |
| 40 |
}, function(x) { |
| 41 |
$DONE(); |
| 42 |
}); |