test_bug446584.html (1143B)
1 <!DOCTYPE HTML> 2 <html> 3 <!-- 4 https://bugzilla.mozilla.org/show_bug.cgi?id=446584 5 --> 6 <head> 7 <title>Test for Bug 446584</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=446584">Mozilla Bug 446584</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 /** Test for Bug 446584 **/ 21 22 function test(val) { 23 try { 24 document.createNodeIterator(document.body, 25 NodeFilter.SHOW_ALL, 26 function() { throw val }).nextNode(); 27 ok(false, "NodeIterator::nextNode() should have thrown an exception."); 28 } catch (ex) { 29 ok(val === ex, "NodeIterator did not properly forward exception " + 30 val + " of type " + typeof val + ". Thrown value was " + ex + "."); 31 } 32 } 33 34 test(0); 35 test(1); 36 test(3.14); 37 test('roses'); 38 test({}); 39 test(false); 40 test(true); 41 test([1,2,3]); 42 test(function(){}); 43 44 </script> 45 </pre> 46 </body> 47 </html>