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