test_bug446584.html 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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 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=446584">Mozilla Bug 446584</a>
  13. <p id="display"></p>
  14. <div id="content" style="display: none">
  15. </div>
  16. <pre id="test">
  17. <script class="testbody" type="text/javascript">
  18. /** Test for Bug 446584 **/
  19. function test(val) {
  20. try {
  21. document.createNodeIterator(document.body,
  22. NodeFilter.SHOW_ALL,
  23. function() { throw val }).nextNode();
  24. ok(false, "NodeIterator::nextNode() should have thrown an exception.");
  25. } catch (ex) {
  26. ok(val === ex, "NodeIterator did not properly forward exception " +
  27. val + " of type " + typeof val + ". Thrown value was " + ex + ".");
  28. }
  29. }
  30. test(0);
  31. test(1);
  32. test(3.14);
  33. test('roses');
  34. test({});
  35. test(false);
  36. test(true);
  37. test([1,2,3]);
  38. test(function(){});
  39. </script>
  40. </pre>
  41. </body>
  42. </html>