-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bug 1646359 [wpt PR 24194] - Origin isolation: implement window.origi…
…nIsolationRestricted, a=testonly Automatic update from web-platform-tests Origin isolation: implement window.originIsolationRestricted See WICG/origin-agent-cluster#24 and WICG/origin-agent-cluster#30 for background, and whatwg/html#5545 for the specification. Failing test expectations include: - We implement (3) from WICG/origin-agent-cluster#24 instead of (2) for now, so we fail getter-sandboxed-iframe. Tracking at https://crbug.com/1095653. - The initial about:blank, as well as removed iframes, are not properly returning true, so about-blank and removing-iframes are failing. Also tracking at https://crbug.com/1095653. - data: URLs are not [SecureContext] in Chromium (https://crbug.com/1095656) so getter-data-url fails. Note that per ongoing discussion in WICG/origin-agent-cluster#31 the naming of this API, as well as its edge-case behavior (e.g. for sandboxed iframes) will likely change. Bug: 1042415 Change-Id: I20c2d3e3fec7a5c0f1d12c386999c32fe27b6a34 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2243994 Reviewed-by: Charlie Reis <[email protected]> Reviewed-by: Daniel Cheng <[email protected]> Reviewed-by: James MacLean <[email protected]> Commit-Queue: Domenic Denicola <[email protected]> Cr-Commit-Position: refs/heads/master@{#782672} -- wpt-commits: 9e23aa452a1261c637ce32cbb8bee450e7006f8d wpt-pr: 24194
- Loading branch information
1 parent
00a5658
commit 6c9847f
Showing
32 changed files
with
272 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
testing/web-platform/tests/origin-isolation/getter-data-url.https.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<!DOCTYPE html> | ||
<meta charset="utf-8"> | ||
<title>window.originIsolationRestricted for a data: URL</title> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
|
||
<div id="log"></div> | ||
|
||
<script type="module"> | ||
import { | ||
waitForIframe, | ||
testOriginIsolationRestricted | ||
} from "./resources/helpers.mjs"; | ||
|
||
promise_setup(() => { | ||
const iframe = document.createElement("iframe"); | ||
|
||
// This copies parts of resources/send-origin-isolation-header.py that allow | ||
// us to reuse testOriginIsolationRestricted. | ||
iframe.src = `data:text/html,<script> | ||
window.onmessage = () => { | ||
parent.postMessage(self.originIsolationRestricted, "*"); | ||
}; | ||
</` + `script> | ||
`; | ||
|
||
const waitPromise = waitForIframe(iframe); | ||
document.body.append(iframe); | ||
return waitPromise; | ||
}); | ||
|
||
// The data: URL iframe has an opaque origin, so it definitely should return | ||
// false. It's pretty unlikely that it would return true anyway, since we can't | ||
// set the header on the iframe, but we should test it to make sure there isn't | ||
// some strange main page -> data: URL iframe inheritance going on. | ||
|
||
testOriginIsolationRestricted(0, false); | ||
</script> |
1 change: 1 addition & 0 deletions
1
testing/web-platform/tests/origin-isolation/getter-data-url.https.html.headers
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Origin-Isolation: ?1 |
27 changes: 27 additions & 0 deletions
27
testing/web-platform/tests/origin-isolation/getter-removed-iframe.sub.https.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<!DOCTYPE html> | ||
<meta charset="utf-8"> | ||
<title>window.crossOriginIsolated for a removed frame</title> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
|
||
<div id="log"></div> | ||
|
||
<script type="module"> | ||
import { navigateIframe } from "./resources/helpers.mjs"; | ||
|
||
promise_test(async () => { | ||
// We cannot use insertIframe because it sets both `document.domain`s. That | ||
// shouldn't matter, but Chrome has a bug (https://crbug.com/1095145), so | ||
// let's avoid making the test needlessly fail because of that bug. | ||
const iframe = document.createElement("iframe"); | ||
const navigatePromise = navigateIframe(iframe, "{{hosts[][]}}", "?1"); | ||
document.body.append(iframe); | ||
await navigatePromise; | ||
|
||
const frameWindow = iframe.contentWindow; | ||
|
||
assert_equals(frameWindow.originIsolationRestricted, true, "before"); | ||
iframe.remove(); | ||
assert_equals(frameWindow.originIsolationRestricted, true, "after"); | ||
}, "Removing the iframe does not change originIsolationRestricted"); | ||
</script> |
1 change: 1 addition & 0 deletions
1
testing/web-platform/tests/origin-isolation/getter-removed-iframe.sub.https.html.headers
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Origin-Isolation: ?1 |
30 changes: 30 additions & 0 deletions
30
testing/web-platform/tests/origin-isolation/getter-sandboxed-iframe.sub.https.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<!DOCTYPE html> | ||
<meta charset="utf-8"> | ||
<title>window.originIsolationRestricted for a sandboxed frame</title> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
|
||
<div id="log"></div> | ||
|
||
<script type="module"> | ||
import { | ||
navigateIframe, | ||
testOriginIsolationRestricted | ||
} from "./resources/helpers.mjs"; | ||
|
||
// We do this manually instead of using insertIframe because we want to add a | ||
// sandbox="" attribute and we don't want to set both document.domains. | ||
promise_setup(() => { | ||
const iframe = document.createElement("iframe"); | ||
iframe.sandbox = "allow-scripts"; | ||
const navigatePromise = navigateIframe(iframe, "{{hosts[][]}}", "?1"); | ||
document.body.append(iframe); | ||
return navigatePromise; | ||
}); | ||
|
||
// Because sandboxed iframes have an opaque origin, their agent cluster key is | ||
// always an origin, so there are no additional restrictions imposed by origin | ||
// isolation. Thus the getter returns false. | ||
|
||
testOriginIsolationRestricted(0, false); | ||
</script> |
1 change: 1 addition & 0 deletions
1
testing/web-platform/tests/origin-isolation/getter-sandboxed-iframe.sub.https.html.headers
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Origin-Isolation: ?1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.