blob: 122536d625487236f0c702920b6a8665f12a8751 [file] [log] [blame]
<!DOCTYPE html>
<style>
/* Body is large enough to scroll but not enough to restore the scroll
position without clamping. */
body {
height: 2000px;
width: 2000px;
}
</style>
<div id='console'></div>
<script src="../../resources/js-test.js"></script>
<script>
jsTestIsAsync = true
setPrintTestResultsLazily();
description('Test ensures that frame scroll position is not prematurely ' +
'clamped and restored before load event fires.');
// Forcing layout causes the frame to attempt to restore scroll position if
// possible even before page loading is complete.
forceLayout();
debug('Scroll position should not be clamped and restored while frame is loading');
shouldBe('document.scrollingElement.scrollLeft', '0');
shouldBe('document.scrollingElement.scrollTop', '0');
onload = function() {
if (window.name == 'verification') {
shouldBe('document.scrollingElement.scrollLeft', '5000');
shouldBe('document.scrollingElement.scrollTop', '5001');
window.name = "";
setTimeout(function(){ window.scrollTo(0, 0); }, 0);
finishJSTest();
} else {
window.scrollTo(5000, 5001);
shouldBe('document.scrollingElement.scrollLeft', '5000');
shouldBe('document.scrollingElement.scrollTop', '5001');
setTimeout(function(){
window.name = "verification";
window.location = "../../resources/back.html";
}, 0);
}
}
function forceLayout () {
document.body.scrollTop;
}
</script>
<style>
body {
height: 9999px;
width: 9999px;
}
</style>