diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 17:32:43 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 17:32:43 +0000 |
commit | 6bf0a5cb5034a7e684dcc3500e841785237ce2dd (patch) | |
tree | a68f146d7fa01f0134297619fbe7e33db084e0aa /layout/generic/test/test_scroll_position_restore_no_bfcache.html | |
parent | Initial commit. (diff) | |
download | thunderbird-upstream.tar.xz thunderbird-upstream.zip |
Adding upstream version 1:115.7.0.upstream/1%115.7.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'layout/generic/test/test_scroll_position_restore_no_bfcache.html')
-rw-r--r-- | layout/generic/test/test_scroll_position_restore_no_bfcache.html | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/layout/generic/test/test_scroll_position_restore_no_bfcache.html b/layout/generic/test/test_scroll_position_restore_no_bfcache.html new file mode 100644 index 0000000000..abb390a327 --- /dev/null +++ b/layout/generic/test/test_scroll_position_restore_no_bfcache.html @@ -0,0 +1,37 @@ +<!doctype html> +<meta charset="utf-8"> +<title>Test for Bug 1269539</title> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script src="/tests/SimpleTest/paint_listener.js"></script> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> +<script> +SimpleTest.waitForExplicitFinish(); + +let loadCount = 0; +let childWin; +let targetScrollPosition; +function handlePageShow(persisted) { + ok(typeof persisted == "boolean", "Should get the persisted state from the pageshow event"); + ok(!persisted, "Shouldn't have gotten into the bfcache"); + is(childWin.getComputedStyle(childWin.document.body).color, "rgb(0, 255, 0)", "Sheet should have been applied"); + let scroller = childWin.document.querySelector("#scroll"); + if (loadCount == 0) { + loadCount++; + targetScrollPosition = childWin.innerHeight; + isnot(targetScrollPosition, 0, "Should scroll somewhere"); + scroller.scrollTo(0, childWin.innerHeight); + childWin.requestAnimationFrame(() => childWin.requestAnimationFrame(() => { + childWin.location.reload(); + })); + } else { + childWin.requestAnimationFrame(() => childWin.requestAnimationFrame(() => { + // Verify that the scroll position was retained + is(scroller.scrollTop, targetScrollPosition, "Should have restored the scroll position"); + childWin.close(); + SimpleTest.finish(); + })); + } +} + +childWin = window.open('file_scroll_position_restore_no_bfcache.html', '_blank'); +</script> |