blob: a691dc8826659201ce66e56fa738b2eda7735d7d [file] [log] [blame]
<!DOCTYPE html>
<meta charset="utf-8">
<title>Origin-Trial header before Origin-Isolation header in parent; OT after OI in child</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<!-- This file is a modification of parent-yes-child-yes-subdomain.sub.https.html from the external WPT suite. -->
<div id="log"></div>
<script type="module">
import { sendWasmModule, setBothDocumentDomains } from "/origin-isolation/resources/helpers.mjs";
import { insertIframe } from "./resources/helpers.mjs";
let frameWindow;
promise_setup(async () => {
frameWindow = await insertIframe("{{hosts[][www]}}", "otoi");
});
// Both request isolation, so the parent ends up in one origin-keyed agent
// cluster (the base domain's origin), and the child ends up in a different
// origin-keyed agent cluster (the www subdomain's origin).
promise_test(async () => {
const whatHappened = await sendWasmModule(frameWindow);
assert_equals(whatHappened, "messageerror");
}, "messageerror event must occur");
promise_test(async () => {
await setBothDocumentDomains(frameWindow);
assert_throws_dom("SecurityError", DOMException, () => {
frameWindow.document;
});
}, "setting document.domain must not give sync access");
</script>