| OLD | NEW |
| (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 |
| OLD | NEW |