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

Side by Side 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: +test Created 3 years, 6 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 unified diff | Download patch
OLDNEW
(Empty)
1 <html>
2 <head>
3 <style type="text/css">
4 div {
5 height: 2000px;
6 }
7 </style>
8 </head>
9 <body>
10 <script>
11 if (window.testRunner) {
12 testRunner.dumpAsText();
13 testRunner.waitUntilDone();
14 }
15
16 window.onpopstate = () => {
17 if (window.location.hash == '') {
18 // Step 4: While handling same-document back navigation, change the height
19 // of the document. This shouldn't interfere with restoring scroll state.
20 document.getElementById("d").remove();
21 // Force layout
22 window.scrollY;
23 setTimeout(function() {
24 // Step 5: Verify scrollY was reset to 0 as part of back navigation.
25 console.log("scrollY is: " + window.scrollY);
26 if (window.testRunner)
27 testRunner.notifyDone();
28 }, 0);
29 }
30 }
31
32 window.onload = () => {
33 setTimeout(function() {
34 // Step 1: Add history entry.
35 location = "#hash";
36 setTimeout(function() {
37 // Step 2: Scroll to the bottom.
38 window.scrollBy(0, 4000);
39 // Step 3: Go back.
40 history.back();
41 }, 0);
42 }, 0);
43 }
44 </script>
45 <div></div>
46 <div id="d"></div>
47 </body>
48 </html>
49
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698