Chromium Code Reviews| Index: content/browser/frame_host/render_frame_proxy_host.cc |
| diff --git a/content/browser/frame_host/render_frame_proxy_host.cc b/content/browser/frame_host/render_frame_proxy_host.cc |
| index 7d79501b10298b3e1037d26cfd1962540fb94178..2b6224ed387baf1c892a390b1de11ef03296b7fd 100644 |
| --- a/content/browser/frame_host/render_frame_proxy_host.cc |
| +++ b/content/browser/frame_host/render_frame_proxy_host.cc |
| @@ -135,6 +135,8 @@ bool RenderFrameProxyHost::OnMessageReceived(const IPC::Message& msg) { |
| IPC_BEGIN_MESSAGE_MAP(RenderFrameProxyHost, msg) |
| IPC_MESSAGE_HANDLER(FrameHostMsg_Detach, OnDetach) |
| IPC_MESSAGE_HANDLER(FrameHostMsg_OpenURL, OnOpenURL) |
| + IPC_MESSAGE_HANDLER(FrameHostMsg_ForwardContentSecurityPolicyViolation, |
| + OnForwardContentSecurityPolicyViolation) |
| IPC_MESSAGE_HANDLER(FrameHostMsg_RouteMessageEvent, OnRouteMessageEvent) |
| IPC_MESSAGE_HANDLER(FrameHostMsg_DidChangeOpener, OnDidChangeOpener) |
| IPC_MESSAGE_HANDLER(FrameHostMsg_AdvanceFocus, OnAdvanceFocus) |
| @@ -268,6 +270,25 @@ void RenderFrameProxyHost::OnOpenURL( |
| params.resource_request_body); |
| } |
| +void RenderFrameProxyHost::OnForwardContentSecurityPolicyViolation( |
| + const url::Origin& origin_declaring_violated_csp, |
| + const ContentSecurityPolicyViolation& violation) { |
| + RenderFrameHostImpl* current_rfh = frame_tree_node_->current_frame_host(); |
| + |
| + // Verify that the CSP violation will be reported in the same frame |
|
Charlie Reis
2016/08/11 20:40:26
"same frame": Did you mean to say "same document?"
Łukasz Anforowicz
2016/08/12 18:55:04
Good point. Done.
|
| + // as the one that declared the violated CSP (or at least in a frame |
| + // with the same origin). This check protects against a race when |
| + // ForwardContentSecurityPolicyViolation IPC races with navigation |
| + // of the frame the IPC is sent to. |
| + if (!origin_declaring_violated_csp.IsSameOriginWith( |
| + current_rfh->GetLastCommittedOrigin())) |
|
Charlie Reis
2016/08/11 20:40:26
I'm wondering if there's something better we can d
Łukasz Anforowicz
2016/08/12 18:55:04
Ack. Things are a bit improved by your suggestion
Charlie Reis
2016/08/12 20:47:30
I don't see any comments there, so I'll avoid digg
|
| + return; |
| + |
| + // Forward CSP violation report to the frame that declared the CSP. |
| + current_rfh->Send(new FrameMsg_ReportContentSecurityPolicyViolation( |
| + current_rfh->GetRoutingID(), violation)); |
| +} |
| + |
| void RenderFrameProxyHost::OnRouteMessageEvent( |
| const FrameMsg_PostMessage_Params& params) { |
| RenderFrameHostImpl* target_rfh = frame_tree_node()->current_frame_host(); |