Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
1 <!DOCTYPE HTML>
2 <html>
3 <!--
4 https://bugzilla.mozilla.org/show_bug.cgi?id=562447
5 -->
6 <head>
7 <title>Test for Bug 562447</title>
8 <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
9 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
11 </head>
12 <body>
13 <p><a target="_blank" href="https://bugzilla.mozilla.org/show_bug?id=562447">Mozilla Bug 562447</a>
15 <input id="WhyDoYouFocusMe"
16 style="position: absolute; left: -50px; top: 10000px;">
18 <pre id="test">
19 <script>
20 addLoadEvent(function() {
21 // Scroll down a bit
22 window.scrollTo(0, 5000);
24 setTimeout(function() {
25 // Make sure that we're scrolled by 5000px
26 is(window.pageYOffset, 5000, "Make sure we're scrolled correctly");
28 // Scroll back up, and mess with the input box along the way
29 var input = document.getElementById("WhyDoYouFocusMe");
30 input.focus();
31 input.blur();
32 window.scrollTo(0, 0);
34 setTimeout(function() {
35 is(window.pageYOffset, 0, "Make sure we're scrolled back up correctly");
37 // Scroll back up
38 window.scrollTo(0, 5000);
40 setTimeout(function() {
41 is(window.pageYOffset, 5000, "Sanity check");
43 window.scrollTo(0, 0);
44 input.focus();
45 input.blur();
47 setTimeout(function() {
48 isnot(window.pageYOffset, 0, "This time we shouldn't be scrolled up");
50 SimpleTest.finish();
51 }, 0);
52 }, 0);
53 }, 0);
54 }, 0);
55 });
57 SimpleTest.waitForExplicitFinish();
58 </script>
59 </pre>
61 </body>
62 </html>