Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / xpath / xpath-other-nodeset-result-should-mark-its-nodeset.html
blob91bb5968fd134f6a41f4f8f7c5dda77a055c280d
1 <html><head>
2 <script>
3 if (window.testRunner)
4 testRunner.dumpAsText();
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
8 // specific ordering in the nodeset).
9 var types = [ XPathResult.FIRST_ORDERED_NODE_TYPE, XPathResult.ANY_UNORDERED_NODE_TYPE ];
11 function gc()
13 if (window.GCController)
14 return GCController.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");
21 function test(type)
23 document.getElementsByTagName("span")[0].foo = "PASS";
24 var result = document.evaluate("//span", document.documentElement, null, type, null);
25 document.body.removeChild(document.getElementsByTagName("span")[0]);
26 gc();
27 var console = document.getElementById("console");
28 console.appendChild(document.createTextNode(result.singleNodeValue.foo));
29 console.appendChild(document.createElement("br"));
32 function tests()
34 while (types.length) {
35 test(types.pop());
38 </script>
39 </head>
40 <body onload="tests()">
41 <span></span>
42 <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>
44 <div> For this test to PASS you should see 2 PASS below.</div><br>
45 <div id="console"></div>
46 </body></html>