summaryrefslogtreecommitdiffstats
path: root/docshell/test/navigation/file_scrollRestoration_bfcache_and_nobfcache.html
diff options
context:
space:
mode:
Diffstat (limited to 'docshell/test/navigation/file_scrollRestoration_bfcache_and_nobfcache.html')
-rw-r--r--docshell/test/navigation/file_scrollRestoration_bfcache_and_nobfcache.html30
1 files changed, 30 insertions, 0 deletions
diff --git a/docshell/test/navigation/file_scrollRestoration_bfcache_and_nobfcache.html b/docshell/test/navigation/file_scrollRestoration_bfcache_and_nobfcache.html
new file mode 100644
index 0000000000..fec51f821d
--- /dev/null
+++ b/docshell/test/navigation/file_scrollRestoration_bfcache_and_nobfcache.html
@@ -0,0 +1,30 @@
+<html>
+ <head>
+ <script>
+ // Ensure layout is flushed before doing anything with scrolling.
+ function flushAndExecute(callback) {
+ window.requestAnimationFrame(function() {
+ setTimeout(callback);
+ });
+ }
+
+ var bc = new BroadcastChannel("bfcached");
+ bc.onmessage = (msgEvent) => {
+ if (msgEvent.data == "loadNext") {
+ flushAndExecute(() => {
+ location.href = "file_scrollRestoration_bfcache_and_nobfcache_part2.html";
+ });
+ } else if (msgEvent.data == "forward") {
+ flushAndExecute(() => {
+ history.forward();
+ });
+ }
+ };
+ window.onpageshow = (event) => {
+ bc.postMessage({command: "pageshow", persisted: event.persisted});
+ };
+ </script>
+ </head>
+ <body>
+ </body>
+</html>