| 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 xlink:href="../../resources/js-test.js"></script> |
| 7 <script id="script"> | 8 <script id="script"> |
| 8 <![CDATA[ | 9 <![CDATA[ |
| 9 | 10 |
| 10 var g = document.getElementById("g"); | 11 var g = document.getElementById("g"); |
| 11 | 12 |
| 12 function log(message) { | 13 function log(message) { |
| 13 var logDiv = document.getElementById('log'); | 14 var logDiv = document.getElementById('log'); |
| 14 logDiv.appendChild(document.createTextNode(message)); | 15 logDiv.appendChild(document.createTextNode(message)); |
| 15 } | 16 } |
| 16 | 17 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 27 anim.setAttribute("dur", "10.0s"); | 28 anim.setAttribute("dur", "10.0s"); |
| 28 anim.setAttribute("repeatCount", 1); | 29 anim.setAttribute("repeatCount", 1); |
| 29 | 30 |
| 30 use.appendChild(anim); | 31 use.appendChild(anim); |
| 31 | 32 |
| 32 return use; | 33 return use; |
| 33 } | 34 } |
| 34 | 35 |
| 35 function cleanup() { | 36 function cleanup() { |
| 36 // Collect garbage before recording starting live node count, in case there
are live elements from previous tests. | 37 // Collect garbage before recording starting live node count, in case there
are live elements from previous tests. |
| 37 GCController.collectAll(); | 38 collectGarbage(function() { |
| 38 var originalLiveElements = internals.numberOfLiveNodes(); | 39 var originalLiveElements = internals.numberOfLiveNodes(); |
| 39 | 40 |
| 40 while (g.hasChildNodes()) | 41 while (g.hasChildNodes()) |
| 41 g.removeChild(g.lastChild); | 42 g.removeChild(g.lastChild); |
| 42 | 43 |
| 43 GCController.collectAll(); | 44 collectGarbage(function() { |
| 45 // This is 400 instead of 200 as it creates shadow tree elements. |
| 46 var liveDelta = originalLiveElements - internals.numberOfLiveNodes()
- 400; |
| 47 if (liveDelta == 0) |
| 48 log("PASS"); |
| 49 else |
| 50 log("FAIL: " + liveDelta + " extra live node(s)"); |
| 44 | 51 |
| 45 // This is 400 instead of 200 as it creates shadow tree elements. | 52 testRunner.notifyDone(); |
| 46 var liveDelta = originalLiveElements - internals.numberOfLiveNodes() - 400; | 53 }); |
| 47 if (liveDelta == 0) | 54 }); |
| 48 log("PASS"); | |
| 49 else | |
| 50 log("FAIL: " + liveDelta + " extra live node(s)"); | |
| 51 | |
| 52 testRunner.notifyDone(); | |
| 53 } | 55 } |
| 54 | 56 |
| 55 function startTest() { | 57 function startTest() { |
| 56 // Hold a reference to rect.x.baseVal on the root instance. | 58 // Hold a reference to rect.x.baseVal on the root instance. |
| 57 xBaseVal = document.getElementById("rect").x.baseVal; | 59 xBaseVal = document.getElementById("rect").x.baseVal; |
| 58 | 60 |
| 59 for (var i = 0; i < 100; i++) | 61 for (var i = 0; i < 100; i++) |
| 60 g.appendChild(createAnimatedRectInstance()); | 62 g.appendChild(createAnimatedRectInstance()); |
| 61 | 63 |
| 62 setTimeout(cleanup, 0); | 64 setTimeout(cleanup, 0); |
| 63 } | 65 } |
| 64 | 66 |
| 65 function load() { | 67 function load() { |
| 66 if (window.testRunner && window.GCController && window.internals) { | 68 if (window.testRunner && window.GCController && window.internals) { |
| 67 testRunner.dumpAsText(); | 69 testRunner.dumpAsText(); |
| 68 testRunner.waitUntilDone(); | 70 testRunner.waitUntilDone(); |
| 69 } else { | 71 } else { |
| 70 log("This test only works when run with the testRunner, GCController, an
d internals available."); | 72 log("This test only works when run with the testRunner, GCController, an
d internals available."); |
| 71 return; | 73 return; |
| 72 } | 74 } |
| 73 | 75 |
| 74 setTimeout(startTest, 0); | 76 setTimeout(startTest, 0); |
| 75 } | 77 } |
| 76 ]]> | 78 ]]> |
| 77 </script> | 79 </script> |
| 78 </svg> | 80 </svg> |
| OLD | NEW |