OLD | NEW |
1 <svg id="svg" xmlns="http://www.w3.org/2000/svg" onload="load()"> | 1 <svg id="svg" xmlns="http://www.w3.org/2000/svg" onload="load()"> |
2 <g id="g"/> | 2 <g id="g"/> |
3 <text x="50" y="50" id="log"/> | 3 <text x="50" y="50" id="log"/> |
4 <script id="script"> | 4 <script id="script"> |
5 <![CDATA[ | 5 <![CDATA[ |
6 | 6 |
7 var g = document.getElementById("g"); | 7 var g = document.getElementById("g"); |
8 | 8 |
9 function log(message) { | 9 function log(message) { |
10 var logDiv = document.getElementById('log'); | 10 var logDiv = document.getElementById('log'); |
(...skipping 25 matching lines...) Expand all Loading... |
36 GCController.collect(); | 36 GCController.collect(); |
37 GCController.collect(); | 37 GCController.collect(); |
38 var originalLiveElements = internals.numberOfLiveNodes(); | 38 var originalLiveElements = internals.numberOfLiveNodes(); |
39 | 39 |
40 while (g.hasChildNodes()) | 40 while (g.hasChildNodes()) |
41 g.removeChild(g.lastChild); | 41 g.removeChild(g.lastChild); |
42 | 42 |
43 GCController.collect(); | 43 GCController.collect(); |
44 | 44 |
45 var liveDelta = originalLiveElements - internals.numberOfLiveNodes() - 200; | 45 var liveDelta = originalLiveElements - internals.numberOfLiveNodes() - 200; |
46 if (liveDelta == 0) | 46 if (liveDelta <= 0) |
47 log("PASS"); | 47 log("PASS"); |
48 else | 48 else |
49 log("FAIL: " + liveDelta + " extra live node(s)"); | 49 log("FAIL: " + liveDelta + " extra live node(s)"); |
50 | 50 |
51 testRunner.notifyDone(); | 51 testRunner.notifyDone(); |
52 } | 52 } |
53 | 53 |
54 function startTest() { | 54 function startTest() { |
55 for (var i = 0; i < 100; i++) | 55 for (var i = 0; i < 100; i++) |
56 g.appendChild(createAnimatedRect()); | 56 g.appendChild(createAnimatedRect()); |
57 | 57 |
58 setTimeout(cleanup, 0); | 58 setTimeout(cleanup, 0); |
59 } | 59 } |
60 | 60 |
61 function load() { | 61 function load() { |
62 if (window.testRunner && window.GCController && window.internals) { | 62 if (window.testRunner && window.GCController && window.internals) { |
63 testRunner.dumpAsText(); | 63 testRunner.dumpAsText(); |
64 testRunner.waitUntilDone(); | 64 testRunner.waitUntilDone(); |
65 } else { | 65 } else { |
66 log("This test only works when run with the testRunner, GCController, an
d internals available."); | 66 log("This test only works when run with the testRunner, GCController, an
d internals available."); |
67 return; | 67 return; |
68 } | 68 } |
69 | 69 |
70 setTimeout(startTest, 0); | 70 setTimeout(startTest, 0); |
71 } | 71 } |
72 ]]> | 72 ]]> |
73 </script> | 73 </script> |
74 </svg> | 74 </svg> |
OLD | NEW |