summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/client-hints/sandbox
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 00:47:55 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 00:47:55 +0000
commit26a029d407be480d791972afb5975cf62c9360a6 (patch)
treef435a8308119effd964b339f76abb83a57c29483 /testing/web-platform/tests/client-hints/sandbox
parentInitial commit. (diff)
downloadfirefox-26a029d407be480d791972afb5975cf62c9360a6.tar.xz
firefox-26a029d407be480d791972afb5975cf62c9360a6.zip
Adding upstream version 124.0.1.upstream/124.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/web-platform/tests/client-hints/sandbox')
-rw-r--r--testing/web-platform/tests/client-hints/sandbox/__dir__.headers1
-rw-r--r--testing/web-platform/tests/client-hints/sandbox/iframe-csp-same-origin.https.html19
-rw-r--r--testing/web-platform/tests/client-hints/sandbox/iframe-csp-same-origin.https.html.headers1
-rw-r--r--testing/web-platform/tests/client-hints/sandbox/iframe-csp.https.html19
-rw-r--r--testing/web-platform/tests/client-hints/sandbox/iframe-csp.https.html.headers1
-rw-r--r--testing/web-platform/tests/client-hints/sandbox/iframe-iframe-popups.https.html19
-rw-r--r--testing/web-platform/tests/client-hints/sandbox/iframe-popups-escape-sandbox.https.html19
-rw-r--r--testing/web-platform/tests/client-hints/sandbox/iframe-popups.https.html19
-rw-r--r--testing/web-platform/tests/client-hints/sandbox/iframe-same-origin.https.html17
-rw-r--r--testing/web-platform/tests/client-hints/sandbox/iframe.https.html19
-rw-r--r--testing/web-platform/tests/client-hints/sandbox/resources/embedded-popup-expect-hints.html11
-rw-r--r--testing/web-platform/tests/client-hints/sandbox/resources/embedded-popup-expect-no-hints.html11
-rw-r--r--testing/web-platform/tests/client-hints/sandbox/resources/iframe-with-embedded-popup-expect-no-hints.html12
-rw-r--r--testing/web-platform/tests/client-hints/sandbox/resources/util.js25
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..4d4739028d
--- /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, sec-ch-prefers-reduced-transparency
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..96d2886f0e
--- /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"></iframe>
+</body>
+</html>
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