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 // ANY_ORDERED_NODE_TYPE should be the last item in the array so that | 6 // ANY_ORDERED_NODE_TYPE should be the last item in the array so that |
7 // there is only one node that can match (thus it does not tie us to any | 7 // there is only one node that can match (thus it does not tie us to any |
8 // specific ordering in the nodeset). | 8 // specific ordering in the nodeset). |
9 var types = [ XPathResult.FIRST_ORDERED_NODE_TYPE, XPathResult.ANY_UNORD
ERED_NODE_TYPE ]; | 9 var types = [ XPathResult.FIRST_ORDERED_NODE_TYPE, XPathResult.ANY_UNORD
ERED_NODE_TYPE ]; |
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 document.getElementsByTagName("span")[0].foo = "PASS"; | 23 var result; |
24 var result = document.evaluate("//span", document.documentElement, n
ull, type, null); | 24 function initialize() { |
25 document.body.removeChild(document.getElementsByTagName("span")[0]); | 25 document.getElementsByTagName("span")[0].foo = "PASS"; |
| 26 result = document.evaluate("//span", document.documentElement, n
ull, type, null); |
| 27 document.body.removeChild(document.getElementsByTagName("span")[
0]); |
| 28 } |
| 29 |
| 30 // Do initialization work in an inner function to avoid references |
| 31 // to objects remaining live on this function's stack frame |
| 32 // (http://crbug.com/595672/). |
| 33 initialize(); |
26 gc(); | 34 gc(); |
27 var console = document.getElementById("console"); | 35 var console = document.getElementById("console"); |
28 console.appendChild(document.createTextNode(result.singleNodeValue.f
oo)); | 36 console.appendChild(document.createTextNode(result.singleNodeValue.f
oo)); |
29 console.appendChild(document.createElement("br")); | 37 console.appendChild(document.createElement("br")); |
30 } | 38 } |
31 | 39 |
32 function tests() | 40 function tests() |
33 { | 41 { |
34 while (types.length) { | 42 while (types.length) { |
35 test(types.pop()); | 43 test(types.pop()); |
36 } | 44 } |
37 } | 45 } |
38 </script> | 46 </script> |
39 </head> | 47 </head> |
40 <body onload="tests()"> | 48 <body onload="tests()"> |
41 <span></span> | 49 <span></span> |
42 <span></span> | 50 <span></span> |
43 <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> | 51 <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> |
44 <div> For this test to PASS you should see 2 PASS below.</div><br> | 52 <div> For this test to PASS you should see 2 PASS below.</div><br> |
45 <div id="console"></div> | 53 <div id="console"></div> |
46 </body></html> | 54 </body></html> |
OLD | NEW |