Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
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 type="text/javascript" src="/MochiKit/MochiKit.js"></script>
9 <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
10 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
11 </head>
12 <body>
13 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=592366">Mozilla Bug 592366</a>
14 <p id="display"></p>
15 <div id="content" style="display: none">
16 <iframe></iframe>
17 <iframe></iframe>
18 </div>
19 <pre id="test">
20 <script class="testbody" type="text/javascript">
22 /** Test for Bug 592366 **/
24 var gExecuted = false;
26 function hitEventLoop(times, next)
27 {
28 if (times == 0) {
29 next();
30 return;
31 }
33 SimpleTest.executeSoon(function() {
34 hitEventLoop(times - 1, next);
35 });
36 }
38 SimpleTest.waitForExplicitFinish();
39 addLoadEvent(function() {
40 var s = document.createElement("script");
41 s.src = "data:text/javascript,parent.gExecuted=true;";
43 var iframes = document.getElementsByTagName("iframe");
45 iframes[0].contentDocument.body.appendChild(s);
46 iframes[1].contentDocument.body.appendChild(s);
48 // It seems to work with 1 event loop hit locally but using 2 given that it
49 // was hsivonen advice.
50 hitEventLoop(2, function() {
51 ok(!gExecuted, "The scripts should not have been executed");
52 SimpleTest.finish();
53 });
54 });
56 </script>
57 </pre>
58 </body>
59 </html>