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

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

Issue 2528423002: Part 3.5: Is policy list subsumed under subsuming policy? (Closed)
Patch Set: Removing debugging 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/SourceListDirective.cpp
diff --git a/third_party/WebKit/Source/core/frame/csp/SourceListDirective.cpp b/third_party/WebKit/Source/core/frame/csp/SourceListDirective.cpp
index 49fc73f111fdcfbcefb2640737c197d7aac7915b..6449cf9579a44c5258469eff9f25375582c74873 100644
--- a/third_party/WebKit/Source/core/frame/csp/SourceListDirective.cpp
+++ b/third_party/WebKit/Source/core/frame/csp/SourceListDirective.cpp
@@ -103,6 +103,12 @@ bool SourceListDirective::allowHashedAttributes() const {
return m_allowHashedAttributes;
}
+bool SourceListDirective::isNone() const {
+ return !m_list.size() && !m_allowSelf && !m_allowStar && !m_allowInline &&
+ !m_allowHashedAttributes && !m_allowEval && !m_allowDynamic &&
+ !m_nonces.size() && !m_hashes.size();
+}
+
uint8_t SourceListDirective::hashAlgorithmsUsed() const {
return m_hashAlgorithmsUsed;
}
@@ -595,8 +601,8 @@ bool SourceListDirective::allowAllInline() {
bool SourceListDirective::subsumes(
HeapVector<Member<SourceListDirective>> other) {
// TODO(amalika): Handle here special keywords.
- if (!m_list.size() || !other.size())
- return !m_list.size();
+ if (!other.size() || other[0]->isNone())
+ return other.size();
HeapVector<Member<CSPSource>> normalizedA = m_list;
if (m_allowSelf && other[0]->m_policy->getSelfSource())

Powered by Google App Engine
This is Rietveld 408576698