1
0
Fork 0
firefox/testing/web-platform/tests/content-security-policy/support/prefetch-with-csp.html
Daniel Baumann 5e9a113729
Adding upstream version 140.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
2025-06-25 09:37:52 +02:00

19 lines
707 B
HTML

<!DOCTYPE html>
<html>
<head>
<script>
let link = document.createElement("link");
link.rel = "prefetch";
const bc = new BroadcastChannel(new URLSearchParams(location.search).get("uid"));
link.addEventListener("error", e => bc.postMessage(false));
link.href = "pass.png";
document.head.appendChild(link);
const observer = new PerformanceObserver(entries => {
const found = entries.getEntriesByName(new URL("pass.png", location.href).href);
if (found.length)
bc.postMessage(found[0].encodedBodySize > 0);
});
observer.observe({entryTypes: ["resource"]});
</script>
</head>
</html>