test_bug482659.html 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. <!DOCTYPE HTML>
  2. <html>
  3. <!--
  4. https://bugzilla.mozilla.org/show_bug.cgi?id=482659
  5. -->
  6. <head>
  7. <title>Test for Bug 482659</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=482659">Mozilla Bug 482659</a>
  13. <p id="display">
  14. <iframe></iframe>
  15. <iframe src="about:blank"></iframe>
  16. <iframe></iframe>
  17. <iframe src="about:blank"></iframe>
  18. </p>
  19. <div id="content" style="display: none">
  20. </div>
  21. <pre id="test">
  22. <script type="application/javascript">
  23. /** Test for Bug 482659 **/
  24. SimpleTest.waitForExplicitFinish()
  25. function testFrame(num) {
  26. is(window.frames[num].document.baseURI, document.baseURI,
  27. "Unexpected base URI in frame " + num);
  28. is(window.frames[num].document.documentURI, "about:blank",
  29. "Unexpected document URI in frame " + num);
  30. }
  31. function appendScript(doc) {
  32. var s = doc.createElement("script");
  33. s.textContent = "document.write('executed'); document.close()";
  34. doc.body.appendChild(s);
  35. }
  36. function verifyScriptRan(num) {
  37. is(window.frames[num].document.documentElement.textContent, "executed",
  38. "write didn't happen in frame " + num);
  39. }
  40. addLoadEvent(function() {
  41. /* document.write part of test disabled due to bug 483818
  42. appendScript(window.frames[2].document);
  43. appendScript(window.frames[3].document);
  44. verifyScriptRan(2);
  45. verifyScriptRan(3);
  46. */
  47. for (var i = 0; i < 4; ++i) {
  48. testFrame(i);
  49. }
  50. SimpleTest.finish();
  51. });
  52. </script>
  53. </pre>
  54. </body>
  55. </html>