OLD | NEW |
1 <html><head> | 1 <html><head> |
| 2 <script src="../../resources/gc.js"></script> |
2 <script> | 3 <script> |
3 if (window.testRunner) | 4 if (window.testRunner) |
4 testRunner.dumpAsText(); | 5 testRunner.dumpAsText(); |
5 | 6 |
6 var types = [ XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, | 7 var types = [ XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, |
7 XPathResult.ORDERED_NODE_SNAPSHOT_TYPE ]; | 8 XPathResult.ORDERED_NODE_SNAPSHOT_TYPE ]; |
8 | 9 |
9 function gc() | |
10 { | |
11 if (window.GCController) | |
12 return GCController.collect(); | |
13 | |
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"); | |
16 } | |
17 } | |
18 | |
19 function test(type) | 10 function test(type) |
20 { | 11 { |
21 var result; | 12 var result; |
22 function initialize() { | 13 function initialize() { |
23 result = document.evaluate("//div", document.documentElement, nu
ll, type, null); | 14 result = document.evaluate("//div", document.documentElement, nu
ll, type, null); |
24 result.snapshotItem(0).foo = "PASS"; | 15 result.snapshotItem(0).foo = "PASS"; |
25 document.body.removeChild(result.snapshotItem(0)); | 16 document.body.removeChild(result.snapshotItem(0)); |
26 } | 17 } |
27 | 18 |
28 // Do initialization work in an inner function to avoid references | 19 // Do initialization work in an inner function to avoid references |
(...skipping 14 matching lines...) Expand all Loading... |
43 } | 34 } |
44 </script> | 35 </script> |
45 </head> | 36 </head> |
46 <body onload="tests()"> | 37 <body onload="tests()"> |
47 <div></div> | 38 <div></div> |
48 <div></div> | 39 <div></div> |
49 <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> | 40 <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> |
50 <div> For this test to PASS you should see 2 PASS below.</div><br> | 41 <div> For this test to PASS you should see 2 PASS below.</div><br> |
51 <div id="console"></div> | 42 <div id="console"></div> |
52 </body></html> | 43 </body></html> |
OLD | NEW |