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-timing/resources | |
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/navigation-timing/resources')
16 files changed, 225 insertions, 0 deletions
diff --git a/testing/web-platform/tests/navigation-timing/resources/blank-page-green-with-onunload.html b/testing/web-platform/tests/navigation-timing/resources/blank-page-green-with-onunload.html new file mode 100644 index 0000000000..2f401747b0 --- /dev/null +++ b/testing/web-platform/tests/navigation-timing/resources/blank-page-green-with-onunload.html @@ -0,0 +1,11 @@ +<!DOCTYPE HTML> +<html> + <head> + <meta content="text/html; charset=utf-8" http-equiv="Content-Type" /> + <title>Green Test Page</title> + </head> + <!-- use onunload to ensure this does not trigger bfcache --> + <body style="background-color:#00FF00;" onunload="1;"> + <h1>Placeholder</h1> + </body> +</html> diff --git a/testing/web-platform/tests/navigation-timing/resources/blank-page-green.html b/testing/web-platform/tests/navigation-timing/resources/blank-page-green.html new file mode 100644 index 0000000000..b8a1947b77 --- /dev/null +++ b/testing/web-platform/tests/navigation-timing/resources/blank-page-green.html @@ -0,0 +1,10 @@ +<!DOCTYPE HTML> +<html> + <head> + <meta content="text/html; charset=utf-8" http-equiv="Content-Type" /> + <title>Green Test Page</title> + </head> + <body style="background-color:#00FF00;"> + <h1>Placeholder</h1> + </body> +</html> diff --git a/testing/web-platform/tests/navigation-timing/resources/blank-page-meta-redirect.html b/testing/web-platform/tests/navigation-timing/resources/blank-page-meta-redirect.html new file mode 100644 index 0000000000..4b4bda096c --- /dev/null +++ b/testing/web-platform/tests/navigation-timing/resources/blank-page-meta-redirect.html @@ -0,0 +1,11 @@ +<!DOCTYPE HTML> +<html> + <head> + <meta content="text/html; charset=utf-8" http-equiv="Content-Type" /> + <meta http-equiv="refresh" content="1;URL='blank-page-green.html'" /> + <title>Redirect Placeholder</title> + </head> + <body style="background-color:#FFFF00";> + <h1>Placeholder</h1> + </body> +</html> diff --git a/testing/web-platform/tests/navigation-timing/resources/blank-page-unload.html b/testing/web-platform/tests/navigation-timing/resources/blank-page-unload.html new file mode 100644 index 0000000000..bb2a27f168 --- /dev/null +++ b/testing/web-platform/tests/navigation-timing/resources/blank-page-unload.html @@ -0,0 +1,25 @@ +<!DOCTYPE HTML> +<html> + <head> + <meta content="text/html; charset=utf-8" http-equiv="Content-Type" /> + + <title>Yellow Test Page</title> + + <script type="text/javascript"> + function onbeforeunload_handler() + { + var temp = "onbeforeunload"; + } + + function onunload_handler() + { + var temp = "onunload"; + } + </script> + </head> + <body onbeforeunload="onbeforeunload_handler();" + onunload="onunload_handler();" + style="background-color:#FFFF00;"> + <h1>Unload</h1> + </body> +</html> diff --git a/testing/web-platform/tests/navigation-timing/resources/blank-page-yellow-with-onunload.html b/testing/web-platform/tests/navigation-timing/resources/blank-page-yellow-with-onunload.html new file mode 100644 index 0000000000..771e0701d9 --- /dev/null +++ b/testing/web-platform/tests/navigation-timing/resources/blank-page-yellow-with-onunload.html @@ -0,0 +1,11 @@ +<!DOCTYPE HTML> +<html> + <head> + <meta content="text/html; charset=utf-8" http-equiv="Content-Type" /> + <title>Yellow Test Page</title> + </head> + <!-- use onunload to ensure this does not trigger bfcache --> + <body style="background-color:#FFFF00;" onunload="1;"> + <h1>Placeholder</h1> + </body> +</html>
\ No newline at end of file diff --git a/testing/web-platform/tests/navigation-timing/resources/blank-page-yellow.html b/testing/web-platform/tests/navigation-timing/resources/blank-page-yellow.html new file mode 100644 index 0000000000..4e5e1a000c --- /dev/null +++ b/testing/web-platform/tests/navigation-timing/resources/blank-page-yellow.html @@ -0,0 +1,10 @@ +<!DOCTYPE HTML> +<html> + <head> + <meta content="text/html; charset=utf-8" http-equiv="Content-Type" /> + <title>Yellow Test Page</title> + </head> + <body style="background-color:#FFFF00;"> + <h1>Placeholder</h1> + </body> +</html>
\ No newline at end of file diff --git a/testing/web-platform/tests/navigation-timing/resources/blank_page_prefetch.html b/testing/web-platform/tests/navigation-timing/resources/blank_page_prefetch.html new file mode 100644 index 0000000000..1112ca28ec --- /dev/null +++ b/testing/web-platform/tests/navigation-timing/resources/blank_page_prefetch.html @@ -0,0 +1,27 @@ +<!DOCTYPE HTML> +<html> + +<head> + <meta content="text/html; charset=utf-8" http-equiv="Content-Type" /> + <title>Page to be Prefetched</title> + <script src="/common/dispatcher/dispatcher.js"></script> +</head> + +<body> + <script> + const pageshowPromise = new Promise(resolve => { + window.addEventListener('pageshow', resolve, { once: true }); + }); + + async function getTransferSize() { + await pageshowPromise; + return window.performance.getEntriesByType('navigation')[0].transferSize; + } + const params = new URLSearchParams(window.location.search); + const uuid = params.get("uuid"); + const executor = new Executor(uuid); + </script> + +</body> + +</html> diff --git a/testing/web-platform/tests/navigation-timing/resources/blank_page_prefetch.html.headers b/testing/web-platform/tests/navigation-timing/resources/blank_page_prefetch.html.headers new file mode 100644 index 0000000000..771aba7f94 --- /dev/null +++ b/testing/web-platform/tests/navigation-timing/resources/blank_page_prefetch.html.headers @@ -0,0 +1 @@ +Cache-Control: max-age=300 diff --git a/testing/web-platform/tests/navigation-timing/resources/iframe-prefetch-transfer-size.html b/testing/web-platform/tests/navigation-timing/resources/iframe-prefetch-transfer-size.html new file mode 100644 index 0000000000..fde01775b7 --- /dev/null +++ b/testing/web-platform/tests/navigation-timing/resources/iframe-prefetch-transfer-size.html @@ -0,0 +1,31 @@ +<!DOCTYPE html> +<html> + +<head> + <meta charset="utf-8" /> + <title>Iframe Transfer Size Prefetch</title> +</head> + +<body> + <p>Placeholder</p> + <script> + const urlToPrefetch = 'blank_page_prefetch.html'; + + function addLink() { + return new Promise(resolve => { + const link = document.createElement('link'); + link.onload = function () { resolve(); }; + link.rel = 'prefetch'; + link.as = 'document'; + link.href = urlToPrefetch; + document.body.appendChild(link); + }); + }; + + function navigateToPrefetchedUrl() { + document.location.href = urlToPrefetch; + } + </script> +</body> + +</html> diff --git a/testing/web-platform/tests/navigation-timing/resources/navigation-type-post-back.html b/testing/web-platform/tests/navigation-timing/resources/navigation-type-post-back.html new file mode 100644 index 0000000000..8c19a2f5a5 --- /dev/null +++ b/testing/web-platform/tests/navigation-timing/resources/navigation-type-post-back.html @@ -0,0 +1,10 @@ +<!DOCTYPE html> +<html> + +<body> + <form action="navigation_type_post_back.py" method="post"> + Post to page <button type="submit">Press to POST page</button> + </form> +</body> + +</html> diff --git a/testing/web-platform/tests/navigation-timing/resources/navigation_type_post_back.py b/testing/web-platform/tests/navigation-timing/resources/navigation_type_post_back.py new file mode 100644 index 0000000000..9da06f4f03 --- /dev/null +++ b/testing/web-platform/tests/navigation-timing/resources/navigation_type_post_back.py @@ -0,0 +1,12 @@ +# Accoridng to routes.py in the wpt server implementation, POST method is +# handled by a Python script handler which requires this file to return an html. +def main(request, response): + content = """ + <!DOCTYPE html> + <html> + <body> + <a href="blank_page_green.html">navigate away</a>. + </body> + </html> + """ + return content diff --git a/testing/web-platform/tests/navigation-timing/resources/performance-attribute-sender.html b/testing/web-platform/tests/navigation-timing/resources/performance-attribute-sender.html new file mode 100644 index 0000000000..99f544690d --- /dev/null +++ b/testing/web-platform/tests/navigation-timing/resources/performance-attribute-sender.html @@ -0,0 +1,13 @@ +<!DOCTYPE HTML> +<html> +<body> +<script> +parent.postMessage([ + performance.timing.connectStart, + performance.timing.navigationStart, + performance.timing.secureConnectionStart, + performance.timing.connectEnd +], '*'); +</script> +</body> +</html> diff --git a/testing/web-platform/tests/navigation-timing/resources/respond-slowly.py b/testing/web-platform/tests/navigation-timing/resources/respond-slowly.py new file mode 100644 index 0000000000..e58e16f1f0 --- /dev/null +++ b/testing/web-platform/tests/navigation-timing/resources/respond-slowly.py @@ -0,0 +1,29 @@ +import time + + +def main(request, response): + head = b"""<script> + let navigationTiming = performance.getEntriesByType('navigation')[0]; + let originalResponseEnd = navigationTiming.responseEnd; + let originalDuration = navigationTiming.duration; + function checkResponseEnd() { + let responseEndDuringLoadEvent = navigationTiming.responseEnd; + let durationDuringLoadEvent = navigationTiming.duration; + setTimeout(function() { + parent.postMessage([ + originalResponseEnd, + originalDuration, + responseEndDuringLoadEvent, + durationDuringLoadEvent, + navigationTiming.responseEnd, + navigationTiming.duration], '*'); + }, 0); + } + </script><body onload='checkResponseEnd()'>""" + response.headers.set(b"Content-Length", str(len(head) + 1000)) + response.headers.set(b"Content-Type", b"text/html") + response.write_status_headers() + response.writer.write_content(head) + for i in range(100): + response.writer.write_content(b"1234567890") + time.sleep(0.01) diff --git a/testing/web-platform/tests/navigation-timing/resources/secure-connection-interim.html b/testing/web-platform/tests/navigation-timing/resources/secure-connection-interim.html new file mode 100644 index 0000000000..e40b00bedb --- /dev/null +++ b/testing/web-platform/tests/navigation-timing/resources/secure-connection-interim.html @@ -0,0 +1,8 @@ +<!doctype html> +<script> + window.addEventListener("message", e => { + window.top.postMessage(e.data, "*"); + }); +</script> +<iframe src="secure-connection-test.html"> + diff --git a/testing/web-platform/tests/navigation-timing/resources/secure-connection-interim.html.headers b/testing/web-platform/tests/navigation-timing/resources/secure-connection-interim.html.headers new file mode 100644 index 0000000000..b70fbaf3b0 --- /dev/null +++ b/testing/web-platform/tests/navigation-timing/resources/secure-connection-interim.html.headers @@ -0,0 +1,3 @@ +Connection: Keep-Alive +Content-Length: 170 + diff --git a/testing/web-platform/tests/navigation-timing/resources/secure-connection-test.html b/testing/web-platform/tests/navigation-timing/resources/secure-connection-test.html new file mode 100644 index 0000000000..63a80e062b --- /dev/null +++ b/testing/web-platform/tests/navigation-timing/resources/secure-connection-test.html @@ -0,0 +1,13 @@ +<!doctype html> +<script> +const entries = performance.getEntriesByType("navigation"); +if (!entries) { + window.top.postMessage("FAIL - not supported", "*"); +} +const entry = entries[0]; +if (entry.secureConnectionStart != entry.fetchStart) { + window.top.postMessage("FAIL - unexpected secureConnectionStart value of " + + entry.secureConnectionStart + " does not equal " + entry.fetchStart, "*"); +} +window.top.postMessage("PASS", "*"); +</script> |