test_bug482659.html (1583B)
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 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 21 </div> 22 <pre id="test"> 23 <script type="application/javascript"> 24 25 /** Test for Bug 482659 */ 26 SimpleTest.waitForExplicitFinish() 27 28 function testFrame(num) { 29 is(window.frames[num].document.baseURI, document.baseURI, 30 "Unexpected base URI in frame " + num); 31 is(window.frames[num].document.documentURI, "about:blank", 32 "Unexpected document URI in frame " + num); 33 } 34 35 function appendScript(doc) { 36 var s = doc.createElement("script"); 37 s.textContent = "document.write('executed'); document.close()"; 38 doc.body.appendChild(s); 39 } 40 41 function verifyScriptRan(num) { 42 is(window.frames[num].document.documentElement.textContent, "executed", 43 "write didn't happen in frame " + num); 44 } 45 46 addLoadEvent(function() { 47 /* document.write part of test disabled due to bug 483818 48 appendScript(window.frames[2].document); 49 appendScript(window.frames[3].document); 50 51 verifyScriptRan(2); 52 verifyScriptRan(3); 53 */ 54 for (var i = 0; i < 4; ++i) { 55 testFrame(i); 56 } 57 58 SimpleTest.finish(); 59 }); 60 61 </script> 62 </pre> 63 </body> 64 </html>