Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
1 <!DOCTYPE HTML>
2 <html>
3 <!--
4 https://bugzilla.mozilla.org/show_bug.cgi?id=393974
5 -->
6 <head>
7 <title>Test for Bug 393974</title>
8 <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
9 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
10 </head>
11 <body>
12 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=393974">Mozilla Bug 393974</a>
13 <p id="display"></p>
14 <div id="content" style="display: none">
16 </div>
17 <pre id="test">
18 <script class="testbody" type="text/javascript">
20 SimpleTest.waitForExplicitFinish();
22 function test()
23 {
24 // Create a tree walker with a filter which creates a cycle...
25 var tw = document.createTreeWalker(document, NodeFilter.SHOW_ALL,
26 function(n)
27 {
28 // force the closure to contain the
29 // global object, in case a future
30 // optimization might minimize the
31 // function's captured environment
32 if ("foo" + window == "fooPIRATES!")
33 return NodeFilter.FILTER_ACCEPT;
34 return NodeFilter.FILTER_REJECT;
35 });
37 // That should have been enough to create a leak, but we should do at least
38 // a couple tests while we're here so that this document doesn't show up as
39 // having no tests pass *or* fail.
41 ok(tw.firstChild() === null, "shouldn't be a first child");
42 ok(tw.currentNode === document, "should be unchanged");
44 ok(tw.lastChild() === null, "shouldn't be a last child");
45 ok(tw.currentNode === document, "should be unchanged");
47 ok(tw.nextNode() === null, "shouldn't be a next node");
48 ok(tw.currentNode === document, "should be unchanged");
50 ok(tw.nextSibling() === null, "shouldn't be a next sibling");
51 ok(tw.currentNode === document, "should be unchanged");
53 ok(tw.parentNode() === null, "shouldn't be a parent node");
54 ok(tw.currentNode === document, "should be unchanged");
56 ok(tw.previousNode() === null, "shouldn't be a previous node");
57 ok(tw.currentNode === document, "should be unchanged");
59 ok(tw.previousSibling() === null, "shouldn't be a previous sibling");
60 ok(tw.currentNode === document, "should be unchanged");
61 }
63 addLoadEvent(test);
64 addLoadEvent(SimpleTest.finish);
65 </script>
66 </pre>
67 </body>
68 </html>