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

Unified Diff: content/renderer/render_frame_impl.cc

Issue 2190183002: Forward CSP violation reporting from RenderFrameProxy to RenderFrameImpl. Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Sanitize report endpoints from IPC against actual CSP contents. 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
« no previous file with comments | « content/renderer/render_frame_impl.h ('k') | content/renderer/render_frame_proxy.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/render_frame_impl.cc
diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc
index 3a2094408cf8e876b2f266deaa32c7dfd869c6c4..77474fe03d4b6ffe382b6fc46d020c3f86f592b4 100644
--- a/content/renderer/render_frame_impl.cc
+++ b/content/renderer/render_frame_impl.cc
@@ -49,7 +49,7 @@
#include "content/common/accessibility_messages.h"
#include "content/common/clipboard_messages.h"
#include "content/common/content_constants_internal.h"
-#include "content/common/content_security_policy_header.h"
+#include "content/common/content_security_policy_structs.h"
#include "content/common/frame_messages.h"
#include "content/common/frame_owner_properties.h"
#include "content/common/frame_replication_state.h"
@@ -1530,6 +1530,8 @@ bool RenderFrameImpl::OnMessageReceived(const IPC::Message& msg) {
IPC_MESSAGE_HANDLER(FrameMsg_SuppressFurtherDialogs,
OnSuppressFurtherDialogs)
IPC_MESSAGE_HANDLER(FrameMsg_RunFileChooserResponse, OnFileChooserResponse)
+ IPC_MESSAGE_HANDLER(FrameMsg_ReportContentSecurityPolicyViolation,
+ OnReportContentSecurityPolicyViolation)
#if defined(OS_ANDROID)
IPC_MESSAGE_HANDLER(FrameMsg_ActivateNearestFindResult,
OnActivateNearestFindResult)
@@ -5240,6 +5242,23 @@ void RenderFrameImpl::OnFileChooserResponse(
}
}
+void RenderFrameImpl::OnReportContentSecurityPolicyViolation(
+ const ContentSecurityPolicyViolation& violation) {
+ blink::WebVector<blink::WebString> web_report_endpoints(
+ violation.report_endpoints.size());
+ for (size_t i = 0; i < web_report_endpoints.size(); i++) {
+ web_report_endpoints[i] =
+ WebString::fromUTF8(violation.report_endpoints[i]);
+ }
+
+ frame_->reportContentSecurityPolicyViolation(
+ WebString::fromUTF8(violation.directive_text),
+ WebString::fromUTF8(violation.effective_directive),
+ WebString::fromUTF8(violation.console_message), violation.blocked_url,
+ web_report_endpoints, WebString::fromUTF8(violation.header),
+ violation.violation_type, violation.followed_redirect);
+}
+
#if defined(OS_ANDROID)
void RenderFrameImpl::OnActivateNearestFindResult(int request_id,
float x,
« no previous file with comments | « content/renderer/render_frame_impl.h ('k') | content/renderer/render_frame_proxy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698