blob: 90e89806a8d71c42a92513a1037d33ff0f3f831f [file] [log] [blame]
<html>
<head>
<style type="text/css">
div {
height: 2000px;
}
</style>
</head>
<body>
<script>
if (window.testRunner) {
testRunner.dumpAsText();
testRunner.waitUntilDone();
}
window.onpopstate = () => {
if (window.location.hash == '') {
// Step 4: While handling same-document back navigation, change the height
// of the document. This shouldn't interfere with restoring scroll state.
document.getElementById("d").remove();
// Force layout
window.scrollY;
setTimeout(function() {
// Step 5: Verify scrollY was reset to 0 as part of back navigation.
console.log("scrollY is: " + window.scrollY);
if (window.testRunner)
testRunner.notifyDone();
}, 0);
}
}
window.onload = () => {
setTimeout(function() {
// Step 1: Add history entry.
location = "#hash";
setTimeout(function() {
// Step 2: Scroll to the bottom.
window.scrollBy(0, 4000);
// Step 3: Go back.
history.back();
}, 0);
}, 0);
}
</script>
<div></div>
<div id="d"></div>
</body>
</html>