dom/base/test/test_settimeout_inner.html

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/dom/base/test/test_settimeout_inner.html	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,53 @@
     1.4 +<!DOCTYPE HTML>
     1.5 +<html>
     1.6 +<!--
     1.7 +https://bugzilla.mozilla.org/show_bug.cgi?id=936129
     1.8 +-->
     1.9 +<head>
    1.10 +  <meta charset="utf-8">
    1.11 +  <title>Test for Bug 936129</title>
    1.12 +  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
    1.13 +  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
    1.14 +  <script type="application/javascript">
    1.15 +
    1.16 +    /** Test for Bug 936129 **/
    1.17 +    SimpleTest.waitForExplicitFinish();
    1.18 +
    1.19 +    function test1Done()
    1.20 +    {
    1.21 +      ok(true, "Bareword setTimeout should work after calling document.open().");
    1.22 +  
    1.23 +      var iframe = document.getElementById("testFrame");
    1.24 +      iframe.onload = function () {
    1.25 +        window.runTest2 = iframe.contentWindow.runTest2;
    1.26 +        iframe.onload = function () {
    1.27 +          window.runTest2();
    1.28 +          setTimeout(allDone);
    1.29 +        }
    1.30 +        iframe.src = "about:blank";
    1.31 +      }
    1.32 +      iframe.src = "data:text/html,<script>function runTest2() { setTimeout('parent.test2Done()'); };<" + "/script>";
    1.33 +    }
    1.34 +    window.test2DoneCalled = false;
    1.35 +    function test2Done()
    1.36 +    {
    1.37 +      window.test2DoneCalled = true;
    1.38 +    }
    1.39 +    function allDone()
    1.40 +    {
    1.41 +      ok(!window.test2DoneCalled, "Bareword setTimeout should be a noop after the document for the window context that it's called on isn't active anymore.");
    1.42 +
    1.43 +      SimpleTest.finish();
    1.44 +    }
    1.45 +  </script>
    1.46 +</head>
    1.47 +<body>
    1.48 +<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=936129">Mozilla Bug 936129</a>
    1.49 +<p id="display"></p>
    1.50 +<div id="content" style="display: none">
    1.51 +<iframe id="testFrame" src="data:text/html,<script>window.onload = function runTest1() { document.open(); setTimeout('parent.test1Done();'); document.close(); }</script>"></iframe>
    1.52 +</div>
    1.53 +<pre id="test">
    1.54 +</pre>
    1.55 +</body>
    1.56 +</html>

mercurial