file_bug1750973.html (1490B)
1 <!DOCTYPE HTML> 2 <html> 3 <head> 4 <meta charset="utf-8"> 5 <script> 6 function test() { 7 history.scrollRestoration = "manual"; 8 document.getElementById("initialfocus").focus(); 9 history.pushState('data', '', ''); 10 history.back(); 11 } 12 13 window.onpopstate = function() { 14 window.onscroll = function() { 15 window.onscroll = null; 16 document.documentElement.style.display = "none"; 17 // focus() triggers recreation of the nsIFrames without a reflow. 18 document.getElementById("focustarget").focus(); 19 document.documentElement.style.display = ""; 20 // Flush the layout. 21 document.documentElement.getBoundingClientRect(); 22 opener.isnot(window.scrollY, 0, "The page should have been scrolled down(1)"); 23 requestAnimationFrame( 24 function() { 25 // Extra timeout to ensure we're called after rAF has triggered a 26 // reflow. 27 setTimeout(function() { 28 opener.isnot(window.scrollY, 0, "The page should have been scrolled down(2)"); 29 window.close(); 30 opener.SimpleTest.finish(); 31 }); 32 }); 33 } 34 window.scrollTo(0, 1000); 35 } 36 </script> 37 </head> 38 <body onload="setTimeout(test)"> 39 <div style="position: fixed;"> 40 <input type="button" value="" id="initialfocus"> 41 <input type="button" value="" id="focustarget"> 42 </div> 43 <div style="border: 1px solid black; width: 100px; height: 9000px;"></div> 44 </body> 45 </html>