Index: LayoutTests/fast/loader/scroll-position-restored-on-back-at-load-event.html |
diff --git a/LayoutTests/fast/loader/scroll-position-restored-on-back-at-load-event.html b/LayoutTests/fast/loader/scroll-position-restored-on-back-at-load-event.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..f3c9a3b5d15bba54ad10f194e7723c92839c1097 |
--- /dev/null |
+++ b/LayoutTests/fast/loader/scroll-position-restored-on-back-at-load-event.html |
@@ -0,0 +1,38 @@ |
+<!DOCTYPE html> |
+<html> |
+ <head> |
+ <script src="../js/resources/js-test-pre.js"></script> |
+ <script> |
+ description('Test ensures that documentElement.scrollTop/Left properties are available by the time DOMContentLoaded event fires.'); |
+ // Navigation steps: |
+ // 1- page gets first loaded and scrolled. |
+ // 2- loaded page away and then 'back'. |
+ // Test: ensure that by the time DOMContenLoaded fires (after a back navigation), documentElement.scrollTop/Left are set. |
+ |
+ function init(evt) { |
+ if (window.name == 'second/load') { |
+ shouldBe('document.documentElement.scrollTop', '2000'); |
+ shouldBe('document.documentElement.scrollLeft', '1000'); |
+ window.name = ""; |
+ |
+ if (window.testRunner) |
+ finishJSTest(); |
+ } else { |
+ window.scrollTo(1000, 2000); |
+ |
+ window.name = "second/load"; |
+ setTimeout('window.location = "data:text/html,<script>history.back();</scr" + "ipt>"', 0); |
+ } |
+ } |
+ |
+ window.addEventListener('DOMContentLoaded', init, true); |
+ window.onunload = function() {} // prevent caching |
+ |
+ var jsTestIsAsync = true; |
+ </script> |
+ <body> |
+ <div id="overflow" style='width: 9999px; height:9999px; float:left;'></div> |
+ <h1 id='console'/> |
+ </body> |
+ <script src="../js/resources/js-test-post.js"></script> |
+</html> |