Commit fc13ce6e authored by Sigurd Schneider's avatar Sigurd Schneider Committed by Commit Bot

Report more frame information on COEP issues

This CL reports both the parent frame and the blocked from for COEP
issues. With those, it is easier to provide informative information
in the issues panel.

Change-Id: I382412780f382243d426a7fff3cb8e0efb7cb54f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2326350Reviewed-by: default avatarAndrey Kosyakov <caseq@chromium.org>
Reviewed-by: default avatarMike West <mkwst@chromium.org>
Commit-Queue: Sigurd Schneider <sigurds@chromium.org>
Cr-Commit-Position: refs/heads/master@{#793526}
parent 0579e73f
......@@ -191,10 +191,19 @@ void OnNavigationRequestFailed(
*status.blocked_by_response_reason))
.Build();
blockedByResponseDetails->SetFrame(
blockedByResponseDetails->SetBlockedFrame(
protocol::Audits::AffectedFrame::Create()
.SetFrameId(ftn->devtools_frame_token().ToString())
.Build());
if (ftn->parent()) {
blockedByResponseDetails->SetParentFrame(
protocol::Audits::AffectedFrame::Create()
.SetFrameId(ftn->parent()
->frame_tree_node()
->devtools_frame_token()
.ToString())
.Build());
}
issueDetails.SetBlockedByResponseIssueDetails(
std::move(blockedByResponseDetails));
......
......@@ -576,7 +576,8 @@ experimental domain Audits
type BlockedByResponseIssueDetails extends object
properties
AffectedRequest request
optional AffectedFrame frame
optional AffectedFrame parentFrame
optional AffectedFrame blockedFrame
BlockedByResponseReason reason
type HeavyAdResolutionStatus extends string
......
......@@ -36,7 +36,8 @@ struct AffectedFrame {
struct BlockedByResponseIssueDetails {
AffectedRequest request;
AffectedFrame? frame;
AffectedFrame? parentFrame;
AffectedFrame? blockedFrame;
network.mojom.BlockedByResponseReason reason;
};
......
......@@ -480,8 +480,13 @@ void InspectorAuditsAgent::InspectorIssueAdded(InspectorIssue* issue) {
.setRequest(BuildAffectedRequest(d->request))
.setReason(BuildBlockedByResponseReason(d->reason))
.build();
if (d->frame) {
blockedByResponseDetails->setFrame(BuildAffectedFrame(d->frame));
if (d->parentFrame) {
blockedByResponseDetails->setParentFrame(
BuildAffectedFrame(d->parentFrame));
}
if (d->blockedFrame) {
blockedByResponseDetails->setBlockedFrame(
BuildAffectedFrame(d->blockedFrame));
}
issueDetails.setBlockedByResponseIssueDetails(
std::move(blockedByResponseDetails));
......
......@@ -47,7 +47,7 @@ void InspectorIssueReporter::DidFailLoading(
auto affected_frame = mojom::blink::AffectedFrame::New();
affected_frame->frame_id = IdentifiersFactory::IdFromToken(token);
blocked_by_response_details->frame = std::move(affected_frame);
blocked_by_response_details->parentFrame = std::move(affected_frame);
auto details = mojom::blink::InspectorIssueDetails::New();
details->blocked_by_response_issue_details =
......
......@@ -3,7 +3,10 @@ Issue reported: {
code : BlockedByResponseIssue
details : {
blockedByResponseIssueDetails : {
frame : {
blockedFrame : {
frameId : <string>
}
parentFrame : {
frameId : <string>
}
reason : CorpNotSameOriginAfterDefaultedToSameOriginByCoep
......@@ -18,13 +21,16 @@ Issue reported: {
code : BlockedByResponseIssue
details : {
blockedByResponseIssueDetails : {
frame : {
blockedFrame : {
frameId : <string>
}
parentFrame : {
frameId : <string>
}
reason : CorpNotSameOriginAfterDefaultedToSameOriginByCoep
request : {
requestId : <string>
url : https://devtools.oopif.test:8443/inspector-protocol/network/cross-origin-isolation/resources/page-with-coep-corp.php
url : https://devtools.oopif.test:8443/inspector-protocol/network/cross-origin-isolation/resources/page-with-coep-corp.php?coep
}
}
}
......@@ -33,13 +39,16 @@ Issue reported: {
code : BlockedByResponseIssue
details : {
blockedByResponseIssueDetails : {
frame : {
blockedFrame : {
frameId : <string>
}
reason : CorpNotSameOriginAfterDefaultedToSameOriginByCoep
parentFrame : {
frameId : <string>
}
reason : CorpNotSameOrigin
request : {
requestId : <string>
url : https://devtools.oopif.test:8443/inspector-protocol/network/cross-origin-isolation/resources/page-with-coep-corp.php?coep
url : https://devtools.oopif.test:8443/inspector-protocol/network/cross-origin-isolation/resources/page-with-coep-corp.php?coep&corp=same-origin
}
}
}
......@@ -48,13 +57,16 @@ Issue reported: {
code : BlockedByResponseIssue
details : {
blockedByResponseIssueDetails : {
frame : {
blockedFrame : {
frameId : <string>
}
reason : CorpNotSameOrigin
parentFrame : {
frameId : <string>
}
reason : CorpNotSameSite
request : {
requestId : <string>
url : https://devtools.oopif.test:8443/inspector-protocol/network/cross-origin-isolation/resources/page-with-coep-corp.php?coep&corp=same-origin
url : https://devtools.oopif.test:8443/inspector-protocol/network/cross-origin-isolation/resources/page-with-coep-corp.php?coep&corp=same-site
}
}
}
......@@ -63,13 +75,16 @@ Issue reported: {
code : BlockedByResponseIssue
details : {
blockedByResponseIssueDetails : {
frame : {
blockedFrame : {
frameId : <string>
}
reason : CorpNotSameSite
parentFrame : {
frameId : <string>
}
reason : CorpNotSameOriginAfterDefaultedToSameOriginByCoep
request : {
requestId : <string>
url : https://devtools.oopif.test:8443/inspector-protocol/network/cross-origin-isolation/resources/page-with-coep-corp.php?coep&corp=same-site
url : https://devtools.oopif.test:8443/inspector-protocol/network/cross-origin-isolation/resources/page-with-coep-corp.php?coop
}
}
}
......@@ -78,13 +93,13 @@ Issue reported: {
code : BlockedByResponseIssue
details : {
blockedByResponseIssueDetails : {
frame : {
parentFrame : {
frameId : <string>
}
reason : CorpNotSameOrigin
reason : CorpNotSameOriginAfterDefaultedToSameOriginByCoep
request : {
requestId : <string>
url : https://devtools.oopif.test:8443/inspector-protocol/network/cross-origin-isolation/resources/page-with-coep-corp.php?corp=same-origin
url : https://devtools.oopif.test:8443/inspector-protocol/network/cross-origin-isolation/resources/page-with-coep-corp.php?script&
}
}
}
......@@ -93,13 +108,13 @@ Issue reported: {
code : BlockedByResponseIssue
details : {
blockedByResponseIssueDetails : {
frame : {
parentFrame : {
frameId : <string>
}
reason : CorpNotSameSite
reason : CorpNotSameOrigin
request : {
requestId : <string>
url : https://devtools.oopif.test:8443/inspector-protocol/network/cross-origin-isolation/resources/page-with-coep-corp.php?corp=same-site
url : https://devtools.oopif.test:8443/inspector-protocol/network/cross-origin-isolation/resources/page-with-coep-corp.php?script&corp=same-origin
}
}
}
......@@ -108,13 +123,13 @@ Issue reported: {
code : BlockedByResponseIssue
details : {
blockedByResponseIssueDetails : {
frame : {
parentFrame : {
frameId : <string>
}
reason : CorpNotSameOriginAfterDefaultedToSameOriginByCoep
reason : CorpNotSameSite
request : {
requestId : <string>
url : https://devtools.oopif.test:8443/inspector-protocol/network/cross-origin-isolation/resources/page-with-coep-corp.php&coop
url : https://devtools.oopif.test:8443/inspector-protocol/network/cross-origin-isolation/resources/page-with-coep-corp.php?script&corp=same-site
}
}
}
......
Tests that cross-origin embedder policy (COEP) related blocking is reported correctly.
https://devtools.oopif.test:8443/inspector-protocol/network/cross-origin-isolation/resources/page-with-coep-corp.php: net::ERR_BLOCKED_BY_RESPONSE corp-not-same-origin-after-defaulted-to-same-origin-by-coep
https://devtools.oopif.test:8443/inspector-protocol/network/cross-origin-isolation/resources/page-with-coep-corp.php: net::ERR_BLOCKED_BY_RESPONSE corp-not-same-origin-after-defaulted-to-same-origin-by-coep
https://devtools.oopif.test:8443/inspector-protocol/network/cross-origin-isolation/resources/page-with-coep-corp.php?coep: net::ERR_BLOCKED_BY_RESPONSE corp-not-same-origin-after-defaulted-to-same-origin-by-coep
https://devtools.oopif.test:8443/inspector-protocol/network/cross-origin-isolation/resources/page-with-coep-corp.php?coep&corp=same-origin: net::ERR_BLOCKED_BY_RESPONSE corp-not-same-origin
https://devtools.oopif.test:8443/inspector-protocol/network/cross-origin-isolation/resources/page-with-coep-corp.php?coep&corp=same-site: net::ERR_BLOCKED_BY_RESPONSE corp-not-same-site
https://devtools.oopif.test:8443/inspector-protocol/network/cross-origin-isolation/resources/page-with-coep-corp.php?corp=cross-origin: *loading finished*
https://devtools.oopif.test:8443/inspector-protocol/network/cross-origin-isolation/resources/page-with-coep-corp.php?corp=same-origin: net::ERR_BLOCKED_BY_RESPONSE corp-not-same-origin
https://devtools.oopif.test:8443/inspector-protocol/network/cross-origin-isolation/resources/page-with-coep-corp.php?corp=same-site: net::ERR_BLOCKED_BY_RESPONSE corp-not-same-site
https://devtools.oopif.test:8443/inspector-protocol/network/cross-origin-isolation/resources/page-with-coep-corp.php&coop: net::ERR_BLOCKED_BY_RESPONSE corp-not-same-origin-after-defaulted-to-same-origin-by-coep
https://devtools.oopif.test:8443/inspector-protocol/network/cross-origin-isolation/resources/page-with-coep-corp.php?coop: net::ERR_BLOCKED_BY_RESPONSE corp-not-same-origin-after-defaulted-to-same-origin-by-coep
https://devtools.oopif.test:8443/inspector-protocol/network/cross-origin-isolation/resources/page-with-coep-corp.php?script&: net::ERR_BLOCKED_BY_RESPONSE corp-not-same-origin-after-defaulted-to-same-origin-by-coep
https://devtools.oopif.test:8443/inspector-protocol/network/cross-origin-isolation/resources/page-with-coep-corp.php?script&corp=cross-origin: *loading finished*
https://devtools.oopif.test:8443/inspector-protocol/network/cross-origin-isolation/resources/page-with-coep-corp.php?script&corp=same-origin: net::ERR_BLOCKED_BY_RESPONSE corp-not-same-origin
https://devtools.oopif.test:8443/inspector-protocol/network/cross-origin-isolation/resources/page-with-coep-corp.php?script&corp=same-site: net::ERR_BLOCKED_BY_RESPONSE corp-not-same-site
https://devtools.test:8443/inspector-protocol/network/cross-origin-isolation/resources/coep-page-with-resources.php: *loading finished*
......@@ -30,19 +30,19 @@ header("Cross-Origin-Embedder-Policy: require-corp");
<iframe src="https://devtools.oopif.test:8443/inspector-protocol/network/cross-origin-isolation/resources/page-with-coep-corp.php?coep&corp=cross-origin">
</iframe><br/>
Script CORP None <span id="script-corp-none">not loaded</span>
<script src="https://devtools.oopif.test:8443/inspector-protocol/network/cross-origin-isolation/resources/page-with-coep-corp.php" defer>
<script src="https://devtools.oopif.test:8443/inspector-protocol/network/cross-origin-isolation/resources/page-with-coep-corp.php?script&" defer>
</script><br/>
Script CORP cross origin <span id="script-corp-cross-origin">not loaded</span>
<script src="https://devtools.oopif.test:8443/inspector-protocol/network/cross-origin-isolation/resources/page-with-coep-corp.php?corp=cross-origin" defer>
<script src="https://devtools.oopif.test:8443/inspector-protocol/network/cross-origin-isolation/resources/page-with-coep-corp.php?script&corp=cross-origin" defer>
</script> <br/>
Script CORP same site <span id="script-corp-same-site">not loaded</span>
<script src="https://devtools.oopif.test:8443/inspector-protocol/network/cross-origin-isolation/resources/page-with-coep-corp.php?corp=same-site" defer>
<script src="https://devtools.oopif.test:8443/inspector-protocol/network/cross-origin-isolation/resources/page-with-coep-corp.php?script&corp=same-site" defer>
</script><br/>
Script CORP same origin <span id="script-corp-same-origin">not loaded</span>
<script src="https://devtools.oopif.test:8443/inspector-protocol/network/cross-origin-isolation/resources/page-with-coep-corp.php?corp=same-origin" defer>
<script src="https://devtools.oopif.test:8443/inspector-protocol/network/cross-origin-isolation/resources/page-with-coep-corp.php?script&corp=same-origin" defer>
</script><br/>
Sandboxed COOP iframe<br/>
<iframe src="https://devtools.oopif.test:8443/inspector-protocol/network/cross-origin-isolation/resources/page-with-coep-corp.php&coop">
<iframe src="https://devtools.oopif.test:8443/inspector-protocol/network/cross-origin-isolation/resources/page-with-coep-corp.php?coop">
</iframe><br/>
</body>
</html>
......
......@@ -8,7 +8,6 @@ if (isset($_GET['coop'])) {
header("Cross-Origin-Opener-Policy: same-origin");
}
if (isset($_GET['coep'])) {
header("Cross-Origin-Embedder-Policy: require-corp");
}
......
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