test_bug393974.html (2494B)
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 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"> 15 16 </div> 17 <pre id="test"> 18 <script class="testbody" type="text/javascript"> 19 20 SimpleTest.waitForExplicitFinish(); 21 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 }); 36 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. 40 41 ok(tw.firstChild() === null, "shouldn't be a first child"); 42 ok(tw.currentNode === document, "should be unchanged"); 43 44 ok(tw.lastChild() === null, "shouldn't be a last child"); 45 ok(tw.currentNode === document, "should be unchanged"); 46 47 ok(tw.nextNode() === null, "shouldn't be a next node"); 48 ok(tw.currentNode === document, "should be unchanged"); 49 50 ok(tw.nextSibling() === null, "shouldn't be a next sibling"); 51 ok(tw.currentNode === document, "should be unchanged"); 52 53 ok(tw.parentNode() === null, "shouldn't be a parent node"); 54 ok(tw.currentNode === document, "should be unchanged"); 55 56 ok(tw.previousNode() === null, "shouldn't be a previous node"); 57 ok(tw.currentNode === document, "should be unchanged"); 58 59 ok(tw.previousSibling() === null, "shouldn't be a previous sibling"); 60 ok(tw.currentNode === document, "should be unchanged"); 61 } 62 63 addLoadEvent(test); 64 addLoadEvent(SimpleTest.finish); 65 </script> 66 </pre> 67 </body> 68 </html>