bug-1749298.js (492B)
1 // Test that a finalization registry target that is reachable from its global 2 // does not keep the global alive indefinitely. 3 4 let global = newGlobal({newCompartment: true}); 5 global.eval(` 6 this.target = {}; // Target is reachable from global. 7 this.registry = new FinalizationRegistry(() => assertEq(0, 1)); 8 registry.register(target, 'held'); 9 this.finalizeObserver = makeFinalizeObserver(); 10 `); 11 12 assertEq(finalizeCount(), 0); 13 14 global = undefined; 15 gc(); 16 17 assertEq(finalizeCount(), 1);