test_bug592366.html (1363B)
1 <!DOCTYPE HTML> 2 <html> 3 <!-- 4 https://bugzilla.mozilla.org/show_bug.cgi?id=592366 5 --> 6 <head> 7 <title>Test for Bug 592366</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=592366">Mozilla Bug 592366</a> 13 <p id="display"></p> 14 <div id="content" style="display: none"> 15 <iframe></iframe> 16 <iframe></iframe> 17 </div> 18 <pre id="test"> 19 <script class="testbody" type="text/javascript"> 20 21 /** Test for Bug 592366 */ 22 23 var gExecuted = false; 24 25 function hitEventLoop(times, next) 26 { 27 if (times == 0) { 28 next(); 29 return; 30 } 31 32 SimpleTest.executeSoon(function() { 33 hitEventLoop(times - 1, next); 34 }); 35 } 36 37 SimpleTest.waitForExplicitFinish(); 38 addLoadEvent(function() { 39 var s = document.createElement("script"); 40 s.src = "data:text/javascript,parent.gExecuted=true;"; 41 42 var iframes = document.getElementsByTagName("iframe"); 43 44 iframes[0].contentDocument.body.appendChild(s); 45 iframes[1].contentDocument.body.appendChild(s); 46 47 // It seems to work with 1 event loop hit locally but using 2 given that it 48 // was hsivonen advice. 49 hitEventLoop(2, function() { 50 ok(!gExecuted, "The scripts should not have been executed"); 51 SimpleTest.finish(); 52 }); 53 }); 54 55 </script> 56 </pre> 57 </body> 58 </html>