docshell/test/test_anchor_scroll_after_document_open.html

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/docshell/test/test_anchor_scroll_after_document_open.html	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,55 @@
     1.4 +<!DOCTYPE HTML>
     1.5 +<html>
     1.6 +<!--
     1.7 +https://bugzilla.mozilla.org/show_bug.cgi?id=881487
     1.8 +-->
     1.9 +<head>
    1.10 +  <meta charset="utf-8">
    1.11 +  <title>Test for Bug 881487</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 881487 **/
    1.17 +  SimpleTest.waitForExplicitFinish();
    1.18 +  // Child needs to invoke us, otherwise our onload will fire before the child
    1.19 +  // has done the write/close bit.
    1.20 +  var gotOnload = false;
    1.21 +  addLoadEvent(function() {
    1.22 +    gotOnload = true;
    1.23 +  });
    1.24 +  onmessage = function handleMessage(msg) {
    1.25 +    if (msg.data == "doTest") {
    1.26 +      if (!gotOnload) {
    1.27 +        addLoadEvent(function() { handleMessage(msg); });
    1.28 +        return;
    1.29 +      }
    1.30 +      frames[0].onscroll = function() {
    1.31 +        ok(true, "Got a scroll event");
    1.32 +        SimpleTest.finish();
    1.33 +      }
    1.34 +      frames[0].location.hash = "#target";
    1.35 +      return;
    1.36 +    }
    1.37 +    if (msg.data == "haveHash") {
    1.38 +      ok(false, "Child got reloaded");
    1.39 +    } else {
    1.40 +      ok(false, "Unexpected message");
    1.41 +    }
    1.42 +    SimpleTest.finish();
    1.43 +  }
    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=881487">Mozilla Bug 881487</a>
    1.49 +<p id="display">
    1.50 +  <!-- iframe goes here so it can scroll -->
    1.51 +<iframe src="file_anchor_scroll_after_document_open.html"></iframe>
    1.52 +</p>
    1.53 +<div id="content" style="display: none">
    1.54 +</div>
    1.55 +<pre id="test">
    1.56 +</pre>
    1.57 +</body>
    1.58 +</html>

mercurial