test_bug478251.html 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. <!DOCTYPE HTML>
  2. <html>
  3. <!--
  4. https://bugzilla.mozilla.org/show_bug.cgi?id=478251
  5. -->
  6. <head>
  7. <title>Test for Bug 478251</title>
  8. <script type="application/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=478251">Mozilla Bug 478251</a>
  13. <p id="display"><iframe id="t"></iframe></p>
  14. <div id="content" style="display: none">
  15. </div>
  16. <pre id="test">
  17. <script type="application/javascript">
  18. /** Test for Bug 478251 **/
  19. var doc = $("t").contentDocument;
  20. doc.open();
  21. doc.write();
  22. doc.close();
  23. is(doc.documentElement.textContent, "", "Writing || failed");
  24. doc.open();
  25. doc.write(null);
  26. doc.close();
  27. is(doc.documentElement.textContent, "null", "Writing |null| failed");
  28. doc.open();
  29. doc.write(null, null);
  30. doc.close();
  31. is(doc.documentElement.textContent, "nullnull", "Writing |null, null| failed");
  32. doc.open();
  33. doc.write(undefined);
  34. doc.close();
  35. is(doc.documentElement.textContent, "undefined", "Writing |undefined| failed");
  36. doc.open();
  37. doc.write(undefined, undefined);
  38. doc.close();
  39. is(doc.documentElement.textContent, "undefinedundefined", "Writing |undefined, undefined| failed");
  40. doc.open();
  41. doc.writeln();
  42. doc.close();
  43. ok(doc.documentElement.textContent == "\n" || doc.documentElement.textContent == "", "Writing |\\n| failed");
  44. doc.open();
  45. doc.writeln(null);
  46. doc.close();
  47. is(doc.documentElement.textContent, "null\n", "Writing |null\\n| failed");
  48. doc.open();
  49. doc.writeln(null, null);
  50. doc.close();
  51. is(doc.documentElement.textContent, "nullnull\n", "Writing |null, null\\n| failed");
  52. doc.open();
  53. doc.writeln(undefined);
  54. doc.close();
  55. is(doc.documentElement.textContent, "undefined\n", "Writing |undefined\\n| failed");
  56. doc.open();
  57. doc.writeln(undefined, undefined);
  58. doc.close();
  59. is(doc.documentElement.textContent, "undefinedundefined\n", "Writing |undefined, undefined\\n| failed");
  60. </script>
  61. </pre>
  62. </body>
  63. </html>