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

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

Issue 2452903004: Part 2.2: Is policy list subsumed under subsuming policy? (Closed)
Patch Set: After rebasing on part2.1 Created 4 years, 1 month 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/CSPSource.cpp
diff --git a/third_party/WebKit/Source/core/frame/csp/CSPSource.cpp b/third_party/WebKit/Source/core/frame/csp/CSPSource.cpp
index 0d2dfe1a4f3665f150cde6ff3d3be7004ab91d68..a7226e42f8dfc5de4611a456fe30f2bd2a81b25e 100644
--- a/third_party/WebKit/Source/core/frame/csp/CSPSource.cpp
+++ b/third_party/WebKit/Source/core/frame/csp/CSPSource.cpp
@@ -162,6 +162,24 @@ bool CSPSource::isSchemeOnly() const {
return m_host.isEmpty();
}
+bool CSPSource::firstSubsumesSecond(HeapVector<Member<CSPSource>> a,
+ HeapVector<Member<CSPSource>> b) {
Mike West 2016/11/10 15:04:54 Nit: `listA`, `listB`?
+ // Empty vector of CSPSources has an effect of 'none'.
+ if (a.size() == 0 || b.size() == 0)
+ return b.size() == 0;
Mike West 2016/11/10 15:04:54 Nit: For all of these, you can write `a.size() ==
+
+ for (const auto& bCspSrc : b) {
Mike West 2016/11/10 15:04:54 Please add a comment here: something like "Walk th
+ bool foundMatch = false;
+ for (const auto& aCspSrc : a) {
+ if ((foundMatch = aCspSrc->subsumes(bCspSrc)))
Mike West 2016/11/10 15:04:54 Nit: `sourceA`, `sourceB`?
+ break;
+ }
+ if (!foundMatch)
+ return false;
+ }
+ return true;
+}
+
DEFINE_TRACE(CSPSource) {
visitor->trace(m_policy);
}

Powered by Google App Engine
This is Rietveld 408576698