Revision control

1
<!DOCTYPE html>
2
<html>
3
<body>
4
<p>This tests allocating 1000 elements and triggering GC. GC should collect some elements.</p>
5
<script>
6
7
if (!window.internals)
8
document.write('This test requires internals');
9
else {
10
testRunner.dumpAsText();
11
12
const initialNodeCount = internals.numberOfLiveNodes();
13
14
const testCount = 1000;
15
(() => {
16
for (let i = 0; i < testCount; ++i)
17
document.createElement('div').attributeStyleMap;
18
})();
19
20
if (window.GCController)
21
GCController.collect();
22
23
const nodeCountDiff = internals.numberOfLiveNodes() - initialNodeCount;
24
document.write(nodeCountDiff < testCount / 1.5 ? 'PASS' : `FAIL - ${nodeCountDiff} nodes alive after triggering GC`);
25
}
26
27
</script>
28
</body>
29
</html>