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( ...@@ -191,10 +191,19 @@ void OnNavigationRequestFailed(
*status.blocked_by_response_reason)) *status.blocked_by_response_reason))
.Build(); .Build();
blockedByResponseDetails->SetFrame( blockedByResponseDetails->SetBlockedFrame(
protocol::Audits::AffectedFrame::Create() protocol::Audits::AffectedFrame::Create()
.SetFrameId(ftn->devtools_frame_token().ToString()) .SetFrameId(ftn->devtools_frame_token().ToString())
.Build()); .Build());
if (ftn->parent()) {
blockedByResponseDetails->SetParentFrame(
protocol::Audits::AffectedFrame::Create()
.SetFrameId(ftn->parent()
->frame_tree_node()
->devtools_frame_token()
.ToString())
.Build());
}
issueDetails.SetBlockedByResponseIssueDetails( issueDetails.SetBlockedByResponseIssueDetails(
std::move(blockedByResponseDetails)); std::move(blockedByResponseDetails));
......
...@@ -576,7 +576,8 @@ experimental domain Audits ...@@ -576,7 +576,8 @@ experimental domain Audits
type BlockedByResponseIssueDetails extends object type BlockedByResponseIssueDetails extends object
properties properties
AffectedRequest request AffectedRequest request
optional AffectedFrame frame optional AffectedFrame parentFrame
optional AffectedFrame blockedFrame
BlockedByResponseReason reason BlockedByResponseReason reason
type HeavyAdResolutionStatus extends string type HeavyAdResolutionStatus extends string
......
...@@ -36,7 +36,8 @@ struct AffectedFrame { ...@@ -36,7 +36,8 @@ struct AffectedFrame {
struct BlockedByResponseIssueDetails { struct BlockedByResponseIssueDetails {
AffectedRequest request; AffectedRequest request;
AffectedFrame? frame; AffectedFrame? parentFrame;
AffectedFrame? blockedFrame;
network.mojom.BlockedByResponseReason reason; network.mojom.BlockedByResponseReason reason;
}; };
......
...@@ -480,8 +480,13 @@ void InspectorAuditsAgent::InspectorIssueAdded(InspectorIssue* issue) { ...@@ -480,8 +480,13 @@ void InspectorAuditsAgent::InspectorIssueAdded(InspectorIssue* issue) {
.setRequest(BuildAffectedRequest(d->request)) .setRequest(BuildAffectedRequest(d->request))
.setReason(BuildBlockedByResponseReason(d->reason)) .setReason(BuildBlockedByResponseReason(d->reason))
.build(); .build();
if (d->frame) { if (d->parentFrame) {
blockedByResponseDetails->setFrame(BuildAffectedFrame(d->frame)); blockedByResponseDetails->setParentFrame(
BuildAffectedFrame(d->parentFrame));
}
if (d->blockedFrame) {
blockedByResponseDetails->setBlockedFrame(
BuildAffectedFrame(d->blockedFrame));
} }
issueDetails.setBlockedByResponseIssueDetails( issueDetails.setBlockedByResponseIssueDetails(
std::move(blockedByResponseDetails)); std::move(blockedByResponseDetails));
......
...@@ -47,7 +47,7 @@ void InspectorIssueReporter::DidFailLoading( ...@@ -47,7 +47,7 @@ void InspectorIssueReporter::DidFailLoading(
auto affected_frame = mojom::blink::AffectedFrame::New(); auto affected_frame = mojom::blink::AffectedFrame::New();
affected_frame->frame_id = IdentifiersFactory::IdFromToken(token); 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(); auto details = mojom::blink::InspectorIssueDetails::New();
details->blocked_by_response_issue_details = details->blocked_by_response_issue_details =
......
...@@ -3,7 +3,10 @@ Issue reported: { ...@@ -3,7 +3,10 @@ Issue reported: {
code : BlockedByResponseIssue code : BlockedByResponseIssue
details : { details : {
blockedByResponseIssueDetails : { blockedByResponseIssueDetails : {
frame : { blockedFrame : {
frameId : <string>
}
parentFrame : {
frameId : <string> frameId : <string>
} }
reason : CorpNotSameOriginAfterDefaultedToSameOriginByCoep reason : CorpNotSameOriginAfterDefaultedToSameOriginByCoep
...@@ -18,13 +21,16 @@ Issue reported: { ...@@ -18,13 +21,16 @@ Issue reported: {
code : BlockedByResponseIssue code : BlockedByResponseIssue
details : { details : {
blockedByResponseIssueDetails : { blockedByResponseIssueDetails : {
frame : { blockedFrame : {
frameId : <string>
}
parentFrame : {
frameId : <string> frameId : <string>
} }
reason : CorpNotSameOriginAfterDefaultedToSameOriginByCoep reason : CorpNotSameOriginAfterDefaultedToSameOriginByCoep
request : { request : {
requestId : <string> 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: { ...@@ -33,13 +39,16 @@ Issue reported: {
code : BlockedByResponseIssue code : BlockedByResponseIssue
details : { details : {
blockedByResponseIssueDetails : { blockedByResponseIssueDetails : {
frame : { blockedFrame : {
frameId : <string> frameId : <string>
} }
reason : CorpNotSameOriginAfterDefaultedToSameOriginByCoep parentFrame : {
frameId : <string>
}
reason : CorpNotSameOrigin
request : { request : {
requestId : <string> 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: { ...@@ -48,13 +57,16 @@ Issue reported: {
code : BlockedByResponseIssue code : BlockedByResponseIssue
details : { details : {
blockedByResponseIssueDetails : { blockedByResponseIssueDetails : {
frame : { blockedFrame : {
frameId : <string> frameId : <string>
} }
reason : CorpNotSameOrigin parentFrame : {
frameId : <string>
}
reason : CorpNotSameSite
request : { request : {
requestId : <string> 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: { ...@@ -63,13 +75,16 @@ Issue reported: {
code : BlockedByResponseIssue code : BlockedByResponseIssue
details : { details : {
blockedByResponseIssueDetails : { blockedByResponseIssueDetails : {
frame : { blockedFrame : {
frameId : <string> frameId : <string>
} }
reason : CorpNotSameSite parentFrame : {
frameId : <string>
}
reason : CorpNotSameOriginAfterDefaultedToSameOriginByCoep
request : { request : {
requestId : <string> 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: { ...@@ -78,13 +93,13 @@ Issue reported: {
code : BlockedByResponseIssue code : BlockedByResponseIssue
details : { details : {
blockedByResponseIssueDetails : { blockedByResponseIssueDetails : {
frame : { parentFrame : {
frameId : <string> frameId : <string>
} }
reason : CorpNotSameOrigin reason : CorpNotSameOriginAfterDefaultedToSameOriginByCoep
request : { request : {
requestId : <string> 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: { ...@@ -93,13 +108,13 @@ Issue reported: {
code : BlockedByResponseIssue code : BlockedByResponseIssue
details : { details : {
blockedByResponseIssueDetails : { blockedByResponseIssueDetails : {
frame : { parentFrame : {
frameId : <string> frameId : <string>
} }
reason : CorpNotSameSite reason : CorpNotSameOrigin
request : { request : {
requestId : <string> 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: { ...@@ -108,13 +123,13 @@ Issue reported: {
code : BlockedByResponseIssue code : BlockedByResponseIssue
details : { details : {
blockedByResponseIssueDetails : { blockedByResponseIssueDetails : {
frame : { parentFrame : {
frameId : <string> frameId : <string>
} }
reason : CorpNotSameOriginAfterDefaultedToSameOriginByCoep reason : CorpNotSameSite
request : { request : {
requestId : <string> 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. 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: 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: 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-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?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?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?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&: 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?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?script&corp=cross-origin: *loading finished*
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&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* 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"); ...@@ -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 src="https://devtools.oopif.test:8443/inspector-protocol/network/cross-origin-isolation/resources/page-with-coep-corp.php?coep&corp=cross-origin">
</iframe><br/> </iframe><br/>
Script CORP None <span id="script-corp-none">not loaded</span> 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><br/>
Script CORP cross origin <span id="script-corp-cross-origin">not loaded</span> 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> <br/>
Script CORP same site <span id="script-corp-same-site">not loaded</span> 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><br/>
Script CORP same origin <span id="script-corp-same-origin">not loaded</span> 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/> </script><br/>
Sandboxed COOP iframe<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/> </iframe><br/>
</body> </body>
</html> </html>
......
...@@ -8,7 +8,6 @@ if (isset($_GET['coop'])) { ...@@ -8,7 +8,6 @@ if (isset($_GET['coop'])) {
header("Cross-Origin-Opener-Policy: same-origin"); header("Cross-Origin-Opener-Policy: same-origin");
} }
if (isset($_GET['coep'])) { if (isset($_GET['coep'])) {
header("Cross-Origin-Embedder-Policy: require-corp"); 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