layout/base/tests/test_bug851485.html

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/layout/base/tests/test_bug851485.html	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,75 @@
     1.4 +<!DOCTYPE HTML>
     1.5 +<html>
     1.6 +<!--
     1.7 +https://bugzilla.mozilla.org/show_bug.cgi?id=851485
     1.8 +-->
     1.9 +<head>
    1.10 +  <meta charset="utf-8">
    1.11 +  <title>Test for Bug 851485</title>
    1.12 +  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
    1.13 +  <script type="application/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
    1.14 +  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
    1.15 +  <script type="application/javascript">
    1.16 +
    1.17 +  /** Test for Bug 851485 **/
    1.18 +
    1.19 +SimpleTest.waitForExplicitFinish();
    1.20 +
    1.21 +function delayedVerifyScroll(win) {
    1.22 +  ok(win.scrollY > 3000);
    1.23 +  SimpleTest.finish();
    1.24 +}
    1.25 +
    1.26 +function verifyScroll(event) {
    1.27 +  var win = event.target.defaultView;
    1.28 +  win.onscroll = "";
    1.29 +  setTimeout(function(){delayedVerifyScroll(win)},500)
    1.30 +}
    1.31 +
    1.32 +function clickLink(link,win) {
    1.33 +  win.document.body.offsetHeight;
    1.34 +  synthesizeMouseAtCenter(link, {type: "mousedown"}, win);
    1.35 +  synthesizeMouseAtCenter(link, {type: "mouseup"}, win);
    1.36 +  sendMouseEvent({type: "click"}, link, win);
    1.37 +}
    1.38 +
    1.39 +function verifyAfterLoad() {
    1.40 +  var e = document.getElementsByTagName('iframe')[0];
    1.41 +  var win = e.contentWindow;
    1.42 +  if (win.location.hash != '') {
    1.43 +    is(win.scrollY,500);
    1.44 +    var link = win.document.getElementsByTagName('a')[0];
    1.45 +    win.onscroll = verifyScroll;
    1.46 +    clickLink(link,win);
    1.47 +    return;
    1.48 +  }
    1.49 +}
    1.50 +
    1.51 +function runTest() {
    1.52 +  var e = document.getElementsByTagName('iframe')[0];
    1.53 +  var win = e.contentWindow;
    1.54 +  if (win.location.hash != '') {
    1.55 +    return;
    1.56 +  }
    1.57 +  win.location.hash='#anchor'
    1.58 +  win.scrollTo(0,500);
    1.59 +  e.setAttribute("onload","verifyAfterLoad()");
    1.60 +  win.location.reload()
    1.61 +}
    1.62 +
    1.63 +
    1.64 +  </script>
    1.65 +</head>
    1.66 +<body>
    1.67 +<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=851485">Mozilla Bug 851485</a>
    1.68 +<p id="display"></p>
    1.69 +<div id="content" style="display: none">
    1.70 +</div>
    1.71 +<pre id="test">
    1.72 +</pre>
    1.73 +<iframe src="file_bug842853.html"></iframe>
    1.74 +<script>
    1.75 +
    1.76 +</script>
    1.77 +</body>
    1.78 +</html>

mercurial