1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/content/base/test/test_bug592366.html Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,59 @@ 1.4 +<!DOCTYPE HTML> 1.5 +<html> 1.6 +<!-- 1.7 +https://bugzilla.mozilla.org/show_bug.cgi?id=592366 1.8 +--> 1.9 +<head> 1.10 + <title>Test for Bug 592366</title> 1.11 + <script type="text/javascript" src="/MochiKit/MochiKit.js"></script> 1.12 + <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> 1.13 + <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> 1.14 +</head> 1.15 +<body> 1.16 +<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=592366">Mozilla Bug 592366</a> 1.17 +<p id="display"></p> 1.18 +<div id="content" style="display: none"> 1.19 +<iframe></iframe> 1.20 +<iframe></iframe> 1.21 +</div> 1.22 +<pre id="test"> 1.23 +<script class="testbody" type="text/javascript"> 1.24 + 1.25 +/** Test for Bug 592366 **/ 1.26 + 1.27 +var gExecuted = false; 1.28 + 1.29 +function hitEventLoop(times, next) 1.30 +{ 1.31 + if (times == 0) { 1.32 + next(); 1.33 + return; 1.34 + } 1.35 + 1.36 + SimpleTest.executeSoon(function() { 1.37 + hitEventLoop(times - 1, next); 1.38 + }); 1.39 +} 1.40 + 1.41 +SimpleTest.waitForExplicitFinish(); 1.42 +addLoadEvent(function() { 1.43 + var s = document.createElement("script"); 1.44 + s.src = "data:text/javascript,parent.gExecuted=true;"; 1.45 + 1.46 + var iframes = document.getElementsByTagName("iframe"); 1.47 + 1.48 + iframes[0].contentDocument.body.appendChild(s); 1.49 + iframes[1].contentDocument.body.appendChild(s); 1.50 + 1.51 + // It seems to work with 1 event loop hit locally but using 2 given that it 1.52 + // was hsivonen advice. 1.53 + hitEventLoop(2, function() { 1.54 + ok(!gExecuted, "The scripts should not have been executed"); 1.55 + SimpleTest.finish(); 1.56 + }); 1.57 +}); 1.58 + 1.59 +</script> 1.60 +</pre> 1.61 +</body> 1.62 +</html>