| 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 <g id="g"/> | 2 <g id="g"/> |
| 3 <text x="50" y="50" id="log"/> | 3 <script id="script"> |
| 4 <script xlink:href="../../resources/js-test.js"></script> | 4 <script xlink:href="../../resources/js-test.js"></script> |
| 5 <script id="script"> | |
| 6 <![CDATA[ | 5 <![CDATA[ |
| 6 // This test relies on --enable-leak-detection to catch leaks |
| 7 | 7 |
| 8 var g = document.getElementById("g"); | 8 var g = document.getElementById("g"); |
| 9 | 9 |
| 10 function log(message) { | |
| 11 var logDiv = document.getElementById('log'); | |
| 12 logDiv.appendChild(document.createTextNode(message)); | |
| 13 } | |
| 14 | |
| 15 function createAnimatedRect() { | 10 function createAnimatedRect() { |
| 16 var rect = document.createElementNS("http://www.w3.org/2000/svg", "rect"); | 11 var rect = document.createElementNS("http://www.w3.org/2000/svg", "rect"); |
| 17 rect.setAttribute("width", 10); | 12 rect.setAttribute("width", 10); |
| 18 rect.setAttribute("height", 10); | 13 rect.setAttribute("height", 10); |
| 19 | 14 |
| 20 var anim = document.createElementNS("http://www.w3.org/2000/svg", "animate")
; | 15 var anim = document.createElementNS("http://www.w3.org/2000/svg", "animate")
; |
| 21 anim.setAttribute("attributeType", "XML"); | 16 anim.setAttribute("attributeType", "XML"); |
| 22 anim.setAttribute("attributeName", "x"); | 17 anim.setAttribute("attributeName", "x"); |
| 23 anim.setAttribute("from", "100"); | 18 anim.setAttribute("from", "100"); |
| 24 anim.setAttribute("to", "0"); | 19 anim.setAttribute("to", "0"); |
| 25 anim.setAttribute("begin", "0s"); | 20 anim.setAttribute("begin", "0s"); |
| 26 anim.setAttribute("dur", "10.0s"); | 21 anim.setAttribute("dur", "10.0s"); |
| 27 anim.setAttribute("repeatCount", 1); | 22 anim.setAttribute("repeatCount", 1); |
| 28 | 23 |
| 29 rect.appendChild(anim); | 24 rect.appendChild(anim); |
| 30 | 25 |
| 31 return rect; | 26 return rect; |
| 32 } | 27 } |
| 33 | 28 |
| 34 function cleanup() { | 29 function load() { |
| 35 // Collect garbage before recording starting live node count, in case there
are live elements from previous tests. | |
| 36 asyncGC(function() { | |
| 37 var originalLiveElements = internals.numberOfLiveNodes(); | |
| 38 | |
| 39 while (g.hasChildNodes()) | |
| 40 g.removeChild(g.lastChild); | |
| 41 asyncGC(function() { | |
| 42 var liveDelta = originalLiveElements - internals.numberOfLiveNodes()
- 200; | |
| 43 if (liveDelta == 0) | |
| 44 log("PASS"); | |
| 45 else | |
| 46 log("FAIL: " + liveDelta + " extra live node(s)"); | |
| 47 testRunner.notifyDone(); | |
| 48 }); | |
| 49 }); | |
| 50 } | |
| 51 | |
| 52 function startTest() { | |
| 53 for (var i = 0; i < 100; i++) | 30 for (var i = 0; i < 100; i++) |
| 54 g.appendChild(createAnimatedRect()); | 31 g.appendChild(createAnimatedRect()); |
| 55 | |
| 56 setTimeout(cleanup, 0); | |
| 57 } | |
| 58 | |
| 59 function load() { | |
| 60 if (window.testRunner && window.GCController && window.internals) { | |
| 61 testRunner.dumpAsText(); | |
| 62 testRunner.waitUntilDone(); | |
| 63 } else { | |
| 64 log("This test only works when run with the testRunner, GCController, an
d internals available."); | |
| 65 return; | |
| 66 } | |
| 67 | |
| 68 setTimeout(startTest, 0); | |
| 69 } | 32 } |
| 70 ]]> | 33 ]]> |
| 71 </script> | 34 </script> |
| 72 </svg> | 35 </svg> |
| OLD | NEW |