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); |
} |