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 403a7fc926ed0bc2a290ce7c945d471a9339885f..f872ff2f0d1f60f6c31dde7a8620032409261bd7 100644 |
--- a/third_party/WebKit/Source/core/frame/csp/ContentSecurityPolicy.cpp |
+++ b/third_party/WebKit/Source/core/frame/csp/ContentSecurityPolicy.cpp |
@@ -1595,4 +1595,20 @@ ContentSecurityPolicy::DirectiveType ContentSecurityPolicy::getDirectiveType( |
return DirectiveType::Undefined; |
} |
+bool ContentSecurityPolicy::subsumes(const ContentSecurityPolicy& other) { |
+ if (!m_policies.size() || !other.m_policies.size()) |
+ return !m_policies.size(); |
+ // Embedding-CSP must specify only one policy. |
+ if (m_policies.size() != 1) |
+ return false; |
+ |
+ CSPDirectiveListVector otherVector; |
+ for (const auto& policy : other.m_policies) { |
+ if (!policy->isReportOnly()) |
+ otherVector.append(policy); |
+ } |
+ |
+ return m_policies[0]->subsumes(otherVector); |
+} |
+ |
} // namespace blink |