Bug 1659560 [wpt PR 25052] - Origin isolation: rename the getter (but leave an alias), a=testonly

Automatic update from web-platform-tests
Origin isolation: rename the getter (but leave an alias) (#25052)

This renames window.originIsolationRestricted to window.originIsolated
per the latest spec changes. This largely amounts to massive test
updates.

window.originIsolationRestricted is retained as an alias for the
duration of the origin trial so as to avoid breaking deployed code, and
a wpt_internal test ensures this.

Bug: 1103866
Change-Id: I4f570c79d19dc783d40beb3549d677555d1c81af
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2353013
Commit-Queue: Domenic Denicola <domenic@chromium.org>
Reviewed-by: James MacLean <wjmaclean@chromium.org>
Reviewed-by: Nate Chapin <japhet@chromium.org>
Cr-Commit-Position: refs/heads/master@{#799235}

Co-authored-by: Domenic Denicola <domenic@chromium.org>
--

wpt-commits: 44055a7919612fc8c51f273968da9f49b4ad4cab
wpt-pr: 25052
This commit is contained in:
Blink WPT Bot 2020-08-21 09:32:07 +00:00 коммит произвёл moz-wptsync-bot
Родитель cd5f07d424
Коммит 43be680e71
51 изменённых файлов: 166 добавлений и 170 удалений

Просмотреть файл

@ -10,7 +10,7 @@
import {
insertIframe,
testSameAgentCluster,
testOriginIsolationRestricted
testGetter
} from "../resources/helpers.mjs";
let frameIndex = 0;
@ -21,7 +21,7 @@ for (const badValue of ["", "?0", "true", "\"?1\"", "1", "?2", "(?1)"]) {
// Since the header values are bad there should be no isolation
testSameAgentCluster([self, frameIndex], `"${badValue}"`);
testOriginIsolationRestricted(frameIndex, false, `"${badValue}"`);
testGetter(frameIndex, false, `"${badValue}"`);
++frameIndex;
}
</script>

Просмотреть файл

@ -10,7 +10,7 @@
import {
insertIframe,
testSameAgentCluster,
testOriginIsolationRestricted
testGetter
} from "../resources/helpers.mjs";
promise_setup(async () => {
@ -20,6 +20,6 @@ promise_setup(async () => {
// Since they're same-origin, and the parent loaded without isolation, the
// child's request for isolation gets ignored, and both end up site-keyed.
testSameAgentCluster([self, 0]);
testOriginIsolationRestricted(self, false, "parent");
testOriginIsolationRestricted(0, false, "child");
testGetter(self, false, "parent");
testGetter(0, false, "child");
</script>

Просмотреть файл

@ -10,7 +10,7 @@
import {
insertIframe,
testDifferentAgentClusters,
testOriginIsolationRestricted
testGetter
} from "../resources/helpers.mjs";
promise_setup(async () => {
@ -21,6 +21,6 @@ promise_setup(async () => {
// so the parent ends up in the site-keyed agent cluster and the child in the
// origin-keyed one.
testDifferentAgentClusters([self, 0]);
testOriginIsolationRestricted(self, false, "parent");
testOriginIsolationRestricted(0, true, "child");
testGetter(self, false, "parent");
testGetter(0, true, "child");
</script>

Просмотреть файл

@ -10,7 +10,7 @@
import {
insertIframe,
testDifferentAgentClusters,
testOriginIsolationRestricted
testGetter
} from "../resources/helpers.mjs";
promise_setup(async () => {
@ -21,6 +21,6 @@ promise_setup(async () => {
// so the parent ends up in the site-keyed agent cluster and the child in the
// origin-keyed one.
testDifferentAgentClusters([self, 0]);
testOriginIsolationRestricted(self, false, "parent");
testOriginIsolationRestricted(0, true, "child");
testGetter(self, false, "parent");
testGetter(0, true, "child");
</script>

Просмотреть файл

@ -10,7 +10,7 @@
import {
insertIframe,
testSameAgentCluster,
testOriginIsolationRestricted
testGetter
} from "../resources/helpers.mjs";
promise_setup(async () => {
@ -21,6 +21,6 @@ promise_setup(async () => {
// child's non-request for isolation gets ignored, and both end up origin-keyed.
testSameAgentCluster([self, 0]);
testOriginIsolationRestricted(self, true, "parent");
testOriginIsolationRestricted(0, true, "child");
testGetter(self, true, "parent");
testGetter(0, true, "child");
</script>

Просмотреть файл

@ -10,7 +10,7 @@
import {
insertIframe,
testDifferentAgentClusters,
testOriginIsolationRestricted
testGetter
} from "../resources/helpers.mjs";
promise_setup(async () => {
@ -22,6 +22,6 @@ promise_setup(async () => {
// agent cluster and the child ends up in the site-keyed one.
testDifferentAgentClusters([self, 0]);
testOriginIsolationRestricted(self, true, "parent");
testOriginIsolationRestricted(0, false, "child");
testGetter(self, true, "parent");
testGetter(0, false, "child");
</script>

Просмотреть файл

@ -10,7 +10,7 @@
import {
insertIframe,
testSameAgentCluster,
testOriginIsolationRestricted
testGetter
} from "../resources/helpers.mjs";
promise_setup(async () => {
@ -21,6 +21,6 @@ promise_setup(async () => {
// same origin-keyed agent cluster.
testSameAgentCluster([self, 0]);
testOriginIsolationRestricted(self, true, "parent");
testOriginIsolationRestricted(0, true, "child");
testGetter(self, true, "parent");
testGetter(0, true, "child");
</script>

Просмотреть файл

@ -10,7 +10,7 @@
import {
insertIframe,
testDifferentAgentClusters,
testOriginIsolationRestricted
testGetter
} from "../resources/helpers.mjs";
promise_setup(async () => {
@ -22,6 +22,6 @@ promise_setup(async () => {
// origin-keyed agent cluster (the www subdomain's origin).
testDifferentAgentClusters([self, 0]);
testOriginIsolationRestricted(self, true, "parent");
testOriginIsolationRestricted(0, true, "child");
testGetter(self, true, "parent");
testGetter(0, true, "child");
</script>

Просмотреть файл

@ -10,7 +10,7 @@
import {
insertIframe,
testSameAgentCluster,
testOriginIsolationRestricted
testGetter
} from "../resources/helpers.mjs";
promise_setup(async () => {
@ -30,7 +30,7 @@ testSameAgentCluster([self, 1], "Parent to child2");
testSameAgentCluster([0, 1], "child1 to child2");
testSameAgentCluster([1, 0], "child2 to child1");
testOriginIsolationRestricted(self, false, "parent");
testOriginIsolationRestricted(0, false, "child1");
testOriginIsolationRestricted(1, false, "child2");
testGetter(self, false, "parent");
testGetter(0, false, "child1");
testGetter(1, false, "child2");
</script>

Просмотреть файл

@ -11,7 +11,7 @@ import {
insertIframe,
testSameAgentCluster,
testDifferentAgentClusters,
testOriginIsolationRestricted
testGetter
} from "../resources/helpers.mjs";
promise_setup(async () => {
@ -32,7 +32,7 @@ testDifferentAgentClusters([self, 1], "Parent to child2");
testDifferentAgentClusters([0, 1], "child1 to child2");
testDifferentAgentClusters([1, 0], "child2 to child1");
testOriginIsolationRestricted(self, false, "parent");
testOriginIsolationRestricted(0, false, "child1");
testOriginIsolationRestricted(1, true, "child2");
testGetter(self, false, "parent");
testGetter(0, false, "child1");
testGetter(1, true, "child2");
</script>

Просмотреть файл

@ -11,7 +11,7 @@ import {
insertIframe,
testSameAgentCluster,
testDifferentAgentClusters,
testOriginIsolationRestricted
testGetter
} from "../resources/helpers.mjs";
promise_setup(async () => {
@ -31,7 +31,7 @@ testSameAgentCluster([self, 1], "Parent to child2");
testDifferentAgentClusters([0, 1], "child1 to child2");
testDifferentAgentClusters([1, 0], "child2 to child1");
testOriginIsolationRestricted(self, false, "parent");
testOriginIsolationRestricted(0, true, "child1");
testOriginIsolationRestricted(1, false, "child2");
testGetter(self, false, "parent");
testGetter(0, true, "child1");
testGetter(1, false, "child2");
</script>

Просмотреть файл

@ -11,7 +11,7 @@ import {
insertIframe,
testSameAgentCluster,
testDifferentAgentClusters,
testOriginIsolationRestricted
testGetter
} from "../resources/helpers.mjs";
promise_setup(async () => {
@ -32,7 +32,7 @@ testDifferentAgentClusters([self, 1], "Parent to child2");
testSameAgentCluster([0, 1], "child1 to child2");
testSameAgentCluster([1, 0], "child2 to child1");
testOriginIsolationRestricted(self, false, "parent");
testOriginIsolationRestricted(0, true, "child1");
testOriginIsolationRestricted(1, true, "child2");
testGetter(self, false, "parent");
testGetter(0, true, "child1");
testGetter(1, true, "child2");
</script>

Просмотреть файл

@ -11,7 +11,7 @@ import {
insertIframe,
testSameAgentCluster,
testDifferentAgentClusters,
testOriginIsolationRestricted
testGetter
} from "../resources/helpers.mjs";
promise_setup(async () => {
@ -32,7 +32,7 @@ testDifferentAgentClusters([self, 1], "Parent to child2");
testSameAgentCluster([0, 1], "child1 to child2");
testSameAgentCluster([1, 0], "child2 to child1");
testOriginIsolationRestricted(self, true, "parent");
testOriginIsolationRestricted(0, false, "child1");
testOriginIsolationRestricted(1, false, "child2");
testGetter(self, true, "parent");
testGetter(0, false, "child1");
testGetter(1, false, "child2");
</script>

Просмотреть файл

@ -11,7 +11,7 @@ import {
insertIframe,
testSameAgentCluster,
testDifferentAgentClusters,
testOriginIsolationRestricted
testGetter
} from "../resources/helpers.mjs";
promise_setup(async () => {
@ -32,7 +32,7 @@ testDifferentAgentClusters([self, 1], "Parent to child2");
testSameAgentCluster([0, 1], "child1 to child2");
testSameAgentCluster([1, 0], "child2 to child1");
testOriginIsolationRestricted(self, true, "parent");
testOriginIsolationRestricted(0, false, "child1");
testOriginIsolationRestricted(1, false, "child2");
testGetter(self, true, "parent");
testGetter(0, false, "child1");
testGetter(1, false, "child2");
</script>

Просмотреть файл

@ -11,7 +11,7 @@ import {
insertIframe,
testSameAgentCluster,
testDifferentAgentClusters,
testOriginIsolationRestricted
testGetter
} from "../resources/helpers.mjs";
promise_setup(async () => {
@ -32,7 +32,7 @@ testDifferentAgentClusters([self, 1], "Parent to child2");
testSameAgentCluster([0, 1], "child1 to child2");
testSameAgentCluster([1, 0], "child2 to child1");
testOriginIsolationRestricted(self, true, "parent");
testOriginIsolationRestricted(0, false, "child1");
testOriginIsolationRestricted(1, false, "child2");
testGetter(self, true, "parent");
testGetter(0, false, "child1");
testGetter(1, false, "child2");
</script>

Просмотреть файл

@ -10,7 +10,7 @@
import {
insertIframe,
testDifferentAgentClusters,
testOriginIsolationRestricted
testGetter
} from "../resources/helpers.mjs";
promise_setup(async () => {
@ -32,7 +32,7 @@ testDifferentAgentClusters([self, 1], "Parent to child2");
testDifferentAgentClusters([0, 1], "child1 to child2");
testDifferentAgentClusters([1, 0], "child2 to child1");
testOriginIsolationRestricted(self, true, "parent");
testOriginIsolationRestricted(0, false, "child1");
testOriginIsolationRestricted(1, true, "child2");
testGetter(self, true, "parent");
testGetter(0, false, "child1");
testGetter(1, true, "child2");
</script>

Просмотреть файл

@ -10,7 +10,7 @@
import {
insertIframe,
testDifferentAgentClusters,
testOriginIsolationRestricted
testGetter
} from "../resources/helpers.mjs";
promise_setup(async () => {
@ -30,7 +30,7 @@ testDifferentAgentClusters([self, 1], "Parent to child2");
testDifferentAgentClusters([0, 1], "child1 to child2");
testDifferentAgentClusters([1, 0], "child2 to child1");
testOriginIsolationRestricted(self, true, "parent");
testOriginIsolationRestricted(0, true, "child1");
testOriginIsolationRestricted(1, false, "child2");
testGetter(self, true, "parent");
testGetter(0, true, "child1");
testGetter(1, false, "child2");
</script>

Просмотреть файл

@ -11,7 +11,7 @@ import {
insertIframe,
testSameAgentCluster,
testDifferentAgentClusters,
testOriginIsolationRestricted
testGetter
} from "../resources/helpers.mjs";
promise_setup(async () => {
@ -32,7 +32,7 @@ testDifferentAgentClusters([self, 1], "Parent to child2");
testSameAgentCluster([0, 1], "child1 to child2");
testSameAgentCluster([1, 0], "child2 to child1");
testOriginIsolationRestricted(self, true, "parent");
testOriginIsolationRestricted(0, true, "child1");
testOriginIsolationRestricted(1, true, "child2");
testGetter(self, true, "parent");
testGetter(0, true, "child1");
testGetter(1, true, "child2");
</script>

Просмотреть файл

@ -11,7 +11,7 @@ import {
insertIframe,
testSameAgentCluster,
testDifferentAgentClusters,
testOriginIsolationRestricted
testGetter
} from "../resources/helpers.mjs";
promise_setup(async () => {
@ -33,7 +33,7 @@ testDifferentAgentClusters([self, 1], "Parent to child2");
testSameAgentCluster([0, 1], "child1 to child2");
testSameAgentCluster([1, 0], "child2 to child1");
testOriginIsolationRestricted(self, true, "parent");
testOriginIsolationRestricted(0, true, "child1");
testOriginIsolationRestricted(1, true, "child2");
testGetter(self, true, "parent");
testGetter(0, true, "child1");
testGetter(1, true, "child2");
</script>

Просмотреть файл

@ -10,7 +10,7 @@
import {
insertIframe,
testDifferentAgentClusters,
testOriginIsolationRestricted
testGetter
} from "../resources/helpers.mjs";
promise_setup(async () => {
@ -32,7 +32,7 @@ testDifferentAgentClusters([self, 1], "Parent to child2");
testDifferentAgentClusters([0, 1], "child1 to child2");
testDifferentAgentClusters([1, 0], "child2 to child1");
testOriginIsolationRestricted(self, true, "parent");
testOriginIsolationRestricted(0, true, "child1");
testOriginIsolationRestricted(1, true, "child2");
testGetter(self, true, "parent");
testGetter(0, true, "child1");
testGetter(1, true, "child2");
</script>

Просмотреть файл

@ -12,7 +12,7 @@ import {
setBothDocumentDomains,
testSameAgentCluster,
testDifferentAgentClusters,
testOriginIsolationRestricted
testGetter
} from "./resources/helpers.mjs";
promise_setup(async () => {
@ -26,9 +26,9 @@ testSameAgentCluster([self, 0], "parent to about:blank");
testDifferentAgentClusters([0, 1], "about:blank to child2");
testDifferentAgentClusters([1, 0], "child2 to about:blank");
testOriginIsolationRestricted(self, true, "parent");
testOriginIsolationRestricted(0, true, "about:blank");
testOriginIsolationRestricted(1, false, "child2");
testGetter(self, true, "parent");
testGetter(0, true, "about:blank");
testGetter(1, false, "child2");
async function insertAboutBlankIframe() {
const iframe = document.createElement("iframe");

Просмотреть файл

@ -1,15 +1,15 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>window.originIsolationRestricted for a top-level frame sandboxed by CSP with no Origin-Isolation header</title>
<title>window.originIsolated for a top-level frame sandboxed by CSP with no Origin-Isolation header</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
<script type="module">
import { testOriginIsolationRestricted } from "../resources/helpers.mjs";
import { testGetter } from "../resources/helpers.mjs";
// Even without the header, sandboxing makes this page have an opaque origin,
// so it is origin-isolated.
testOriginIsolationRestricted(self, true);
testGetter(self, true);
</script>

Просмотреть файл

@ -1,15 +1,15 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>window.originIsolationRestricted for a top-level frame sandboxed by CSP with an Origin-Isolation header</title>
<title>window.originIsolated for a top-level frame sandboxed by CSP with an Origin-Isolation header</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
<script type="module">
import { testOriginIsolationRestricted } from "../resources/helpers.mjs";
import { testGetter } from "../resources/helpers.mjs";
// We're definitely origin-isolated: both the CSP sandboxing and the
// Origin-Isolation header should ensure this.
testOriginIsolationRestricted(self, true);
testGetter(self, true);
</script>

Просмотреть файл

@ -1,6 +1,6 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>window.originIsolationRestricted for a javascript: URL navigated to from a data: URL on a non-isolated page</title>
<title>window.originIsolated for a javascript: URL navigated to from a data: URL on a non-isolated page</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>

Просмотреть файл

@ -1,6 +1,6 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>window.originIsolationRestricted for a javascript: URL navigated to from a data: URL on an isolated page</title>
<title>window.originIsolated for a javascript: URL navigated to from a data: URL on an isolated page</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>

Просмотреть файл

@ -1,6 +1,6 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>window.originIsolationRestricted for a data: URL on a non-isolated page</title>
<title>window.originIsolated for a data: URL on a non-isolated page</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>

Просмотреть файл

@ -1,6 +1,6 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>window.originIsolationRestricted for a javascript: URL on a non-isolated page</title>
<title>window.originIsolated for a javascript: URL on a non-isolated page</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>

Просмотреть файл

@ -1,6 +1,6 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>window.originIsolationRestricted for a javascript: URL on an isolated page</title>
<title>window.originIsolated for a javascript: URL on an isolated page</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>

Просмотреть файл

@ -1,13 +1,9 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>window.originIsolationRestricted for a removed frame</title>
<title>window.originIsolated for a removed frame</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<!-- TODO(domenic): update this to test window.originIsolated, not
window.originIsolationRestricted. See
https://github.com/WICG/origin-isolation/pull/34. -->
<div id="log"></div>
<script type="module">
@ -24,8 +20,8 @@ promise_test(async () => {
const frameWindow = iframe.contentWindow;
assert_equals(frameWindow.originIsolationRestricted, true, "before");
assert_equals(frameWindow.originIsolated, true, "before");
iframe.remove();
assert_equals(frameWindow.originIsolationRestricted, true, "after");
}, "Removing the iframe does not change originIsolationRestricted");
assert_equals(frameWindow.originIsolated, true, "after");
}, "Removing the iframe does not change originIsolated");
</script>

Просмотреть файл

@ -1,5 +1,5 @@
import { insertCustomIframe, testSupportScript } from "./helpers.mjs";
import { waitForIframe, testOriginIsolationRestricted } from "../../resources/helpers.mjs";
import { waitForIframe, testGetter } from "../../resources/helpers.mjs";
const testSupportScriptSuitableForNesting =
testSupportScript.replace('</script>', '</scri` + `pt>');
@ -29,5 +29,5 @@ export default () => {
// The javascript: URL iframe inherits its origin from the previous occupant
// of the iframe, which is a data: URL, so it should always be true.
testOriginIsolationRestricted(0, true);
testGetter(0, true);
};

Просмотреть файл

@ -1,5 +1,5 @@
import { insertCustomIframe, testSupportScript } from "./helpers.mjs";
import { testOriginIsolationRestricted } from "../../resources/helpers.mjs";
import { testGetter } from "../../resources/helpers.mjs";
export default () => {
promise_setup(() => {
@ -9,5 +9,5 @@ export default () => {
// The data: URL iframe has an opaque origin, so it should return true, since
// for them site === origin so they are always "origin-isolated".
testOriginIsolationRestricted(0, true, "data: URL child");
testGetter(0, true, "data: URL child");
};

Просмотреть файл

@ -18,12 +18,12 @@ export async function insertCustomIframe(src) {
/**
* This is the part of send-origin-isolation-header.py that allows
* us to reuse testOriginIsolationRestricted.
* us to reuse testGetter.
*/
export const testSupportScript = `
<script>
window.onmessage = () => {
parent.postMessage(self.originIsolationRestricted, "*");
parent.postMessage(self.originIsolated, "*");
};
</script>
`;

Просмотреть файл

@ -1,5 +1,5 @@
import { insertCustomIframe, testSupportScript } from "./helpers.mjs";
import { testOriginIsolationRestricted } from "../../resources/helpers.mjs";
import { testGetter } from "../../resources/helpers.mjs";
export default ({ expected }) => {
promise_setup(() => {
@ -10,5 +10,5 @@ export default ({ expected }) => {
// of the iframe, which is about:blank, which in turn inherits from the
// parent. So, the caller needs to tell us what to expect.
testOriginIsolationRestricted(0, expected);
testGetter(0, expected);
};

Просмотреть файл

@ -1,6 +1,6 @@
import {
navigateIframe,
testOriginIsolationRestricted
testGetter
} from "../../resources/helpers.mjs";
export default () => {
@ -16,5 +16,5 @@ export default () => {
// Sandboxed iframes have an opaque origin, so it should return true, since
// for them site === origin so they are always "origin-isolated".
testOriginIsolationRestricted(0, true);
testGetter(0, true);
};

Просмотреть файл

@ -1,6 +1,6 @@
import {
navigateIframe,
testOriginIsolationRestricted
testGetter
} from "../../resources/helpers.mjs";
export default ({ expected }) => {
@ -16,5 +16,5 @@ export default ({ expected }) => {
// Since the allow-same-origin token is set, this should behave like a normal
// iframe, and follow the embedder.
testOriginIsolationRestricted(0, expected);
testGetter(0, expected);
};

Просмотреть файл

@ -1,6 +1,6 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>window.originIsolationRestricted for a sandboxed iframe on a non-isolated page</title>
<title>window.originIsolated for a sandboxed iframe on a non-isolated page</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>

Просмотреть файл

@ -1,6 +1,6 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>window.originIsolationRestricted for a sandboxed iframe on an isolated page</title>
<title>window.originIsolated for a sandboxed iframe on an isolated page</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>

Просмотреть файл

@ -1,6 +1,6 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>window.originIsolationRestricted for a sandboxed, but same-origin, iframe on a non-isolated page</title>
<title>window.originIsolated for a sandboxed, but same-origin, iframe on a non-isolated page</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>

Просмотреть файл

@ -1,6 +1,6 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>window.originIsolationRestricted for a sandboxed, but same-origin, iframe on an isolated page</title>
<title>window.originIsolated for a sandboxed, but same-origin, iframe on an isolated page</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>

Просмотреть файл

@ -13,7 +13,7 @@ import {
setBothDocumentDomains,
testSameAgentCluster,
testDifferentAgentClusters,
testOriginIsolationRestricted
testGetter
} from "../resources/helpers.mjs";
let frame1;
@ -24,8 +24,8 @@ promise_setup(async () => {
// Nobody requested isolation yet.
testSameAgentCluster([self, 0], "Before: parent to child");
testOriginIsolationRestricted(self, false, "before parent");
testOriginIsolationRestricted(0, false, "before child");
testGetter(self, false, "before parent");
testGetter(0, false, "before child");
promise_test(async () => {
await navigateIframe(frame1, "{{hosts[][]}}:{{ports[https][1]}}", "?1");
@ -35,6 +35,6 @@ promise_test(async () => {
// Since the new page is different-origin, it should be isolated.
testDifferentAgentClusters([self, 0], "After: parent to child");
testOriginIsolationRestricted(self, false, "after parent");
testOriginIsolationRestricted(0, true, "after child");
testGetter(self, false, "after parent");
testGetter(0, true, "after child");
</script>

Просмотреть файл

@ -13,7 +13,7 @@ import {
setBothDocumentDomains,
testSameAgentCluster,
testDifferentAgentClusters,
testOriginIsolationRestricted
testGetter
} from "../resources/helpers.mjs";
let frame1;
@ -24,8 +24,8 @@ promise_setup(async () => {
// Nobody requested isolation yet.
testSameAgentCluster([self, 0], "Before: parent to child");
testOriginIsolationRestricted(self, false, "before parent");
testOriginIsolationRestricted(0, false, "before child");
testGetter(self, false, "before parent");
testGetter(0, false, "before child");
promise_test(async () => {
await navigateIframe(frame1, "{{hosts[][www]}}", "?1");
@ -35,6 +35,6 @@ promise_test(async () => {
// Since the new page is different-origin, it should be isolated.
testDifferentAgentClusters([self, 0], "After: parent to child");
testOriginIsolationRestricted(self, false, "after parent");
testOriginIsolationRestricted(0, true, "after child");
testGetter(self, false, "after parent");
testGetter(0, true, "after child");
</script>

Просмотреть файл

@ -12,7 +12,7 @@ import {
navigateIframe,
setBothDocumentDomains,
testSameAgentCluster,
testOriginIsolationRestricted
testGetter
} from "../resources/helpers.mjs";
let frame1;
@ -23,8 +23,8 @@ promise_setup(async () => {
// Nobody requested isolation yet.
testSameAgentCluster([self, 0], "Before: parent to child");
testOriginIsolationRestricted(self, false, "before parent");
testOriginIsolationRestricted(0, false, "before child");
testGetter(self, false, "before parent");
testGetter(0, false, "before child");
promise_test(async () => {
await navigateIframe(frame1, "{{hosts[][www]}}", "?1");
@ -35,6 +35,6 @@ promise_test(async () => {
// isolation request is ignored; instead we continue isolating.
testSameAgentCluster([self, 0], "After: parent to child");
testOriginIsolationRestricted(self, false, "after parent");
testOriginIsolationRestricted(0, false, "after child");
testGetter(self, false, "after parent");
testGetter(0, false, "after child");
</script>

Просмотреть файл

@ -13,7 +13,7 @@ import {
setBothDocumentDomains,
testSameAgentCluster,
testDifferentAgentClusters,
testOriginIsolationRestricted
testGetter
} from "../resources/helpers.mjs";
let frame1;
@ -24,8 +24,8 @@ promise_setup(async () => {
// Nobody requested isolation yet.
testSameAgentCluster([self, 0], "Before: parent to child");
testOriginIsolationRestricted(self, false, "before parent");
testOriginIsolationRestricted(0, false, "before child");
testGetter(self, false, "before parent");
testGetter(0, false, "before child");
promise_test(async () => {
await navigateIframe(frame1, "{{hosts[][www1]}}", "?1");
@ -36,6 +36,6 @@ promise_test(async () => {
// isolation request is respected.
testDifferentAgentClusters([self, 0], "After: parent to child");
testOriginIsolationRestricted(self, false, "after parent");
testOriginIsolationRestricted(0, true, "after child");
testGetter(self, false, "after parent");
testGetter(0, true, "after child");
</script>

Просмотреть файл

@ -13,7 +13,7 @@ import {
setBothDocumentDomains,
testSameAgentCluster,
testDifferentAgentClusters,
testOriginIsolationRestricted
testGetter
} from "../resources/helpers.mjs";
let frame1;
@ -24,8 +24,8 @@ promise_setup(async () => {
// Since they are different-origin, the child's isolation request is respected.
testDifferentAgentClusters([self, 0], "Before: parent to child");
testOriginIsolationRestricted(self, false, "before parent");
testOriginIsolationRestricted(0, true, "before child");
testGetter(self, false, "before parent");
testGetter(0, true, "before child");
promise_test(async () => {
await navigateIframe(frame1, "{{hosts[][www1]}}");
@ -36,6 +36,6 @@ promise_test(async () => {
// doesn't somehow get isolated just because its predecessor was.
testSameAgentCluster([self, 0], "After: parent to child");
testOriginIsolationRestricted(self, false, "after parent");
testOriginIsolationRestricted(0, false, "after child");
testGetter(self, false, "after parent");
testGetter(0, false, "after child");
</script>

Просмотреть файл

@ -12,7 +12,7 @@ import {
navigateIframe,
setBothDocumentDomains,
testDifferentAgentClusters,
testOriginIsolationRestricted
testGetter
} from "../resources/helpers.mjs";
let frame1;
@ -23,8 +23,8 @@ promise_setup(async () => {
// Since they are different-origin, the child's isolation request is respected.
testDifferentAgentClusters([self, 0], "Before: parent to child");
testOriginIsolationRestricted(self, false, "before parent");
testOriginIsolationRestricted(0, true, "before child");
testGetter(self, false, "before parent");
testGetter(0, true, "before child");
promise_test(async () => {
await navigateIframe(frame1, "{{hosts[][www]}}");
@ -35,6 +35,6 @@ promise_test(async () => {
// non-isolation request is ignored; instead we continue isolating.
testDifferentAgentClusters([self, 0], "After: parent to child");
testOriginIsolationRestricted(self, false, "after parent");
testOriginIsolationRestricted(0, true, "after child");
testGetter(self, false, "after parent");
testGetter(0, true, "after child");
</script>

Просмотреть файл

@ -13,7 +13,7 @@ import {
setBothDocumentDomains,
testSameAgentCluster,
testDifferentAgentClusters,
testOriginIsolationRestricted
testGetter
} from "../resources/helpers.mjs";
let frame1;
@ -25,8 +25,8 @@ promise_setup(async () => {
// so it gets isolated too.
testSameAgentCluster([self, 0], "Before: parent to child");
testOriginIsolationRestricted(self, true, "before parent");
testOriginIsolationRestricted(0, true, "before child");
testGetter(self, true, "before parent");
testGetter(0, true, "before child");
promise_test(async () => {
await navigateIframe(frame1, "{{hosts[][]}}:{{ports[https][1]}}");
@ -36,6 +36,6 @@ promise_test(async () => {
// Since the new page is different-origin, its non-request should be respected.
testDifferentAgentClusters([self, 0], "After: parent to child");
testOriginIsolationRestricted(self, true, "after parent");
testOriginIsolationRestricted(0, false, "after child");
testGetter(self, true, "after parent");
testGetter(0, false, "after child");
</script>

Просмотреть файл

@ -13,7 +13,7 @@ import {
setBothDocumentDomains,
testSameAgentCluster,
testDifferentAgentClusters,
testOriginIsolationRestricted
testGetter
} from "../resources/helpers.mjs";
let frame1;
@ -25,8 +25,8 @@ promise_setup(async () => {
// so it gets isolated too.
testSameAgentCluster([self, 0], "Before: parent to child");
testOriginIsolationRestricted(self, true, "before parent");
testOriginIsolationRestricted(0, true, "before child");
testGetter(self, true, "before parent");
testGetter(0, true, "before child");
promise_test(async () => {
await navigateIframe(frame1, "{{hosts[][www]}}");
@ -36,6 +36,6 @@ promise_test(async () => {
// Since the new page is different-origin, its non-request should be respected.
testDifferentAgentClusters([self, 0], "After: parent to child");
testOriginIsolationRestricted(self, true, "after parent");
testOriginIsolationRestricted(0, false, "after child");
testGetter(self, true, "after parent");
testGetter(0, false, "after child");
</script>

Просмотреть файл

@ -10,7 +10,7 @@
import {
insertIframe,
testSameAgentCluster,
testOriginIsolationRestricted
testGetter
} from "./resources/helpers.mjs";
promise_setup(async () => {
@ -21,6 +21,6 @@ promise_setup(async () => {
// So both end up in the site-keyed agent cluster.
testSameAgentCluster([self, 0]);
testOriginIsolationRestricted(self, false, "parent");
testOriginIsolationRestricted(0, false, "child");
testGetter(self, false, "parent");
testGetter(0, false, "child");
</script>

Просмотреть файл

@ -11,7 +11,7 @@ import {
insertIframe,
testSameAgentCluster,
testDifferentAgentClusters,
testOriginIsolationRestricted
testGetter
} from "./resources/helpers.mjs";
let frame1;
@ -23,8 +23,8 @@ promise_setup(async () => {
// as is the child's non-request. So the parent ends up in the origin-keyed
// agent cluster and the child ends up in the site-keyed one.
testDifferentAgentClusters([self, 0], "Before");
testOriginIsolationRestricted(self, true, "parent");
testOriginIsolationRestricted(0, false, "child1");
testGetter(self, true, "parent");
testGetter(0, false, "child1");
promise_test(async () => {
frame1.remove();
@ -41,6 +41,6 @@ testDifferentAgentClusters([self, 1], "Parent to child3");
testSameAgentCluster([0, 1], "child2 to child3");
testSameAgentCluster([1, 0], "child3 to child2");
testOriginIsolationRestricted(0, false, "child2");
testOriginIsolationRestricted(1, false, "child3");
testGetter(0, false, "child2");
testGetter(1, false, "child3");
</script>

Просмотреть файл

@ -38,8 +38,8 @@ window.onmessage = async (e) => {
} else {
parent.postMessage("something wierd happened", "*");
}
} else if (e.data.command === "get originIsolationRestricted") {
parent.postMessage(self.originIsolationRestricted, "*");
} else if (e.data.command === "get originIsolated") {
parent.postMessage(self.originIsolated, "*");
}
// We could also receive e.data === "WebAssembly.Module message received",

Просмотреть файл

@ -177,28 +177,28 @@ export function testDifferentAgentClusters(testFrames, testLabelPrefix) {
}
/**
* Creates a promise_test() to check the value of the originIsolationRestricted
* getter in the given testFrame.
* Creates a promise_test() to check the value of the originIsolated getter in
* the given testFrame.
* @param {Window|number} testFrame - Either self, or a frame index to test.
* @param {boolean} expected - The expected value for originIsolationRestricted.
* @param {boolean} expected - The expected value for originIsolated.
* @param {string=} testLabelPrefix - A prefix used in the test names. This can
* be omitted if the function is only used once in a test file.
*/
export function testOriginIsolationRestricted(testFrame, expected, testLabelPrefix) {
export function testGetter(testFrame, expected, testLabelPrefix) {
const prefix = testLabelPrefix === undefined ? "" : `${testLabelPrefix}: `;
if (testFrame === self) {
// Need to use promise_test() even though it's sync because we use
// promise_setup() in many tests.
promise_test(async () => {
assert_equals(self.originIsolationRestricted, expected);
}, `${prefix}originIsolationRestricted must equal ${expected}`);
assert_equals(self.originIsolated, expected);
}, `${prefix}originIsolated must equal ${expected}`);
} else {
promise_test(async () => {
const frameWindow = frames[testFrame];
const result = await getOriginIsolationRestricted(frameWindow);
const result = await accessOriginIsolated(frameWindow);
assert_equals(result, expected);
}, `${prefix}originIsolationRestricted must equal ${expected}`);
}, `${prefix}originIsolated must equal ${expected}`);
}
}
@ -241,10 +241,10 @@ export async function setBothDocumentDomains(frameWindow) {
assert_equals(whatHappened, "document.domain is set");
}
async function getOriginIsolationRestricted(frameWindow) {
async function accessOriginIsolated(frameWindow) {
// This function is coupled to ./send-origin-isolation-header.py, which ensures
// that sending such a message will result in a message back.
frameWindow.postMessage({ command: "get originIsolationRestricted" }, "*");
frameWindow.postMessage({ command: "get originIsolated" }, "*");
return waitForMessage(frameWindow);
}