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 /testing/web-platform/tests/navigation-api/navigation-history-entry/entries-after-bfcache-in-iframe.html | |
parent | Initial commit. (diff) | |
download | thunderbird-6bf0a5cb5034a7e684dcc3500e841785237ce2dd.tar.xz thunderbird-6bf0a5cb5034a7e684dcc3500e841785237ce2dd.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 'testing/web-platform/tests/navigation-api/navigation-history-entry/entries-after-bfcache-in-iframe.html')
-rw-r--r-- | testing/web-platform/tests/navigation-api/navigation-history-entry/entries-after-bfcache-in-iframe.html | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/testing/web-platform/tests/navigation-api/navigation-history-entry/entries-after-bfcache-in-iframe.html b/testing/web-platform/tests/navigation-api/navigation-history-entry/entries-after-bfcache-in-iframe.html new file mode 100644 index 0000000000..b54a749950 --- /dev/null +++ b/testing/web-platform/tests/navigation-api/navigation-history-entry/entries-after-bfcache-in-iframe.html @@ -0,0 +1,36 @@ +<!doctype html> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/common/utils.js"></script> +<script src="/common/dispatcher/dispatcher.js"></script> +<script src="/html/browsers/browsing-the-web/back-forward-cache/resources/helper.sub.js"></script> +<script src="resources/is_uuid.js"></script> + +<script> +// This test ensures that navigation.entries() in an iframe is properly updated +// when a page is restored from bfcache. +// First, create an iframe and do a fragment navigation in it, so that its +// navigation.entries().length == 2. Then go back, so that entries()[0] is +// current. Finally, navigate the main window (which should clobber the +// the iframe's entries()[1]), and come back via bfcache. If the iframe's +// entries() were updated, then its entries().length should have been reduced +// to 1. +runBfcacheTest({ + targetOrigin: originSameOrigin, + funcBeforeNavigation: async () => { + window.events = []; + let i = document.createElement("iframe"); + i.src = "/common/blank.html"; + document.body.appendChild(i); + await new Promise(resolve => i.onload = () => setTimeout(resolve, 0)); + await i.contentWindow.navigation.navigate("#foo"); + await i.contentWindow.navigation.back(); + window.frames[0].navigation.entries()[1].ondispose = () => events.push("dispose"); + window.frames[0].onpageshow = () => events.push("pageshow"); + }, + async funcAfterAssertion(pageA, pageB) { + assert_equals(await pageA.execute_script(() => window.frames[0].navigation.entries().length), 1); + assert_array_equals(await pageA.execute_script(() => window.events), ["pageshow", "dispose"]); + } +}, "entries() in an iframe must be updated after navigating back to a bfcached page"); +</script> |