4 https://bugzilla.mozilla.org/show_bug.cgi?id=430723
7 <title>Test for Bug
430723</title>
8 <script type=
"text/javascript" src=
"/MochiKit/packed.js"></script>
9 <script type=
"text/javascript" src=
"/tests/SimpleTest/SimpleTest.js"></script>
10 <script type=
"text/javascript" src=
"/tests/SimpleTest/EventUtils.js"></script>
11 <link rel=
"stylesheet" type=
"text/css" href=
"/tests/SimpleTest/test.css" />
14 <a target=
"_blank" href=
"https://bugzilla.mozilla.org/show_bug.cgi?id=430723">Mozilla Bug
430723</a>
16 <div id=
"content" style=
"display: none">
20 <script class=
"testbody" type=
"text/javascript">
23 /** Test for Bug
430723 **/
25 var gTallRedBoxURI =
"data:text/html;charset=utf-8;base64,PGh0bWw%2BPGhlYWQ%2BPHNjcmlwdD53aW5kb3cuYWRkRXZlbnRMaXN0ZW5lcigncGFnZXNob3cnLCBmdW5jdGlvbigpe29wZW5lci5uZXh0VGVzdCgpO30sIGZhbHNlKTs8L3NjcmlwdD48L2hlYWQ%2BPGJvZHk%2BPGRpdiBzdHlsZT0icG9zaXRpb246YWJzb2x1dGU7IGxlZnQ6MHB4OyB0b3A6MHB4OyB3aWR0aDo1MCU7IGhlaWdodDoxNTAlOyBiYWNrZ3JvdW5kLWNvbG9yOnJlZCI%2BPHA%2BVGhpcyBpcyBhIHZlcnkgdGFsbCByZWQgYm94LjwvcD48L2Rpdj48L2JvZHk%2BPC9odG1sPg%3D%3D";
27 // < script
> window.addEventListener(
"pageshow", function(){opener.nextTest();}, false); < /script
>
29 //
<div style=
"position:absolute; left:0px; top:0px; width:50%; height:150%; background-color:red">
30 //
<p>This is a very tall red box.
</p>
31 //
</div></body></html>
33 var gTallBlueBoxURI =
"data:text/html;charset=utf-8;base64,PGh0bWw%2BPGhlYWQ%2BPHNjcmlwdD53aW5kb3cuYWRkRXZlbnRMaXN0ZW5lcigncGFnZXNob3cnLCBmdW5jdGlvbigpe29wZW5lci5uZXh0VGVzdCgpO30sIGZhbHNlKTs8L3NjcmlwdD48L2hlYWQ%2BPGJvZHk%2BPGRpdiBzdHlsZT0icG9zaXRpb246YWJzb2x1dGU7IGxlZnQ6MHB4OyB0b3A6MHB4OyB3aWR0aDo1MCU7IGhlaWdodDoxNTAlOyBiYWNrZ3JvdW5kLWNvbG9yOmJsdWUiPjxwPlRoaXMgaXMgYSB2ZXJ5IHRhbGwgYmx1ZSBib3guPC9wPjwvZGl2PjwvYm9keT48L2h0bWw%2B";
35 // < script
> window.addEventListener(
"pageshow", function(){opener.nextTest();}, false); < /script
>
37 //
<div style=
"position:absolute; left:0px; top:0px; width:50%; height:150%; background-color:blue">
38 //
<p>This is a very tall blue box.
</p>
39 //
</div></body></html>
42 window.onload = runTest;
48 testWindow = window.open(gTallRedBoxURI,
"testWindow",
"width=300,height=300,location=yes,scrollbars=yes");
51 var nextTest =function() {
54 case
1: setTimeout(step1,
0); break;
55 case
2: setTimeout(step2,
0); break;
56 case
3: setTimeout(step3,
0); break;
60 var step1 =function() {
61 window.is(testWindow.location, gTallRedBoxURI,
"Ensure red page loaded.");
63 // Navigate down and up.
64 is(testWindow.document.body.scrollTop,
0,
65 "Page1: Ensure we scrollpane is at the top before we start scrolling.");
66 sendKey('DOWN', testWindow);
67 sendKey('UP', testWindow);
68 setTimeout(function() {
69 is(testWindow.document.body.scrollTop,
0,
70 "Page1: Ensure we can scroll down and up, back to the top.");
72 // Nav to blue box page. This should fire step2.
73 testWindow.location = gTallBlueBoxURI;
78 var step2 =function() {
79 window.is(testWindow.location, gTallBlueBoxURI,
"Ensure blue page loaded.");
81 // Scroll around a bit.
82 is(testWindow.document.body.scrollTop,
0,
83 "Page2: Ensure we scrollpane is at the top before we start scrolling.");
84 sendKey('DOWN', testWindow);
85 sendKey('DOWN', testWindow);
86 sendKey('DOWN', testWindow);
87 setTimeout(function() {
88 isnot(testWindow.document.body.scrollTop,
0,
89 "Page2: Ensure we could scrol.");
91 // Navigate backwards. This should fire step3.
92 testWindow.history.back();
96 var step3 =function() {
97 window.is(testWindow.location, gTallRedBoxURI,
98 "Ensure red page restored from history.");
100 // Check we can still scroll with the keys.
101 is(testWindow.document.body.scrollTop,
0,
102 "Page1Again: Ensure scroll pane at top before we scroll.");
103 sendKey('DOWN', testWindow);
104 setTimeout(function() {
105 isnot(testWindow.document.body.scrollTop,
0,
106 "Page2Again: Ensure we can still scroll.");
109 window.SimpleTest.finish();
113 SimpleTest.waitForExplicitFinish();