diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 09:22:09 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 09:22:09 +0000 |
commit | 43a97878ce14b72f0981164f87f2e35e14151312 (patch) | |
tree | 620249daf56c0258faa40cbdcf9cfba06de2a846 /testing/web-platform/tests/client-hints/sandbox | |
parent | Initial commit. (diff) | |
download | firefox-43a97878ce14b72f0981164f87f2e35e14151312.tar.xz firefox-43a97878ce14b72f0981164f87f2e35e14151312.zip |
Adding upstream version 110.0.1.upstream/110.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/web-platform/tests/client-hints/sandbox')
14 files changed, 193 insertions, 0 deletions
diff --git a/testing/web-platform/tests/client-hints/sandbox/__dir__.headers b/testing/web-platform/tests/client-hints/sandbox/__dir__.headers new file mode 100644 index 0000000000..f233c2e9d6 --- /dev/null +++ b/testing/web-platform/tests/client-hints/sandbox/__dir__.headers @@ -0,0 +1 @@ +Accept-CH: device-memory, dpr, width, viewport-width, rtt, downlink, ect, sec-ch-ua, sec-ch-ua-arch, sec-ch-ua-platform, sec-ch-ua-model, sec-ch-ua-mobile, sec-ch-ua-full-version, sec-ch-ua-platform-version, sec-ch-prefers-color-scheme, sec-ch-prefers-reduced-motion, sec-ch-ua-bitness, sec-ch-viewport-height, sec-ch-device-memory, sec-ch-dpr, sec-ch-width, sec-ch-viewport-width, sec-ch-ua-full-version-list, sec-ch-ua-wow64 diff --git a/testing/web-platform/tests/client-hints/sandbox/iframe-csp-same-origin.https.html b/testing/web-platform/tests/client-hints/sandbox/iframe-csp-same-origin.https.html new file mode 100644 index 0000000000..a5f094af9d --- /dev/null +++ b/testing/web-platform/tests/client-hints/sandbox/iframe-csp-same-origin.https.html @@ -0,0 +1,19 @@ +<!DOCTYPE html> +<html> + +<body> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/client-hints/resources/export.js"></script> +<script src="resources/util.js"></script> + +<script> + +sandbox_iframe_test("", + expect_iframe_hints, + "CSP sandboxed iframe with same-origin flag does send client hint headers"); + +</script> + +</body> +</html>
\ No newline at end of file diff --git a/testing/web-platform/tests/client-hints/sandbox/iframe-csp-same-origin.https.html.headers b/testing/web-platform/tests/client-hints/sandbox/iframe-csp-same-origin.https.html.headers new file mode 100644 index 0000000000..895eb51993 --- /dev/null +++ b/testing/web-platform/tests/client-hints/sandbox/iframe-csp-same-origin.https.html.headers @@ -0,0 +1 @@ +Content-Security-Policy: sandbox allow-scripts allow-same-origin
\ No newline at end of file diff --git a/testing/web-platform/tests/client-hints/sandbox/iframe-csp.https.html b/testing/web-platform/tests/client-hints/sandbox/iframe-csp.https.html new file mode 100644 index 0000000000..fb63c393fd --- /dev/null +++ b/testing/web-platform/tests/client-hints/sandbox/iframe-csp.https.html @@ -0,0 +1,19 @@ +<!DOCTYPE html> +<html> + +<body> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/client-hints/resources/export.js"></script> +<script src="resources/util.js"></script> + +<script> + +sandbox_iframe_test("", + expect_iframe_no_hints, + "CSP sandboxed iframe does not send client hint headers"); + +</script> + +</body> +</html>
\ No newline at end of file diff --git a/testing/web-platform/tests/client-hints/sandbox/iframe-csp.https.html.headers b/testing/web-platform/tests/client-hints/sandbox/iframe-csp.https.html.headers new file mode 100644 index 0000000000..c7e4e7cc5b --- /dev/null +++ b/testing/web-platform/tests/client-hints/sandbox/iframe-csp.https.html.headers @@ -0,0 +1 @@ +Content-Security-Policy: sandbox allow-scripts
\ No newline at end of file diff --git a/testing/web-platform/tests/client-hints/sandbox/iframe-iframe-popups.https.html b/testing/web-platform/tests/client-hints/sandbox/iframe-iframe-popups.https.html new file mode 100644 index 0000000000..9cbf6006c8 --- /dev/null +++ b/testing/web-platform/tests/client-hints/sandbox/iframe-iframe-popups.https.html @@ -0,0 +1,19 @@ +<!DOCTYPE html> +<html> + +<body> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/client-hints/resources/export.js"></script> +<script src="resources/util.js"></script> + +<script> + +sandbox_iframe_test("allow-scripts allow-popups", + "resources/iframe-with-embedded-popup-expect-no-hints.html", + "Popup from an iframe within a sandboxed iframe does not send hints"); + +</script> + +</body> +</html>
\ No newline at end of file diff --git a/testing/web-platform/tests/client-hints/sandbox/iframe-popups-escape-sandbox.https.html b/testing/web-platform/tests/client-hints/sandbox/iframe-popups-escape-sandbox.https.html new file mode 100644 index 0000000000..35a94b537d --- /dev/null +++ b/testing/web-platform/tests/client-hints/sandbox/iframe-popups-escape-sandbox.https.html @@ -0,0 +1,19 @@ +<!DOCTYPE html> +<html> + +<body> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/client-hints/resources/export.js"></script> +<script src="resources/util.js"></script> + +<script> + +sandbox_iframe_test("allow-scripts allow-popups allow-popups-to-escape-sandbox", + "resources/embedded-popup-expect-hints.html", + "popup from sandboxed iframe with allow-popups-to-escape-sandbox flag does send client hint headers"); + +</script> + +</body> +</html>
\ No newline at end of file diff --git a/testing/web-platform/tests/client-hints/sandbox/iframe-popups.https.html b/testing/web-platform/tests/client-hints/sandbox/iframe-popups.https.html new file mode 100644 index 0000000000..3d7bc6eb80 --- /dev/null +++ b/testing/web-platform/tests/client-hints/sandbox/iframe-popups.https.html @@ -0,0 +1,19 @@ +<!DOCTYPE html> +<html> + +<body> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/client-hints/resources/export.js"></script> +<script src="resources/util.js"></script> + +<script> + +sandbox_iframe_test("allow-scripts allow-popups", + "resources/embedded-popup-expect-no-hints.html", + "popup from sandboxed iframe does not send client hint headers"); + +</script> + +</body> +</html>
\ No newline at end of file diff --git a/testing/web-platform/tests/client-hints/sandbox/iframe-same-origin.https.html b/testing/web-platform/tests/client-hints/sandbox/iframe-same-origin.https.html new file mode 100644 index 0000000000..0ea6a8ed53 --- /dev/null +++ b/testing/web-platform/tests/client-hints/sandbox/iframe-same-origin.https.html @@ -0,0 +1,17 @@ +<!DOCTYPE html> +<html> + +<body> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/client-hints/resources/export.js"></script> +<script src="resources/util.js"></script> + +<script> +sandbox_iframe_test("allow-scripts allow-same-origin", + expect_iframe_hints, + "Same origin sandboxed iframe with allow-same-origin flag does send client hint headers"); +</script> + +</body> +</html>
\ No newline at end of file diff --git a/testing/web-platform/tests/client-hints/sandbox/iframe.https.html b/testing/web-platform/tests/client-hints/sandbox/iframe.https.html new file mode 100644 index 0000000000..f37b91011b --- /dev/null +++ b/testing/web-platform/tests/client-hints/sandbox/iframe.https.html @@ -0,0 +1,19 @@ +<!DOCTYPE html> +<html> + +<body> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/client-hints/resources/export.js"></script> +<script src="resources/util.js"></script> + +<script> + +sandbox_iframe_test("allow-scripts", + expect_iframe_no_hints, + "sandboxed iframe does not send client hint headers"); + +</script> + +</body> +</html>
\ No newline at end of file diff --git a/testing/web-platform/tests/client-hints/sandbox/resources/embedded-popup-expect-hints.html b/testing/web-platform/tests/client-hints/sandbox/resources/embedded-popup-expect-hints.html new file mode 100644 index 0000000000..6cd5f0a29e --- /dev/null +++ b/testing/web-platform/tests/client-hints/sandbox/resources/embedded-popup-expect-hints.html @@ -0,0 +1,11 @@ +<!DOCTYPE html> +<html> +<body> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="util.js"></script> +<script> +sandbox_popup_listener("/client-hints/resources/expect-client-hints-headers.html"); +</script> +</body> +</html>
\ No newline at end of file diff --git a/testing/web-platform/tests/client-hints/sandbox/resources/embedded-popup-expect-no-hints.html b/testing/web-platform/tests/client-hints/sandbox/resources/embedded-popup-expect-no-hints.html new file mode 100644 index 0000000000..46dbb7f236 --- /dev/null +++ b/testing/web-platform/tests/client-hints/sandbox/resources/embedded-popup-expect-no-hints.html @@ -0,0 +1,11 @@ +<!DOCTYPE html> +<html> +<body> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="util.js"></script> +<script> +sandbox_popup_listener("/client-hints/resources/expect-no-client-hints-headers.html"); +</script> +</body> +</html>
\ No newline at end of file diff --git a/testing/web-platform/tests/client-hints/sandbox/resources/iframe-with-embedded-popup-expect-no-hints.html b/testing/web-platform/tests/client-hints/sandbox/resources/iframe-with-embedded-popup-expect-no-hints.html new file mode 100644 index 0000000000..21efd76180 --- /dev/null +++ b/testing/web-platform/tests/client-hints/sandbox/resources/iframe-with-embedded-popup-expect-no-hints.html @@ -0,0 +1,12 @@ +<!DOCTYPE html> +<html> +<body> +<script> + window.addEventListener('message', e => { + window.parent.postMessage(e.data, '*'); + }); + +</script> +<iframe src="embedded-popup-expect-no-hints.html" /> +</body> +</html>
\ No newline at end of file diff --git a/testing/web-platform/tests/client-hints/sandbox/resources/util.js b/testing/web-platform/tests/client-hints/sandbox/resources/util.js new file mode 100644 index 0000000000..8c25e5ad8b --- /dev/null +++ b/testing/web-platform/tests/client-hints/sandbox/resources/util.js @@ -0,0 +1,25 @@ +function sandbox_iframe_test(sandbox, src, title) { + return promise_test(async t => { + const iframe = document.createElement("iframe"); + if (sandbox !== "") + iframe.sandbox = sandbox; + iframe.src = src; + + let msg = await new Promise(resolve => { + window.addEventListener('message', resolve); + document.body.appendChild(iframe); + }); + + assert_equals(msg.data, "PASS", "message from opened frame"); + await fetch("/client-hints/accept-ch-stickiness/resources/clear-site-data.html"); + }, title); +} + +function sandbox_popup_listener(src) { + window.addEventListener('message', e => { + window.parent.postMessage(e.data, '*'); + }); + + let popup_window = window.open("/resources/blank.html"); + popup_window.location.href = src; +}
\ No newline at end of file |