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