| OLD | NEW |
| 1 <svg id="svg" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/
1999/xlink" onload="load()"> | 1 <svg id="svg" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/
1999/xlink" onload="load()"> |
| 2 <defs> | 2 <defs> |
| 3 <rect id="rect" width="100" height="100" /> | 3 <rect id="rect" width="100" height="100" /> |
| 4 </defs> | 4 </defs> |
| 5 <g id="g"/> | 5 <g id="g"/> |
| 6 <text x="50" y="50" id="log"/> | 6 <text x="50" y="50" id="log"/> |
| 7 <script id="script"> | 7 <script id="script"> |
| 8 <![CDATA[ | 8 <![CDATA[ |
| 9 | 9 |
| 10 var g = document.getElementById("g"); | 10 var g = document.getElementById("g"); |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 // FIXME: Unclear why two calls to collect() are required, see crbug.com/307
614 | 37 // FIXME: Unclear why two calls to collect() are required, see crbug.com/307
614 |
| 38 GCController.collect(); | 38 GCController.collect(); |
| 39 GCController.collect(); | 39 GCController.collect(); |
| 40 var originalLiveElements = internals.numberOfLiveNodes(); | 40 var originalLiveElements = internals.numberOfLiveNodes(); |
| 41 | 41 |
| 42 while (g.hasChildNodes()) | 42 while (g.hasChildNodes()) |
| 43 g.removeChild(g.lastChild); | 43 g.removeChild(g.lastChild); |
| 44 | 44 |
| 45 GCController.collect(); | 45 GCController.collect(); |
| 46 | 46 |
| 47 // FIXME: Why 400 and not 200? | 47 // This is 400 instead of 200 as it creates shadow tree elements. |
| 48 var liveDelta = originalLiveElements - internals.numberOfLiveNodes() - 400; | 48 var liveDelta = originalLiveElements - internals.numberOfLiveNodes() - 400; |
| 49 if (liveDelta == 0) | 49 if (liveDelta <= 0) |
| 50 log("PASS"); | 50 log("PASS"); |
| 51 else | 51 else |
| 52 log("FAIL: " + liveDelta + " extra live node(s)"); | 52 log("FAIL: " + liveDelta + " extra live node(s)"); |
| 53 | 53 |
| 54 testRunner.notifyDone(); | 54 testRunner.notifyDone(); |
| 55 } | 55 } |
| 56 | 56 |
| 57 function startTest() { | 57 function startTest() { |
| 58 for (var i = 0; i < 100; i++) | 58 for (var i = 0; i < 100; i++) |
| 59 g.appendChild(createAnimatedRectInstance()); | 59 g.appendChild(createAnimatedRectInstance()); |
| 60 | 60 |
| 61 setTimeout(cleanup, 0); | 61 setTimeout(cleanup, 0); |
| 62 } | 62 } |
| 63 | 63 |
| 64 function load() { | 64 function load() { |
| 65 if (window.testRunner && window.GCController && window.internals) { | 65 if (window.testRunner && window.GCController && window.internals) { |
| 66 testRunner.dumpAsText(); | 66 testRunner.dumpAsText(); |
| 67 testRunner.waitUntilDone(); | 67 testRunner.waitUntilDone(); |
| 68 } else { | 68 } else { |
| 69 log("This test only works when run with the testRunner, GCController, an
d internals available."); | 69 log("This test only works when run with the testRunner, GCController, an
d internals available."); |
| 70 return; | 70 return; |
| 71 } | 71 } |
| 72 | 72 |
| 73 setTimeout(startTest, 0); | 73 setTimeout(startTest, 0); |
| 74 } | 74 } |
| 75 ]]> | 75 ]]> |
| 76 </script> | 76 </script> |
| 77 </svg> | 77 </svg> |
| OLD | NEW |