| 1 |
// Copyright (C) 2015 the V8 project authors. All rights reserved. |
| 2 |
// This code is governed by the BSD license found in the LICENSE file. |
| 3 |
|
| 4 |
/*--- |
| 5 |
description: > |
| 6 |
`Promise.reject` invoked on a constructor value |
| 7 |
es6id: 25.4.4.5 |
| 8 |
info: | |
| 9 |
1. Let C be the this value. |
| 10 |
[...] |
| 11 |
3. Let promiseCapability be NewPromiseCapability(C). |
| 12 |
[...] |
| 13 |
7. Return promiseCapability.[[Promise]]. |
| 14 |
features: [class] |
| 15 |
---*/ |
| 16 |
|
| 17 |
var executor = null; |
| 18 |
var callCount = 0; |
| 19 |
|
| 20 |
class SubPromise extends Promise { |
| 21 |
constructor(a) { |
| 22 |
super(a); |
| 23 |
executor = a; |
| 24 |
callCount += 1; |
| 25 |
} |
| 26 |
} |
| 27 |
|
| 28 |
var instance = Promise.reject.call(SubPromise); |
| 29 |
|
| 30 |
assert.sameValue(instance.constructor, SubPromise); |
| 31 |
assert.sameValue(instance instanceof SubPromise, true); |
| 32 |
|
| 33 |
assert.sameValue(callCount, 1); |
| 34 |
assert.sameValue(typeof executor, 'function'); |