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

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

Issue 2655463006: PlzNavigate: Enforce 'frame-src' CSP on the browser. (Closed)
Patch Set: Rebase. Created 3 years, 9 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 5826cacd0a6e23ad3606c08c47422bf1ece5987b..3fa8a3f555a870bc50c7390dd53538b0398635b4 100644
--- a/third_party/WebKit/Source/web/WebLocalFrameImpl.cpp
+++ b/third_party/WebKit/Source/web/WebLocalFrameImpl.cpp
@@ -2094,6 +2094,34 @@ bool WebLocalFrameImpl::maybeRenderFallbackContent(
return true;
}
+// Called when a navigation is blocked because a Content Security Policy (CSP)
+// is infringed.
+void WebLocalFrameImpl::reportContentSecurityPolicyViolation(
+ const blink::WebContentSecurityPolicyViolation& violation) {
+ DCHECK(frame() && frame()->document());
+ Document* document = frame()->document();
+ Vector<String> reportEndpoints;
+ for (const WebString& endPoint : violation.reportEndpoints)
+ reportEndpoints.push_back(endPoint);
+ document->contentSecurityPolicy()->reportViolation(
+ violation.directive, /* directiveText */
+ ContentSecurityPolicy::getDirectiveType(
+ violation.effectiveDirective), /* effectiveType */
+ violation.consoleMessage, /* consoleMessage */
+ violation.blockedUrl, /* blockedUrl */
+ reportEndpoints, /* reportEndpoints */
+ violation.header, /* header */
+ static_cast<ContentSecurityPolicyHeaderType>(violation.disposition),
+ ContentSecurityPolicy::ViolationType::URLViolation, /* ViolationType */
+ nullptr, /* LocalFrame */
+ violation.afterRedirect ? RedirectStatus::FollowedRedirect
+ : RedirectStatus::NoRedirect,
+ // TODO(arthursonzogni, clamy) Provide the context line number here.
+ // See http://crbug.com/690946
+ 0, /* contextLine */
+ nullptr); /* Element */
+}
+
bool WebLocalFrameImpl::isLoading() const {
if (!frame() || !frame()->document())
return false;
« no previous file with comments | « third_party/WebKit/Source/web/WebLocalFrameImpl.h ('k') | third_party/WebKit/public/platform/WebContentSecurityPolicy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698