Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(474)

Unified Diff: third_party/WebKit/LayoutTests/fast/history/change-viewport-height-in-onpopstate.html

Issue 2949073002: Changing scroll and view state in onpopstate shouldn't overwrite back/forward state restore (Closed)
Patch Set: Reset ViewState when trying to copy from a nullptr Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/LayoutTests/fast/history/change-viewport-height-in-onpopstate.html
diff --git a/third_party/WebKit/LayoutTests/fast/history/change-viewport-height-in-onpopstate.html b/third_party/WebKit/LayoutTests/fast/history/change-viewport-height-in-onpopstate.html
new file mode 100644
index 0000000000000000000000000000000000000000..90e89806a8d71c42a92513a1037d33ff0f3f831f
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/fast/history/change-viewport-height-in-onpopstate.html
@@ -0,0 +1,49 @@
+<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>
+

Powered by Google App Engine
This is Rietveld 408576698