| 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: Abrupt completion returned by "reject" capability |
| 5 |
esid: sec-promise.reject |
| 6 |
es6id: 25.4.4.4 |
| 7 |
info: | |
| 8 |
1. Let C be the this value. |
| 9 |
[...] |
| 10 |
3. Let promiseCapability be ? NewPromiseCapability(C). |
| 11 |
4. Perform ? Call(promiseCapability.[[Reject]], undefined, « r »). |
| 12 |
|
| 13 |
25.4.1.5 NewPromiseCapability |
| 14 |
[...] |
| 15 |
6. Let promise be Construct(C, «executor»). |
| 16 |
7. ReturnIfAbrupt(promise). |
| 17 |
---*/ |
| 18 |
|
| 19 |
var P = function(executor) { |
| 20 |
return new Promise(function() { |
| 21 |
executor( |
| 22 |
function() {}, |
| 23 |
function() { |
| 24 |
throw new Test262Error(); |
| 25 |
} |
| 26 |
); |
| 27 |
}); |
| 28 |
}; |
| 29 |
|
| 30 |
assert.throws(Test262Error, function() { |
| 31 |
Promise.reject.call(P); |
| 32 |
}); |