diff options
Diffstat (limited to 'testing/web-platform/tests/fetch/connection-pool/resources/network-partition-about-blank-checker.html')
-rw-r--r-- | testing/web-platform/tests/fetch/connection-pool/resources/network-partition-about-blank-checker.html | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/testing/web-platform/tests/fetch/connection-pool/resources/network-partition-about-blank-checker.html b/testing/web-platform/tests/fetch/connection-pool/resources/network-partition-about-blank-checker.html new file mode 100644 index 0000000000..7a8b613237 --- /dev/null +++ b/testing/web-platform/tests/fetch/connection-pool/resources/network-partition-about-blank-checker.html @@ -0,0 +1,35 @@ +<!doctype html> +<html> +<head> + <meta charset="utf-8"> + <title>about:blank Network Partition Checker</title> + <meta name="help" href="https://fetch.spec.whatwg.org/#network-partition-keys"> + <meta name="timeout" content="normal"> +</head> +<body> +<script> + async function fetch_and_reply() { + // Load about:blank in a new tab, and inject the network partition checking code into it. + var win; + try { + win = window.open(); + var url = 'SUBRESOURCE_PREFIX:&dispatch=fetch_file&path=fetch/connection-pool/resources/network-partition-checker.html&sandbox=true'; + var response = await fetch(url, {credentials: 'omit', mode: 'cors'}); + win.document.write(await response.text()); + } catch (e) { + win.close(); + window.parent.postMessage({result: 'error', details: e.message}, '*'); + return; + } + + // Listen for first message from the new window and pass it back to the parent. + function message_listener(event) { + window.parent.postMessage(event.data, '*'); + win.close(); + } + window.addEventListener('message', message_listener, {once: true}); + } + fetch_and_reply(); +</script> +</body> +</html> |