| // ANY_ORDERED_NODE_TYPE should be the last item in the array so that |
| // there is only one node that can match (thus it does not tie us to any |
| // specific ordering in the nodeset). |
| var types = [ XPathResult.FIRST_ORDERED_NODE_TYPE, XPathResult.ANY_UNORDERED_NODE_TYPE ]; |
| return GCController.collect(); |
| for (var i = 0; i < 10000; i++) { // > force garbage collection (FF requires about 9K allocations before a collect) |
| var s = new String("abc"); |
| document.getElementsByTagName("span")[0].foo = "PASS"; |
| var result = document.evaluate("//span", document.documentElement, null, type, null); |
| document.body.removeChild(document.getElementsByTagName("span")[0]); |
| var console = document.getElementById("console"); |
| console.appendChild(document.createTextNode(result.singleNodeValue.foo)); |
| console.appendChild(document.createElement("br")); |
| <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> |
| <div> For this test to PASS you should see 2 PASS below.</div><br> |