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

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

Issue 2526473005: Part 4.1: Is policy list subsumed under subsuming policy? (Closed)
Patch Set: Rebasing on master Created 4 years 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/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

Powered by Google App Engine
This is Rietveld 408576698