docshell/test/test_bug653741.html

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/docshell/test/test_bug653741.html	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,49 @@
     1.4 +<!DOCTYPE HTML>
     1.5 +<html>
     1.6 +<!--
     1.7 +https://bugzilla.mozilla.org/show_bug.cgi?id=653741
     1.8 +-->
     1.9 +<head>
    1.10 +  <title>Test for Bug 653741</title>
    1.11 +  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
    1.12 +  <script type="text/javascript" src="/tests/SimpleTest/WindowSnapshot.js"></script>
    1.13 +  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
    1.14 +</head>
    1.15 +<body>
    1.16 +<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=653741">Mozilla Bug 653741</a>
    1.17 +
    1.18 +<script type="application/javascript;version=1.7">
    1.19 +
    1.20 +/** Test for Bug 653741 **/
    1.21 +SimpleTest.waitForExplicitFinish();
    1.22 +
    1.23 +function childLoad() {
    1.24 +  // Spin the event loop so we leave the onload handler.
    1.25 +  SimpleTest.executeSoon(childLoad2);
    1.26 +}
    1.27 +
    1.28 +function childLoad2() {
    1.29 +  let cw = $('iframe').contentWindow;
    1.30 +  
    1.31 +  // Save the Y offset.  For sanity's sake, make sure it's not 0, because we
    1.32 +  // should be at the bottom of the page!
    1.33 +  let origYOffset = cw.pageYOffset;
    1.34 +  ok(origYOffset != 0, 'Original Y offset is not 0.');
    1.35 +
    1.36 +  // Scroll the iframe to the top, then navigate to #bottom again.
    1.37 +  cw.scrollTo(0, 0);
    1.38 +
    1.39 +  // Our current location is #bottom, so this should scroll us down to the
    1.40 +  // bottom again.
    1.41 +  cw.location = cw.location + '';
    1.42 +
    1.43 +  is(cw.pageYOffset, origYOffset, 'Correct offset after reloading page.');
    1.44 +  SimpleTest.finish();
    1.45 +}
    1.46 +
    1.47 +</script>
    1.48 +
    1.49 +<iframe height='100px' id='iframe' src='file_bug653741.html#bottom'></iframe>
    1.50 +
    1.51 +</body>
    1.52 +</html>

mercurial