blob: 5e33baf2048102a2a9378d60b18a9e38ed40ac4f [file] [log] [blame]
<!DOCTYPE html>
<html>
<body>
<p>This tests allocating 1000 elements and triggering GC. GC should collect some elements.</p>
<script>
if (!window.internals)
document.write('This test requires internals');
else {
testRunner.dumpAsText();
const initialNodeCount = internals.numberOfLiveNodes();
const testCount = 1000;
(() => {
for (let i = 0; i < testCount; ++i)
document.createElement('div').attributeStyleMap;
})();
if (window.GCController)
GCController.collect();
const nodeCountDiff = internals.numberOfLiveNodes() - initialNodeCount;
document.write(nodeCountDiff < testCount / 1.5 ? 'PASS' : `FAIL - ${nodeCountDiff} nodes alive after triggering GC`);
}
</script>
</body>
</html>