tor-browser

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

test_anchor_scroll_after_document_open.html (1467B)


      1 <!DOCTYPE HTML>
      2 <html>
      3 <!--
      4 https://bugzilla.mozilla.org/show_bug.cgi?id=881487
      5 -->
      6 <head>
      7  <meta charset="utf-8">
      8  <title>Test for Bug 881487</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 881487 */
     14  SimpleTest.waitForExplicitFinish();
     15  // Child needs to invoke us, otherwise our onload will fire before the child
     16  // has done the write/close bit.
     17  var gotOnload = false;
     18  addLoadEvent(function() {
     19    gotOnload = true;
     20  });
     21  onmessage = function handleMessage(msg) {
     22    if (msg.data == "doTest") {
     23      if (!gotOnload) {
     24        addLoadEvent(function() { handleMessage(msg); });
     25        return;
     26      }
     27      frames[0].onscroll = function() {
     28        ok(true, "Got a scroll event");
     29        SimpleTest.finish();
     30      };
     31      frames[0].location.hash = "#target";
     32      return;
     33    }
     34    if (msg.data == "haveHash") {
     35      ok(false, "Child got reloaded");
     36    } else {
     37      ok(false, "Unexpected message");
     38    }
     39    SimpleTest.finish();
     40  };
     41 
     42  </script>
     43 </head>
     44 <body>
     45 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=881487">Mozilla Bug 881487</a>
     46 <p id="display">
     47  <!-- iframe goes here so it can scroll -->
     48 <iframe src="file_anchor_scroll_after_document_open.html"></iframe>
     49 </p>
     50 <div id="content" style="display: none">
     51 </div>
     52 <pre id="test">
     53 </pre>
     54 </body>
     55 </html>