Skip to content
This repository was archived by the owner on Jul 9, 2025. It is now read-only.

Commit d32bab5

Browse files
committed
Bug 1637781 [wpt PR 23581] - Origin isolation: add non-isolated subdomain WPTs, a=testonly
Automatic update from web-platform-tests Origin isolation: add non-isolated subdomain WPTs Bug: 1067389, 1042415 Change-Id: I5edc60736200bf8335ff1ff9422d53d8fea52569 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2199909 Reviewed-by: James MacLean <wjmaclean@chromium.org> Commit-Queue: Domenic Denicola <domenic@chromium.org> Cr-Commit-Position: refs/heads/master@{#774210} -- wpt-commits: 9ce780e6a023d92cca6b7cb2e3da621fe8e34acc wpt-pr: 23581 Differential Revision: https://phabricator.services.mozilla.com/D78789
1 parent 7bced77 commit d32bab5

4 files changed

+158
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
<!DOCTYPE html>
2+
<meta charset="utf-8">
3+
<title>Parent is isolated, subdomain child 1 is not isolated, different-subdomain child 2 is not isolated</title>
4+
<script src="/resources/testharness.js"></script>
5+
<script src="/resources/testharnessreport.js"></script>
6+
7+
<div id="log"></div>
8+
9+
<script type="module">
10+
import { insertIframe, sendWasmModule, setBothDocumentDomains,
11+
sendWasmModuleBetween, accessDocumentBetween } from "./resources/helpers.mjs";
12+
13+
let frameWindow1, frameWindow2;
14+
promise_setup(async () => {
15+
// Order of loading should not matter, but we make it sequential to ensure the
16+
// tests are deterministic.
17+
frameWindow1 = await insertIframe("{{hosts[][www]}}");
18+
frameWindow2 = await insertIframe("{{hosts[][www1]}}");
19+
20+
await setBothDocumentDomains(frameWindow1);
21+
await setBothDocumentDomains(frameWindow2);
22+
});
23+
24+
25+
// Since everybody is different-origin, everyone's requests/non-requests get
26+
// respected.
27+
//
28+
// So, the parent ends up in its origin-keyed agent cluster, and child 1 and
29+
// child 2 both end up in the site-keyed agent cluster.
30+
31+
promise_test(async () => {
32+
const whatHappened = await sendWasmModule(frameWindow1);
33+
34+
assert_equals(whatHappened, "messageerror");
35+
}, "Parent to child1: messageerror event must occur");
36+
37+
promise_test(async () => {
38+
assert_throws_dom("SecurityError", DOMException, () => {
39+
frameWindow1.document;
40+
});
41+
}, "Parent to child1: setting document.domain must not give sync access");
42+
43+
promise_test(async () => {
44+
const whatHappened = await sendWasmModule(frameWindow2);
45+
46+
assert_equals(whatHappened, "messageerror");
47+
}, "Parent to child2: messageerror event must occur");
48+
49+
promise_test(async () => {
50+
assert_throws_dom("SecurityError", DOMException, () => {
51+
frameWindow2.document;
52+
});
53+
}, "Parent to child2: setting document.domain must not give sync access");
54+
55+
promise_test(async () => {
56+
const whatHappened = await sendWasmModuleBetween(frameWindow1, 1);
57+
58+
assert_equals(whatHappened, "WebAssembly.Module message received");
59+
}, "child1 to child2: message event must occur");
60+
61+
promise_test(async () => {
62+
const whatHappened = await accessDocumentBetween(frameWindow1, 1);
63+
64+
assert_equals(whatHappened, "accessed document successfully");
65+
}, "child1 to child2: setting document.domain must give sync access");
66+
67+
promise_test(async () => {
68+
const whatHappened = await sendWasmModuleBetween(frameWindow2, 0);
69+
70+
assert_equals(whatHappened, "WebAssembly.Module message received");
71+
}, "child2 to child1: message event must occur");
72+
73+
promise_test(async () => {
74+
const whatHappened = await accessDocumentBetween(frameWindow2, 0);
75+
76+
assert_equals(whatHappened, "accessed document successfully");
77+
}, "child2 to child1: setting document.domain must give sync access");
78+
</script>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Origin-Isolation: ?1
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
<!DOCTYPE html>
2+
<meta charset="utf-8">
3+
<title>Parent is isolated, subdomain child 1 is not isolated, same-subdomain child 2 is not isolated</title>
4+
<script src="/resources/testharness.js"></script>
5+
<script src="/resources/testharnessreport.js"></script>
6+
7+
<div id="log"></div>
8+
9+
<script type="module">
10+
import { insertIframe, sendWasmModule, setBothDocumentDomains,
11+
sendWasmModuleBetween, accessDocumentBetween } from "./resources/helpers.mjs";
12+
13+
let frameWindow1, frameWindow2;
14+
promise_setup(async () => {
15+
// Order of loading should not matter, but we make it sequential to ensure the
16+
// tests are deterministic.
17+
frameWindow1 = await insertIframe("{{hosts[][www]}}");
18+
frameWindow2 = await insertIframe("{{hosts[][www]}}");
19+
20+
await setBothDocumentDomains(frameWindow1);
21+
await setBothDocumentDomains(frameWindow2);
22+
});
23+
24+
25+
// Since everybody is different-origin, everyone's requests/non-requests get
26+
// respected.
27+
//
28+
// So, the parent ends up in its origin-keyed agent cluster, and child 1 and
29+
// child 2 both end up in the site-keyed agent cluster.
30+
31+
promise_test(async () => {
32+
const whatHappened = await sendWasmModule(frameWindow1);
33+
34+
assert_equals(whatHappened, "messageerror");
35+
}, "Parent to child1: messageerror event must occur");
36+
37+
promise_test(async () => {
38+
assert_throws_dom("SecurityError", DOMException, () => {
39+
frameWindow1.document;
40+
});
41+
}, "Parent to child1: setting document.domain must not give sync access");
42+
43+
promise_test(async () => {
44+
const whatHappened = await sendWasmModule(frameWindow2);
45+
46+
assert_equals(whatHappened, "messageerror");
47+
}, "Parent to child2: messageerror event must occur");
48+
49+
promise_test(async () => {
50+
assert_throws_dom("SecurityError", DOMException, () => {
51+
frameWindow2.document;
52+
});
53+
}, "Parent to child2: setting document.domain must not give sync access");
54+
55+
promise_test(async () => {
56+
const whatHappened = await sendWasmModuleBetween(frameWindow1, 1);
57+
58+
assert_equals(whatHappened, "WebAssembly.Module message received");
59+
}, "child1 to child2: message event must occur");
60+
61+
promise_test(async () => {
62+
const whatHappened = await accessDocumentBetween(frameWindow1, 1);
63+
64+
assert_equals(whatHappened, "accessed document successfully");
65+
}, "child1 to child2: setting document.domain must give sync access");
66+
67+
promise_test(async () => {
68+
const whatHappened = await sendWasmModuleBetween(frameWindow2, 0);
69+
70+
assert_equals(whatHappened, "WebAssembly.Module message received");
71+
}, "child2 to child1: message event must occur");
72+
73+
promise_test(async () => {
74+
const whatHappened = await accessDocumentBetween(frameWindow2, 0);
75+
76+
assert_equals(whatHappened, "accessed document successfully");
77+
}, "child2 to child1: setting document.domain must give sync access");
78+
</script>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Origin-Isolation: ?1

0 commit comments

Comments
 (0)