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

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: Rebasing 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..d54d4ddfbcbf6bcc36dfd6db0c55c255f56c032f 100644
--- a/third_party/WebKit/Source/core/frame/csp/CSPSource.cpp
+++ b/third_party/WebKit/Source/core/frame/csp/CSPSource.cpp
@@ -162,6 +162,27 @@ bool CSPSource::isSchemeOnly() const {
return m_host.isEmpty();
}
+bool CSPSource::firstSubsumesSecond(HeapVector<Member<CSPSource>> listA,
+ HeapVector<Member<CSPSource>> listB) {
+ // Empty vector of CSPSources has an effect of 'none'.
+ if (!listA.size() || !listB.size())
+ return !listB.size();
+
+ // Walk through all the items in |listB|, ensuring that each is subsumed by at
+ // least one item in |listA|. If any item in |listB| is not subsumed, return
+ // false.
+ for (const auto& sourceB : listB) {
+ bool foundMatch = false;
+ for (const auto& sourceA : listA) {
+ if ((foundMatch = sourceA->subsumes(sourceB)))
+ break;
+ }
+ if (!foundMatch)
+ return false;
+ }
+ return true;
+}
+
DEFINE_TRACE(CSPSource) {
visitor->trace(m_policy);
}
« no previous file with comments | « third_party/WebKit/Source/core/frame/csp/CSPSource.h ('k') | third_party/WebKit/Source/core/frame/csp/CSPSourceTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698