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

Unified Diff: third_party/WebKit/Source/web/WebLocalFrameImpl.cpp

Issue 2190183002: Forward CSP violation reporting from RenderFrameProxy to RenderFrameImpl. Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixing how virtual method is declared. Created 4 years, 5 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: third_party/WebKit/Source/web/WebLocalFrameImpl.cpp
diff --git a/third_party/WebKit/Source/web/WebLocalFrameImpl.cpp b/third_party/WebKit/Source/web/WebLocalFrameImpl.cpp
index 6fc3d8e910afe2a966227225e9592acd23fa483b..f9aeb97efb48c9cf08b73c9cd5b7a67f80452ec3 100644
--- a/third_party/WebKit/Source/web/WebLocalFrameImpl.cpp
+++ b/third_party/WebKit/Source/web/WebLocalFrameImpl.cpp
@@ -2160,4 +2160,42 @@ void WebLocalFrameImpl::clearActiveFindMatch()
ensureTextFinder().clearActiveFindMatch();
}
+void WebLocalFrameImpl::reportContentSecurityPolicyViolation(
+ const WebString& directiveText,
+ const WebString& effectiveDirective,
+ const WebString& consoleMessage,
+ const WebURL& blockedURL,
+ const WebVector<WebString>& reportEndpoints,
+ const WebString& header,
+ WebContentSecurityPolicyViolationType violationType,
+ bool followedRedirect,
+ int contextLine)
+{
+ Vector<String> coreReportEndpoints;
+ coreReportEndpoints.reserveInitialCapacity(reportEndpoints.size());
+ for (const WebString& reportEndpoint : reportEndpoints)
+ coreReportEndpoints.append(reportEndpoint);
+
+ auto redirectStatus = followedRedirect
+ ? ResourceRequest::RedirectStatus::FollowedRedirect
+ : ResourceRequest::RedirectStatus::NoRedirect;
+
+ ContentSecurityPolicy* policy = m_frame->securityContext()->contentSecurityPolicy();
+ policy->logToConsole(ConsoleMessage::create(
+ SecurityMessageSource,
+ ErrorMessageLevel,
+ consoleMessage));
+ policy->reportViolation(
+ directiveText,
+ effectiveDirective,
+ consoleMessage,
+ blockedURL,
+ coreReportEndpoints,
+ header,
+ static_cast<ContentSecurityPolicy::ViolationType>(violationType),
+ nullptr, // contextFrame
+ redirectStatus,
+ contextLine);
+}
+
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698