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

Unified Diff: content/common/content_security_policy/csp_context.cc

Issue 2761153003: PlzNavigate & CSP. Use the SourceLocation in violation reports. (Closed)
Patch Set: Addressed comment @alexmos 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: content/common/content_security_policy/csp_context.cc
diff --git a/content/common/content_security_policy/csp_context.cc b/content/common/content_security_policy/csp_context.cc
index 3c3b0fe533f71b8f64712e4184fc5ef6ae82da97..3d3c9a01da198e9f5381f76ab2b90ba970fa2e87 100644
--- a/content/common/content_security_policy/csp_context.cc
+++ b/content/common/content_security_policy/csp_context.cc
@@ -12,13 +12,14 @@ CSPContext::~CSPContext() {}
bool CSPContext::IsAllowedByCsp(CSPDirective::Name directive_name,
const GURL& url,
- bool is_redirect) {
+ bool is_redirect,
+ const SourceLocation& source_location) {
if (SchemeShouldBypassCSP(url.scheme_piece()))
return true;
for (const auto& policy : policies_) {
- if (!ContentSecurityPolicy::Allow(policy, directive_name, url, this,
- is_redirect))
+ if (!ContentSecurityPolicy::Allow(policy, directive_name, url, is_redirect,
+ this, source_location))
return false;
}
return true;
@@ -59,10 +60,6 @@ bool CSPContext::ProtocolMatchesSelf(const GURL& url) {
return url.SchemeIs(self_scheme_);
}
-void CSPContext::LogToConsole(const std::string& message) {
- return;
-}
-
bool CSPContext::SchemeShouldBypassCSP(const base::StringPiece& scheme) {
return false;
}
@@ -88,7 +85,8 @@ CSPViolationParams::CSPViolationParams(
const std::vector<std::string>& report_endpoints,
const std::string& header,
const blink::WebContentSecurityPolicyType& disposition,
- bool after_redirect)
+ bool after_redirect,
+ const SourceLocation& source_location)
: directive(directive),
effective_directive(effective_directive),
console_message(console_message),
@@ -96,7 +94,8 @@ CSPViolationParams::CSPViolationParams(
report_endpoints(report_endpoints),
header(header),
disposition(disposition),
- after_redirect(after_redirect) {}
+ after_redirect(after_redirect),
+ source_location(source_location) {}
CSPViolationParams::CSPViolationParams(const CSPViolationParams& other) =
default;
« no previous file with comments | « content/common/content_security_policy/csp_context.h ('k') | content/common/content_security_policy/csp_context_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698