зеркало из https://github.com/mozilla/gecko-dev.git
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
This commit is contained in:
Родитель
728c66361c
Коммит
1c09ba52f9
|
@ -0,0 +1,78 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<title>Parent is isolated, subdomain child 1 is not isolated, different-subdomain child 2 is not isolated</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
|
||||
<div id="log"></div>
|
||||
|
||||
<script type="module">
|
||||
import { insertIframe, sendWasmModule, setBothDocumentDomains,
|
||||
sendWasmModuleBetween, accessDocumentBetween } from "./resources/helpers.mjs";
|
||||
|
||||
let frameWindow1, frameWindow2;
|
||||
promise_setup(async () => {
|
||||
// Order of loading should not matter, but we make it sequential to ensure the
|
||||
// tests are deterministic.
|
||||
frameWindow1 = await insertIframe("{{hosts[][www]}}");
|
||||
frameWindow2 = await insertIframe("{{hosts[][www1]}}");
|
||||
|
||||
await setBothDocumentDomains(frameWindow1);
|
||||
await setBothDocumentDomains(frameWindow2);
|
||||
});
|
||||
|
||||
|
||||
// Since everybody is different-origin, everyone's requests/non-requests get
|
||||
// respected.
|
||||
//
|
||||
// So, the parent ends up in its origin-keyed agent cluster, and child 1 and
|
||||
// child 2 both end up in the site-keyed agent cluster.
|
||||
|
||||
promise_test(async () => {
|
||||
const whatHappened = await sendWasmModule(frameWindow1);
|
||||
|
||||
assert_equals(whatHappened, "messageerror");
|
||||
}, "Parent to child1: messageerror event must occur");
|
||||
|
||||
promise_test(async () => {
|
||||
assert_throws_dom("SecurityError", DOMException, () => {
|
||||
frameWindow1.document;
|
||||
});
|
||||
}, "Parent to child1: setting document.domain must not give sync access");
|
||||
|
||||
promise_test(async () => {
|
||||
const whatHappened = await sendWasmModule(frameWindow2);
|
||||
|
||||
assert_equals(whatHappened, "messageerror");
|
||||
}, "Parent to child2: messageerror event must occur");
|
||||
|
||||
promise_test(async () => {
|
||||
assert_throws_dom("SecurityError", DOMException, () => {
|
||||
frameWindow2.document;
|
||||
});
|
||||
}, "Parent to child2: setting document.domain must not give sync access");
|
||||
|
||||
promise_test(async () => {
|
||||
const whatHappened = await sendWasmModuleBetween(frameWindow1, 1);
|
||||
|
||||
assert_equals(whatHappened, "WebAssembly.Module message received");
|
||||
}, "child1 to child2: message event must occur");
|
||||
|
||||
promise_test(async () => {
|
||||
const whatHappened = await accessDocumentBetween(frameWindow1, 1);
|
||||
|
||||
assert_equals(whatHappened, "accessed document successfully");
|
||||
}, "child1 to child2: setting document.domain must give sync access");
|
||||
|
||||
promise_test(async () => {
|
||||
const whatHappened = await sendWasmModuleBetween(frameWindow2, 0);
|
||||
|
||||
assert_equals(whatHappened, "WebAssembly.Module message received");
|
||||
}, "child2 to child1: message event must occur");
|
||||
|
||||
promise_test(async () => {
|
||||
const whatHappened = await accessDocumentBetween(frameWindow2, 0);
|
||||
|
||||
assert_equals(whatHappened, "accessed document successfully");
|
||||
}, "child2 to child1: setting document.domain must give sync access");
|
||||
</script>
|
|
@ -0,0 +1 @@
|
|||
Origin-Isolation: ?1
|
|
@ -0,0 +1,78 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<title>Parent is isolated, subdomain child 1 is not isolated, same-subdomain child 2 is not isolated</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
|
||||
<div id="log"></div>
|
||||
|
||||
<script type="module">
|
||||
import { insertIframe, sendWasmModule, setBothDocumentDomains,
|
||||
sendWasmModuleBetween, accessDocumentBetween } from "./resources/helpers.mjs";
|
||||
|
||||
let frameWindow1, frameWindow2;
|
||||
promise_setup(async () => {
|
||||
// Order of loading should not matter, but we make it sequential to ensure the
|
||||
// tests are deterministic.
|
||||
frameWindow1 = await insertIframe("{{hosts[][www]}}");
|
||||
frameWindow2 = await insertIframe("{{hosts[][www]}}");
|
||||
|
||||
await setBothDocumentDomains(frameWindow1);
|
||||
await setBothDocumentDomains(frameWindow2);
|
||||
});
|
||||
|
||||
|
||||
// Since everybody is different-origin, everyone's requests/non-requests get
|
||||
// respected.
|
||||
//
|
||||
// So, the parent ends up in its origin-keyed agent cluster, and child 1 and
|
||||
// child 2 both end up in the site-keyed agent cluster.
|
||||
|
||||
promise_test(async () => {
|
||||
const whatHappened = await sendWasmModule(frameWindow1);
|
||||
|
||||
assert_equals(whatHappened, "messageerror");
|
||||
}, "Parent to child1: messageerror event must occur");
|
||||
|
||||
promise_test(async () => {
|
||||
assert_throws_dom("SecurityError", DOMException, () => {
|
||||
frameWindow1.document;
|
||||
});
|
||||
}, "Parent to child1: setting document.domain must not give sync access");
|
||||
|
||||
promise_test(async () => {
|
||||
const whatHappened = await sendWasmModule(frameWindow2);
|
||||
|
||||
assert_equals(whatHappened, "messageerror");
|
||||
}, "Parent to child2: messageerror event must occur");
|
||||
|
||||
promise_test(async () => {
|
||||
assert_throws_dom("SecurityError", DOMException, () => {
|
||||
frameWindow2.document;
|
||||
});
|
||||
}, "Parent to child2: setting document.domain must not give sync access");
|
||||
|
||||
promise_test(async () => {
|
||||
const whatHappened = await sendWasmModuleBetween(frameWindow1, 1);
|
||||
|
||||
assert_equals(whatHappened, "WebAssembly.Module message received");
|
||||
}, "child1 to child2: message event must occur");
|
||||
|
||||
promise_test(async () => {
|
||||
const whatHappened = await accessDocumentBetween(frameWindow1, 1);
|
||||
|
||||
assert_equals(whatHappened, "accessed document successfully");
|
||||
}, "child1 to child2: setting document.domain must give sync access");
|
||||
|
||||
promise_test(async () => {
|
||||
const whatHappened = await sendWasmModuleBetween(frameWindow2, 0);
|
||||
|
||||
assert_equals(whatHappened, "WebAssembly.Module message received");
|
||||
}, "child2 to child1: message event must occur");
|
||||
|
||||
promise_test(async () => {
|
||||
const whatHappened = await accessDocumentBetween(frameWindow2, 0);
|
||||
|
||||
assert_equals(whatHappened, "accessed document successfully");
|
||||
}, "child2 to child1: setting document.domain must give sync access");
|
||||
</script>
|
|
@ -0,0 +1 @@
|
|||
Origin-Isolation: ?1
|
Загрузка…
Ссылка в новой задаче