summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/html/cross-origin-embedder-policy/credentialless/cross-origin-isolated.window.js
diff options
context:
space:
mode:
Diffstat (limited to 'testing/web-platform/tests/html/cross-origin-embedder-policy/credentialless/cross-origin-isolated.window.js')
-rw-r--r--testing/web-platform/tests/html/cross-origin-embedder-policy/credentialless/cross-origin-isolated.window.js49
1 files changed, 49 insertions, 0 deletions
diff --git a/testing/web-platform/tests/html/cross-origin-embedder-policy/credentialless/cross-origin-isolated.window.js b/testing/web-platform/tests/html/cross-origin-embedder-policy/credentialless/cross-origin-isolated.window.js
new file mode 100644
index 0000000000..361739f283
--- /dev/null
+++ b/testing/web-platform/tests/html/cross-origin-embedder-policy/credentialless/cross-origin-isolated.window.js
@@ -0,0 +1,49 @@
+// META: script=/common/get-host-info.sub.js
+// META: script=/common/utils.js
+// META: script=/common/dispatcher/dispatcher.js
+// META: script=./resources/common.js
+
+const http = get_host_info().HTTP_ORIGIN;
+const https = get_host_info().HTTPS_ORIGIN;
+
+let crossOriginIsolatedTest = (
+ description,
+ origin ,
+ headers,
+ expect_crossOriginIsolated) => {
+ promise_test_parallel(async test => {
+ const w_token = token();
+ const w_url = origin + executor_path + headers + `&uuid=${w_token}`;
+ const w = window.open(w_url)
+ add_completion_callback(() => w.close());
+
+ const this_token = token();
+ send(w_token, `
+ if (window.crossOriginIsolated)
+ send("${this_token}", "crossOriginIsolated");
+ else
+ send("${this_token}", "not isolated")
+ `);
+ assert_equals(await receive(this_token), expect_crossOriginIsolated);
+ }, description);
+}
+
+crossOriginIsolatedTest("Main crossOriginIsolated case:",
+ https, coop_same_origin +
+ coep_credentialless, "crossOriginIsolated");
+
+crossOriginIsolatedTest("Missing HTTPS:",
+ http, coop_same_origin +
+ coep_credentialless, "not isolated");
+
+crossOriginIsolatedTest("Missing COOP:same-origin:",
+ https, coep_credentialless, "not isolated");
+
+crossOriginIsolatedTest("Report-only:",
+ https, coop_same_origin +
+ coep_report_only_credentialless, "not isolated");
+
+crossOriginIsolatedTest("Report-only + enforced:",
+ https, coop_same_origin +
+ coep_credentialless +
+ coep_report_only_credentialless, "crossOriginIsolated");