Commit fc224cf2 authored by Domenic Denicola's avatar Domenic Denicola Committed by Commit Bot

Origin isolation: rename the getter (but leave an alias)

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: default avatarJames MacLean <wjmaclean@chromium.org>
Reviewed-by: default avatarNate Chapin <japhet@chromium.org>
Cr-Commit-Position: refs/heads/master@{#799235}
parent 9f6e999a
......@@ -1651,8 +1651,7 @@ void LocalDOMWindow::SetOriginPolicyIds(const Vector<String>& ids) {
origin_policy_ids_ = ids;
}
// TODO(https://crbug.com/1103866): rename to originIsolated
bool LocalDOMWindow::originIsolationRestricted() const {
bool LocalDOMWindow::originIsolated() const {
return GetAgent()->IsOriginIsolated();
}
......
......@@ -305,8 +305,7 @@ class CORE_EXPORT LocalDOMWindow final : public DOMWindow,
void SetOriginPolicyIds(const Vector<String>&);
// https://github.com/whatwg/html/pull/5545
// TODO(https://crbug.com/1103866): rename to originIsolated
bool originIsolationRestricted() const;
bool originIsolated() const;
// Idle callback extensions
int requestIdleCallback(V8IdleRequestCallback*, const IdleRequestOptions*);
......
......@@ -73,11 +73,12 @@
[Custom, NotEnumerable, CrossOrigin] getter object (DOMString name);
// the user agent
// includes an older version https://github.com/whatwg/html/pull/5545 (originIsolationRestricted)
// TODO(https://crbug.com/1103866): rename to originIsolated when the time comes
// includes an older version of originIsolated (originIsolationRestricted) to avoid breakage during origin trial
// TODO(https://crbug.com/1103866): remove the originIsolationRestricted alias before shipping
[Affects=Nothing, LogActivity=GetterOnly] readonly attribute Navigator navigator;
[LogActivity=GetterOnly, SecureContext, RuntimeEnabled=AppCache] readonly attribute ApplicationCache applicationCache;
[RuntimeEnabled=OriginIsolationHeader] readonly attribute boolean originIsolationRestricted;
[RuntimeEnabled=OriginIsolationHeader] readonly attribute boolean originIsolated;
[RuntimeEnabled=OriginIsolationHeader, ImplementedAs=originIsolated] readonly attribute boolean originIsolationRestricted;
// user prompts
[Measure, CallWith=ScriptState] void alert();
......
......@@ -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");
......
<!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>
<!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>
<!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>
......
<!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>
......
<!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>
......
<!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>
......
<!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>
......
<!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>
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);
};
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>
`;
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);
};
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);
};
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);
};
<!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>
......
<!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>
......
<!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>
......
<!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);
}
......
......@@ -186,6 +186,7 @@ PASS oldChildWindow.onwebkittransitionend is newChildWindow.onwebkittransitionen
PASS oldChildWindow.onwheel is newChildWindow.onwheel
PASS oldChildWindow.opener is newChildWindow.opener
PASS oldChildWindow.origin is newChildWindow.origin
PASS oldChildWindow.originIsolated is newChildWindow.originIsolated
PASS oldChildWindow.originIsolationRestricted is newChildWindow.originIsolationRestricted
PASS oldChildWindow.outerHeight is newChildWindow.outerHeight
PASS oldChildWindow.outerWidth is newChildWindow.outerWidth
......
......@@ -151,6 +151,7 @@ PASS childWindow.onwebkittransitionend is null
PASS childWindow.onwheel is null
PASS childWindow.opener is null
PASS childWindow.origin is 'file://'
PASS childWindow.originIsolated is false
PASS childWindow.originIsolationRestricted is false
PASS childWindow.outerHeight is 0
PASS childWindow.outerWidth is 0
......
......@@ -151,6 +151,7 @@ PASS childWindow.onwebkittransitionend is null
PASS childWindow.onwheel is null
PASS childWindow.opener is null
PASS childWindow.origin is 'file://'
PASS childWindow.originIsolated is false
PASS childWindow.originIsolationRestricted is false
PASS childWindow.outerHeight is 0
PASS childWindow.outerWidth is 0
......
This is a testharness.js-based test.
PASS Before: messageerror event must occur
PASS Before: setting document.domain must not give sync access
PASS parent: originIsolationRestricted must equal true
PASS child1: originIsolationRestricted must equal false
PASS parent: originIsolated must equal true
PASS child1: originIsolated must equal false
PASS Remove the iframe and insert new ones
PASS Parent to child2: messageerror event must occur
PASS Parent to child2: setting document.domain must not give sync access
......@@ -12,7 +12,7 @@ FAIL child2 to child3: message event must occur assert_equals: expected "WebAsse
FAIL child2 to child3: setting document.domain must give sync access assert_equals: expected "accessed document successfully" but got "SecurityError"
FAIL child3 to child2: message event must occur assert_equals: expected "WebAssembly.Module message received" but got "messageerror"
FAIL child3 to child2: setting document.domain must give sync access assert_equals: expected "accessed document successfully" but got "SecurityError"
FAIL child2: originIsolationRestricted must equal false assert_equals: expected false but got true
PASS child3: originIsolationRestricted must equal false
FAIL child2: originIsolated must equal false assert_equals: expected false but got true
PASS child3: originIsolated must equal false
Harness: the test ran to completion.
......@@ -11901,6 +11901,7 @@ interface webkitURL
getter onwheel
getter opener
getter origin
getter originIsolated
getter originIsolationRestricted
getter originPolicyIds
getter outerHeight
......
<!DOCTYPE html>
<meta charset="utf-8">
<title>The legacy originIsolationRestricted getter still exists for now</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<!--
We're keeping originIsolationRestricted as an alias to originIsolated for
the duration of the origin trial, to avoid breaking any code that depends on it.
This test can be deleted when we finish off https://crbug.com/1103866 by
removing the alias.
-->
<script type="module">
test(() => {
assert_equals(window.originIsolationRestricted, window.originIsolated,
"legacy getter value must equal the new getter value");
assert_equals(window.originIsolationRestricted, true,
"the getters must return true for this very simple isolation case");
});
</script>
Origin-Trial: AkwBfk9Djiu2sKAuVhMLUQ3ldCM8nF0QD6eQpx7wWSnmhMs7udZelhv2iJfIjYuj5j77L3htLCv/dAuv/ttfUQEAAABmeyJvcmlnaW4iOiAiaHR0cHM6Ly93ZWItcGxhdGZvcm0udGVzdDo4NDQ0IiwgImZlYXR1cmUiOiAiT3JpZ2luSXNvbGF0aW9uSGVhZGVyIiwgImV4cGlyeSI6IDIwMDAwMDAwMDB9
Origin-Isolation: ?1
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment