Debian Codegraph @

js/src/tests/test262/built-ins/Promise/any/species-get-error.js

raw
1 // Copyright (C) 2020 Rick Waldron. All rights reserved.
2 // This code is governed by the BSD license found in the LICENSE file.
3
4 /*---
5 description: >
6 Promise.any() does not access a `Symbol.species` property of the `this` value
7 info: |
8 Let C be the this value.
9 Let promiseCapability be ? NewPromiseCapability(C).
10 ...
11
12 features: [Promise.any, Symbol.species]
13 ---*/
14 function C(executor) {
15 executor(() => {}, () => {});
16 }
17
18 Object.defineProperty(C, Symbol.species, {
19 get() {
20 throw new Test262Error("Getter for Symbol.species called");
21 }
22 });
23
24 C.resolve = function() {
25 throw new Test262Error("C.resolve called unexpectedly");
26 };
27
28 Promise.any.call(C, [1]);
29
30 reportCompare(0, 0);