Chromium Code Reviews| Index: third_party/WebKit/Source/core/frame/csp/ContentSecurityPolicy.cpp |
| diff --git a/third_party/WebKit/Source/core/frame/csp/ContentSecurityPolicy.cpp b/third_party/WebKit/Source/core/frame/csp/ContentSecurityPolicy.cpp |
| index 529501b3539cd032b119e70c16308485b2786b98..8effd33654dfda047d7c9ddcd0722d8d47b0d73f 100644 |
| --- a/third_party/WebKit/Source/core/frame/csp/ContentSecurityPolicy.cpp |
| +++ b/third_party/WebKit/Source/core/frame/csp/ContentSecurityPolicy.cpp |
| @@ -1709,4 +1709,18 @@ bool ContentSecurityPolicy::ShouldBypassContentSecurityPolicy( |
| } |
| } |
| +// static |
| +bool ContentSecurityPolicy::IsValidCSPAttr(const String& attr) { |
| + if (attr.IsEmpty() || attr.find(',') != kNotFound) |
| + return false; |
|
Mike West
2017/05/29 13:49:31
Hrm. I think I'd prefer that you do both of these
andypaicu
2017/05/30 08:51:22
Done
|
| + ContentSecurityPolicy* policy = ContentSecurityPolicy::Create(); |
| + policy->AddPolicyFromHeaderValue(attr, |
| + kContentSecurityPolicyHeaderTypeEnforce, |
| + kContentSecurityPolicyHeaderSourceHTTP); |
| + if (policy->console_messages_.IsEmpty()) { |
| + return true; |
| + } |
| + return false; |
| +} |
| + |
| } // namespace blink |