test_bug653741.html (1390B)
1 <!DOCTYPE HTML> 2 <html> 3 <!-- 4 https://bugzilla.mozilla.org/show_bug.cgi?id=653741 5 --> 6 <head> 7 <title>Test for Bug 653741</title> 8 <script src="/tests/SimpleTest/SimpleTest.js"></script> 9 <script src="/tests/SimpleTest/WindowSnapshot.js"></script> 10 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> 11 </head> 12 <body> 13 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=653741">Mozilla Bug 653741</a> 14 15 <script type="application/javascript"> 16 17 /** Test for Bug 653741 */ 18 SimpleTest.waitForExplicitFinish(); 19 20 function childLoad() { 21 // Spin the event loop so we leave the onload handler. 22 SimpleTest.executeSoon(childLoad2); 23 } 24 25 function childLoad2() { 26 let cw = $("iframe").contentWindow; 27 28 // Save the Y offset. For sanity's sake, make sure it's not 0, because we 29 // should be at the bottom of the page! 30 let origYOffset = Math.round(cw.pageYOffset); 31 ok(origYOffset != 0, "Original Y offset is not 0."); 32 33 // Scroll the iframe to the top, then navigate to #bottom again. 34 cw.scrollTo(0, 0); 35 36 // Our current location is #bottom, so this should scroll us down to the 37 // bottom again. 38 cw.location = cw.location + ""; 39 40 is(Math.round(cw.pageYOffset), origYOffset, "Correct offset after reloading page."); 41 SimpleTest.finish(); 42 } 43 44 </script> 45 46 <iframe height='100px' id='iframe' src='file_bug653741.html#bottom'></iframe> 47 48 </body> 49 </html>