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

Origin isolation: finish off popup test coverage

As part of this, we fix a bug in send-header-page-script.mjs which was
not correctly reading the "send-loaded-message" query parameter. In the
less-comprehensive tests that were there previously, the buggy code
still worked, but these new tests brought out the problem.

Bug: 1042415
Change-Id: Id34c627d1d7fdd41727f3db362ada25a6651498f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2364172
Commit-Queue: Domenic Denicola <domenic@chromium.org>
Reviewed-by: default avatarJames MacLean <wjmaclean@chromium.org>
Cr-Commit-Position: refs/heads/master@{#799870}
parent 3f46ac3b
......@@ -24,3 +24,8 @@ Other directories have variations on this, e.g. `1-iframe/` does the same thing
but for a single `child` instead of `child1` and `child2`, and `navigation/`
uses `1` and `2` to represent the two different locations the single iframe will
be navigated to.
## Coverage
Header parsing is covered by a few tests in the `1-iframe/` subdirectory, and
not duplicated to all other scenarios.
......@@ -21,7 +21,6 @@ promise_setup(async () => {
// Since they're different-origin, the openee's isolation request is respected,
// so the opener ends up in the site-keyed agent cluster and the openee in the
// origin-keyed one.
testOpenedWindowIsInADifferentAgentCluster(() => openee);
testGetter(self, false, "opener");
......
......@@ -20,7 +20,6 @@ promise_setup(async () => {
// Since they're same-origin, and the opener loaded without isolation, the
// child's request for isolation gets ignored, and both end up site-keyed.
testOpenedWindowIsInSameAgentCluster(() => openee);
testGetter(self, false, "opener");
......
<!DOCTYPE html>
<meta charset="utf-8">
<title>Opener is not isolated, openee is isolated, openee is a subdomain of the opener</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
<script type="module">
import {
openWindow,
testOpenedWindowIsInADifferentAgentCluster,
testGetter
} from "../resources/helpers.mjs";
let openee;
promise_setup(async () => {
openee = await openWindow("{{hosts[][www]}}", "?1");
});
// Since they're different-origin, the openee's isolation request is respected,
// so the opener ends up in the site-keyed agent cluster and the openee in the
// origin-keyed one.
testOpenedWindowIsInADifferentAgentCluster(() => openee);
testGetter(self, false, "opener");
testGetter(() => openee, true, "openee");
</script>
<!DOCTYPE html>
<meta charset="utf-8">
<title>Opener is isolated, openee is not isolated, openee is different-origin to the opener because of a port mismatch</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
<script type="module">
import {
openWindow,
testOpenedWindowIsInADifferentAgentCluster,
testGetter
} from "../resources/helpers.mjs";
let openee;
promise_setup(async () => {
openee = await openWindow("{{hosts[][]}}:{{ports[https][1]}}");
});
// Since they're different-origin, the openee's isolation non-request is
// respected, so the opener ends up in the origin-keyed agent cluster and the
// openee in the site-keyed one.
testOpenedWindowIsInADifferentAgentCluster(() => openee);
testGetter(self, true, "opener");
testGetter(() => openee, false, "openee");
</script>
<!DOCTYPE html>
<meta charset="utf-8">
<title>Opener is isolated, openee is not isolated, openee is same-origin to the opener</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
<script type="module">
import {
openWindow,
testOpenedWindowIsInSameAgentCluster,
testGetter
} from "../resources/helpers.mjs";
let openee;
promise_setup(async () => {
openee = await openWindow("{{hosts[][]}}");
});
// Since they're same-origin, the openee's isolation non-request is ignored,
// so both end up in the origin-keyed agent cluster.
testOpenedWindowIsInSameAgentCluster(() => openee);
testGetter(self, true, "opener");
testGetter(() => openee, true, "openee");
</script>
<!DOCTYPE html>
<meta charset="utf-8">
<title>Opener is isolated, openee is not isolated, openee is a subdomain of the opener</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
<script type="module">
import {
openWindow,
testOpenedWindowIsInADifferentAgentCluster,
testGetter
} from "../resources/helpers.mjs";
let openee;
promise_setup(async () => {
openee = await openWindow("{{hosts[][www]}}");
});
// Since they're different-origin, the openee's isolation non-request is
// respected, so the opener ends up in the origin-keyed agent cluster and the
// openee in the site-keyed one.
testOpenedWindowIsInADifferentAgentCluster(() => openee);
testGetter(self, true, "opener");
testGetter(() => openee, false, "openee");
</script>
<!DOCTYPE html>
<meta charset="utf-8">
<title>Opener is isolated, openee is isolated, openee is different-origin to the opener because of a port mismatch</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
<script type="module">
import {
openWindow,
testOpenedWindowIsInADifferentAgentCluster,
testGetter
} from "../resources/helpers.mjs";
let openee;
promise_setup(async () => {
openee = await openWindow("{{hosts[][]}}:{{ports[https][1]}}", "?1");
});
// Both request isolation, so the opener ends up in one origin-keyed agent
// cluster (the default port's origin), and the openee ends up in a different
// origin-keyed agent cluster (the other port's origin).
testOpenedWindowIsInADifferentAgentCluster(() => openee);
testGetter(self, true, "opener");
testGetter(() => openee, true, "openee");
</script>
<!DOCTYPE html>
<meta charset="utf-8">
<title>Opener is isolated, openee is isolated, openee is same-origin to the opener</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
<script type="module">
import {
openWindow,
testOpenedWindowIsInSameAgentCluster,
testGetter
} from "../resources/helpers.mjs";
let openee;
promise_setup(async () => {
openee = await openWindow("{{hosts[][]}}", "?1");
});
// Both request isolation, and they're same-origin, so they both end up in the
// same origin-keyed agent cluster.
testOpenedWindowIsInSameAgentCluster(() => openee);
testGetter(self, true, "opener");
testGetter(() => openee, true, "openee");
</script>
<!DOCTYPE html>
<meta charset="utf-8">
<title>Opener is isolated, openee is isolated, openee is a subdomain of the opener</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
<script type="module">
import {
openWindow,
testOpenedWindowIsInADifferentAgentCluster,
testGetter
} from "../resources/helpers.mjs";
let openee;
promise_setup(async () => {
openee = await openWindow("{{hosts[][www]}}", "?1");
});
// Both request isolation, so the opener ends up in one origin-keyed agent
// cluster (the base domain's origin), and the openee ends up in a different
// origin-keyed agent cluster (the www subdomain's origin).
testOpenedWindowIsInADifferentAgentCluster(() => openee);
testGetter(self, true, "opener");
testGetter(() => openee, true, "openee");
</script>
......@@ -2,7 +2,7 @@ import { sendWasmModule } from "./helpers.mjs";
// This is done for the window.open() case. For <iframe>s we use the
// <iframe> element's load event instead.
const usp = new URLSearchParams(location.href);
const usp = new URLSearchParams(location.search);
if (usp.has("send-loaded-message")) {
opener.postMessage("loaded", "*");
}
......
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