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

Unified Diff: third_party/WebKit/Source/core/frame/csp/RemoteContentSecurityPolicy.cpp

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
Index: third_party/WebKit/Source/core/frame/csp/RemoteContentSecurityPolicy.cpp
diff --git a/third_party/WebKit/Source/core/frame/csp/RemoteContentSecurityPolicy.cpp b/third_party/WebKit/Source/core/frame/csp/RemoteContentSecurityPolicy.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..af21f8eafca99a62a912042e735f676415489c9e
--- /dev/null
+++ b/third_party/WebKit/Source/core/frame/csp/RemoteContentSecurityPolicy.cpp
@@ -0,0 +1,52 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "core/frame/csp/RemoteContentSecurityPolicy.h"
+
+#include "core/frame/RemoteFrameClient.h"
+#include "wtf/Assertions.h"
+#include "wtf/Compiler.h"
+
+namespace blink {
+
+// static
+RemoteContentSecurityPolicy* RemoteContentSecurityPolicy::create(RemoteFrameClient* remoteFrameClient)
+{
+ return new RemoteContentSecurityPolicy(remoteFrameClient);
+}
+
+RemoteContentSecurityPolicy::RemoteContentSecurityPolicy(RemoteFrameClient* remoteFrameClient)
+ : m_remoteFrameClient(remoteFrameClient)
+{
+ DCHECK(remoteFrameClient);
+}
+
+RemoteContentSecurityPolicy::~RemoteContentSecurityPolicy() {}
+
+DEFINE_TRACE(RemoteContentSecurityPolicy)
+{
+ visitor->trace(m_remoteFrameClient);
+ ContentSecurityPolicy::trace(visitor);
+}
+
+void RemoteContentSecurityPolicy::reportViolation(const String& directiveText, const String& effectiveDirective, const String& consoleMessage, const KURL& blockedURL, const Vector<String>& reportEndpoints, const String& header, ViolationType violationType, LocalFrame* contextFrame, RedirectStatus redirectStatus, int contextLine)
+{
+ DCHECK(violationType == URLViolation || blockedURL.isEmpty());
+ DCHECK(!contextFrame);
+
+ // We don't want to disclose line numbers to a remote frame.
+ ALLOW_UNUSED_LOCAL(contextLine);
+
+ m_remoteFrameClient->forwardContentSecurityPolicyViolation(
+ directiveText,
+ effectiveDirective,
+ consoleMessage,
+ blockedURL,
+ reportEndpoints,
+ header,
+ violationType,
+ redirectStatus == RedirectStatus::FollowedRedirect);
+}
+
+} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698