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/fenced-frame/resources/history-length-outer-page-navigation-not-reflected-in-fenced-inner.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 'testing/web-platform/tests/fenced-frame/resources/history-length-outer-page-navigation-not-reflected-in-fenced-inner.html')
-rw-r--r-- | testing/web-platform/tests/fenced-frame/resources/history-length-outer-page-navigation-not-reflected-in-fenced-inner.html | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/testing/web-platform/tests/fenced-frame/resources/history-length-outer-page-navigation-not-reflected-in-fenced-inner.html b/testing/web-platform/tests/fenced-frame/resources/history-length-outer-page-navigation-not-reflected-in-fenced-inner.html new file mode 100644 index 0000000000..2bdb90ab64 --- /dev/null +++ b/testing/web-platform/tests/fenced-frame/resources/history-length-outer-page-navigation-not-reflected-in-fenced-inner.html @@ -0,0 +1,72 @@ +<!DOCTYPE html> +<script src="utils.js"></script> +<title>history-length-outer-page-navigation-not-reflected-in-fenced-inner</title> + +<body> +<script> +(async () => { + // This is a helper file that will servec as the document loaded inside + // a fenced frame b 'history-length-outer-page-navigation-not-reflected-in- + // fenced' Once loaded, it reports to the observed value of history.length to + // the server so that the outer document can assert the value is 1. + + const [fenced_history_length_key, outer_page_ready_for_next_navigation_key, + embed_scope, embed_scope_reporting] = + parseKeylist(); + + const url = new URL(location.href); + + if (embed_scope == "outer_page::iframe"){ + ////////////// BEGIN NAVIGATIONS + // This block performs a sequence of 'kNavigationLimit' navigations in: + // -- the iframe + const kNavigationLimit = 5 + + const url = new URL(location.href); + + // First, perform some real navigations as well as history.pushState to + // this same page. Normally this would increase `history.length`. + if (url.searchParams.get("navigationCount") == null) + url.searchParams.append("navigationCount", 1); + + let navigationCount = parseInt(url.searchParams.get("navigationCount")); + + if (navigationCount <= kNavigationLimit) { + url.searchParams.set('navigationCount', ++navigationCount); + location.href = url; + history.pushState({} , ""); + return; + } + ////////////// END + writeValueToServer(outer_page_ready_for_next_navigation_key, "READY"); + return + } + + if (embed_scope == embed_scope_reporting) { + // Observe 'history.length' from within the 'embed_scope_reporting', + // and report the results back to the outer page. + if (history.length == 1) { + writeValueToServer(fenced_history_length_key, + "PASS > " + " history.length: " + history.length); + } else { + writeValueToServer(fenced_history_length_key, + "FAIL > " + " history.length: " + history.length); + } + return + } + + if (embed_scope_reporting == "outer_page::fenced_frame::iframe") { + // Append an iframe to the 'outer_page::fenced_frame' to report + // history.length to the outer_page from within the iframe + const iframe = document.createElement('iframe'); + const embed_scope = "outer_page::fenced_frame::iframe"; + iframe.src = generateURL( + "history-length-outer-page-navigation-not-reflected-in-fenced-inner.html", + [fenced_history_length_key, outer_page_ready_for_next_navigation_key, + embed_scope, embed_scope_reporting]); + document.body.append(iframe); + return + } +})(); +</script> +</body>
\ No newline at end of file |