| OLD | NEW |
| 1 <html><head> | 1 <html><head> |
| 2 <script> | 2 <script> |
| 3 if (window.testRunner) | 3 if (window.testRunner) |
| 4 testRunner.dumpAsText(); | 4 testRunner.dumpAsText(); |
| 5 | 5 |
| 6 var types = [ XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, | 6 var types = [ XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, |
| 7 XPathResult.ORDERED_NODE_SNAPSHOT_TYPE ]; | 7 XPathResult.ORDERED_NODE_SNAPSHOT_TYPE ]; |
| 8 | 8 |
| 9 function gc() | 9 function gc() |
| 10 { | 10 { |
| 11 if (window.GCController) | 11 if (window.GCController) |
| 12 return GCController.collect(); | 12 return GCController.collect(); |
| 13 | 13 |
| 14 for (var i = 0; i < 10000; i++) { // > force garbage collection (FF
requires about 9K allocations before a collect) | 14 for (var i = 0; i < 10000; i++) { // > force garbage collection (FF
requires about 9K allocations before a collect) |
| 15 var s = new String("abc"); | 15 var s = new String("abc"); |
| 16 } | 16 } |
| 17 } | 17 } |
| 18 | 18 |
| 19 function test(type) | 19 function test(type) |
| 20 { | 20 { |
| 21 var result = document.evaluate("//div", document.documentElement, nu
ll, type, null); | 21 var result; |
| 22 result.snapshotItem(0).foo = "PASS"; | 22 function initialize() { |
| 23 document.body.removeChild(result.snapshotItem(0)); | 23 result = document.evaluate("//div", document.documentElement, nu
ll, type, null); |
| 24 result.snapshotItem(0).foo = "PASS"; |
| 25 document.body.removeChild(result.snapshotItem(0)); |
| 26 } |
| 27 |
| 28 // Perform all assignments in a function to avoid references to obje
cts |
| 29 // in dead registers when using ignition (chromium:595672) |
| 30 initialize(); |
| 24 gc(); | 31 gc(); |
| 25 var console = document.getElementById("console"); | 32 var console = document.getElementById("console"); |
| 26 console.appendChild(document.createTextNode(result.snapshotItem(0).f
oo)); | 33 console.appendChild(document.createTextNode(result.snapshotItem(0).f
oo)); |
| 27 console.appendChild(document.createElement("br")); | 34 console.appendChild(document.createElement("br")); |
| 28 } | 35 } |
| 29 | 36 |
| 30 function tests() | 37 function tests() |
| 31 { | 38 { |
| 32 while (types.length) { | 39 while (types.length) { |
| 33 test(types.pop()); | 40 test(types.pop()); |
| 34 } | 41 } |
| 35 } | 42 } |
| 36 </script> | 43 </script> |
| 37 </head> | 44 </head> |
| 38 <body onload="tests()"> | 45 <body onload="tests()"> |
| 39 <div></div> | 46 <div></div> |
| 40 <div></div> | 47 <div></div> |
| 41 <div> Test for bug <a href="https://bugs.webkit.org/show_bug.cgi?id=34231">34231
</a>: Nodes in XPath result snapshots should keep JS wrappers alive.</div> | 48 <div> Test for bug <a href="https://bugs.webkit.org/show_bug.cgi?id=34231">34231
</a>: Nodes in XPath result snapshots should keep JS wrappers alive.</div> |
| 42 <div> For this test to PASS you should see 2 PASS below.</div><br> | 49 <div> For this test to PASS you should see 2 PASS below.</div><br> |
| 43 <div id="console"></div> | 50 <div id="console"></div> |
| 44 </body></html> | 51 </body></html> |
| OLD | NEW |