Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(514)

Unified Diff: content/browser/frame_host/render_frame_proxy_host.cc

Issue 2190183002: Forward CSP violation reporting from RenderFrameProxy to RenderFrameImpl. Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove no longer applicable TODO and early exit from reportViolation method. Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 63be6ebbcc661af2c504d123b99cdc111c002216..8f1d9d5c3a663f7d69e89de73f550b445ad37950 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,18 @@ void RenderFrameProxyHost::OnOpenURL(
params.resource_request_body);
}
+void RenderFrameProxyHost::OnForwardContentSecurityPolicyViolation(
+ const ContentSecurityPolicyViolation& violation) {
+ // Verify that we are in the same BrowsingInstance as the current
+ // RenderFrameHost.
+ RenderFrameHostImpl* current_rfh = frame_tree_node_->current_frame_host();
+ if (!site_instance_->IsRelatedSiteInstance(current_rfh->GetSiteInstance()))
alexmos 2016/08/09 18:01:19 What's the reason for this check?
Łukasz Anforowicz 2016/08/09 22:23:20 Thanks for asking this question - I blindly copied
Łukasz Anforowicz 2016/08/10 19:50:25 FWIW, I checked that the same condition in RenderF
alexmos 2016/08/10 20:34:33 Yes, I moved that check according to Charlie's TOD
Łukasz Anforowicz 2016/08/11 17:32:36 Hmmm... actually, I think that the check above mig
Łukasz Anforowicz 2016/08/11 18:04:35 I talked with Alex about this a little bit more an
Charlie Reis 2016/08/11 18:32:14 Sorry for chiming in late. I'll reply to Alex's q
Łukasz Anforowicz 2016/08/11 19:51:35 Today sending of this message is only triggered wh
Charlie Reis 2016/08/11 20:40:26 Hmm, I have some concerns about that, and no solut
+ return;
+
+ 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();

Powered by Google App Engine
This is Rietveld 408576698