Debian Codegraph @

js/src/tests/test262/built-ins/FinalizationRegistry/undefined-newtarget-throws.js

raw
1 // |reftest| skip-if(!this.hasOwnProperty('FinalizationRegistry')) -- FinalizationRegistry is not enabled unconditionally
2 // Copyright (C) 2019 Leo Balter. All rights reserved.
3 // This code is governed by the BSD license found in the LICENSE file.
4
5 /*---
6 esid: sec-finalization-registry-target
7 description: >
8 Throws a TypeError if NewTarget is undefined.
9 info: |
10 FinalizationRegistry ( cleanupCallback )
11
12 1. If NewTarget is undefined, throw a TypeError exception.
13 2. If IsCallable(cleanupCallback) is false, throw a TypeError exception.
14 ...
15 features: [FinalizationRegistry]
16 ---*/
17
18 assert.sameValue(
19 typeof FinalizationRegistry, 'function',
20 'typeof FinalizationRegistry is function'
21 );
22
23 assert.throws(TypeError, function() {
24 FinalizationRegistry();
25 });
26
27 assert.throws(TypeError, function() {
28 FinalizationRegistry(function() {});
29 });
30
31 reportCompare(0, 0);