unnaffected-by-poisoned-cleanupCallback.js (1442B)
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 Normal completion even if the cleanupCallback fn is poisoned 8 info: | 9 FinalizationRegistry ( cleanupCallback ) 10 11 ... 12 3. Let finalizationRegistry be ? OrdinaryCreateFromConstructor(NewTarget, "%FinalizationRegistryPrototype%", « [[Realm]], [[CleanupCallback]], [[Cells]], [[IsFinalizationRegistryCleanupJobActive]] »). 13 ... 14 9. Return finalizationRegistry. 15 features: [FinalizationRegistry] 16 ---*/ 17 18 var cleanupCallback = function() { throw new Test262Error('should not throw yet'); }; 19 var finalizationRegistry = new FinalizationRegistry(cleanupCallback); 20 21 assert.sameValue(Object.getPrototypeOf(finalizationRegistry), FinalizationRegistry.prototype); 22 assert.notSameValue(finalizationRegistry, cleanupCallback, 'does not return the same function'); 23 assert.sameValue(finalizationRegistry instanceof FinalizationRegistry, true, 'instanceof'); 24 25 for (let key of Object.getOwnPropertyNames(finalizationRegistry)) { 26 assert(false, `should not set any own named properties: ${key}`); 27 } 28 29 for (let key of Object.getOwnPropertySymbols(finalizationRegistry)) { 30 assert(false, `should not set any own symbol properties: ${String(key)}`); 31 } 32 33 assert.sameValue(Object.getPrototypeOf(finalizationRegistry), FinalizationRegistry.prototype); 34 35 reportCompare(0, 0);