summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/fetch/private-network-access/preflight-cache.https.window.js
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 09:22:09 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 09:22:09 +0000
commit43a97878ce14b72f0981164f87f2e35e14151312 (patch)
tree620249daf56c0258faa40cbdcf9cfba06de2a846 /testing/web-platform/tests/fetch/private-network-access/preflight-cache.https.window.js
parentInitial commit. (diff)
downloadfirefox-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/fetch/private-network-access/preflight-cache.https.window.js')
-rw-r--r--testing/web-platform/tests/fetch/private-network-access/preflight-cache.https.window.js88
1 files changed, 88 insertions, 0 deletions
diff --git a/testing/web-platform/tests/fetch/private-network-access/preflight-cache.https.window.js b/testing/web-platform/tests/fetch/private-network-access/preflight-cache.https.window.js
new file mode 100644
index 0000000000..87dbf501f6
--- /dev/null
+++ b/testing/web-platform/tests/fetch/private-network-access/preflight-cache.https.window.js
@@ -0,0 +1,88 @@
+// META: script=/common/utils.js
+// META: script=resources/support.sub.js
+//
+// Spec: https://wicg.github.io/private-network-access/#cors-preflight
+//
+// These tests verify that PNA preflight responses are cached.
+//
+// TODO(https://crbug.com/1268312): We cannot currently test that cache
+// entries are keyed by target IP address space because that requires
+// loading the same URL from different IP address spaces, and the WPT
+// framework does not allow that.
+promise_test(async t => {
+ let uuid = token();
+ await fetchTest(t, {
+ source: { server: Server.HTTPS_PRIVATE },
+ target: {
+ server: Server.HTTPS_LOCAL,
+ behavior: {
+ preflight: PreflightBehavior.singlePreflight(uuid),
+ response: ResponseBehavior.allowCrossOrigin(),
+ },
+ },
+ expected: FetchTestResult.SUCCESS,
+ });
+ await fetchTest(t, {
+ source: { server: Server.HTTPS_PRIVATE },
+ target: {
+ server: Server.HTTPS_LOCAL,
+ behavior: {
+ preflight: PreflightBehavior.singlePreflight(uuid),
+ response: ResponseBehavior.allowCrossOrigin(),
+ },
+ },
+ expected: FetchTestResult.SUCCESS,
+ });
+}, "private to local: success.");
+
+promise_test(async t => {
+ let uuid = token();
+ await fetchTest(t, {
+ source: { server: Server.HTTPS_PUBLIC },
+ target: {
+ server: Server.HTTPS_LOCAL,
+ behavior: {
+ preflight: PreflightBehavior.singlePreflight(uuid),
+ response: ResponseBehavior.allowCrossOrigin(),
+ },
+ },
+ expected: FetchTestResult.SUCCESS,
+ });
+ await fetchTest(t, {
+ source: { server: Server.HTTPS_PUBLIC },
+ target: {
+ server: Server.HTTPS_LOCAL,
+ behavior: {
+ preflight: PreflightBehavior.singlePreflight(uuid),
+ response: ResponseBehavior.allowCrossOrigin(),
+ },
+ },
+ expected: FetchTestResult.SUCCESS,
+ });
+}, "public to local: success.");
+
+promise_test(async t => {
+ let uuid = token();
+ await fetchTest(t, {
+ source: { server: Server.HTTPS_PUBLIC },
+ target: {
+ server: Server.HTTPS_PRIVATE,
+ behavior: {
+ preflight: PreflightBehavior.singlePreflight(uuid),
+ response: ResponseBehavior.allowCrossOrigin(),
+ },
+ },
+ expected: FetchTestResult.SUCCESS,
+ });
+ await fetchTest(t, {
+ source: { server: Server.HTTPS_PUBLIC },
+ target: {
+ server: Server.HTTPS_PRIVATE,
+ behavior: {
+ preflight: PreflightBehavior.singlePreflight(uuid),
+ response: ResponseBehavior.allowCrossOrigin(),
+ },
+ },
+ expected: FetchTestResult.SUCCESS,
+ });
+}, "public to private: success."); \ No newline at end of file