tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

test_settimeout_inner.html (1869B)


      1 <!DOCTYPE HTML>
      2 <html>
      3 <!--
      4 https://bugzilla.mozilla.org/show_bug.cgi?id=936129
      5 -->
      6 <head>
      7  <meta charset="utf-8">
      8  <title>Test for Bug 936129</title>
      9  <script src="/tests/SimpleTest/SimpleTest.js"></script>
     10  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
     11  <script type="application/javascript">
     12 
     13    /** Test for Bug 936129 */
     14    SimpleTest.waitForExplicitFinish();
     15 
     16    function test1Done()
     17    {
     18      ok(true, "Bareword setTimeout should work after calling document.open().");
     19  
     20      var iframe = document.getElementById("testFrame");
     21      iframe.onload = function () {
     22        window.runTest2 = iframe.contentWindow.runTest2;
     23        iframe.onload = function () {
     24          window.runTest2();
     25          setTimeout(allDone);
     26        }
     27 
     28        // Per whatwg spec, "If the src attribute and the srcdoc attribute are
     29        // both specified together, the srcdoc attribute takes priority."
     30        //
     31        // So if we were to use src attribute here, it will be considered as a
     32        // no-op, so simply use a simple srcdoc here.
     33        iframe.srcdoc = "<html></html>";
     34      }
     35      iframe.srcdoc = "<script>function runTest2() { setTimeout('parent.test2Done()'); };<" + "/script>";
     36    }
     37    window.test2DoneCalled = false;
     38    function test2Done()
     39    {
     40      window.test2DoneCalled = true;
     41    }
     42    function allDone()
     43    {
     44      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.");
     45 
     46      SimpleTest.finish();
     47    }
     48  </script>
     49 </head>
     50 <body>
     51 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=936129">Mozilla Bug 936129</a>
     52 <p id="display"></p>
     53 <div id="content" style="display: none">
     54 <iframe id="testFrame" src="file_settimeout_inner.html"></iframe>
     55 </div>
     56 <pre id="test">
     57 </pre>
     58 </body>
     59 </html>