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

Side by Side 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "core/frame/csp/CSPSource.h" 5 #include "core/frame/csp/CSPSource.h"
6 6
7 #include "core/frame/UseCounter.h" 7 #include "core/frame/UseCounter.h"
8 #include "core/frame/csp/ContentSecurityPolicy.h" 8 #include "core/frame/csp/ContentSecurityPolicy.h"
9 #include "platform/weborigin/KURL.h" 9 #include "platform/weborigin/KURL.h"
10 #include "platform/weborigin/KnownPorts.h" 10 #include "platform/weborigin/KnownPorts.h"
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 WildcardDisposition portWildcard = 155 WildcardDisposition portWildcard =
156 (m_portWildcard == HasWildcard) ? other->m_portWildcard : m_portWildcard; 156 (m_portWildcard == HasWildcard) ? other->m_portWildcard : m_portWildcard;
157 return new CSPSource(m_policy, scheme, host, port, path, hostWildcard, 157 return new CSPSource(m_policy, scheme, host, port, path, hostWildcard,
158 portWildcard); 158 portWildcard);
159 } 159 }
160 160
161 bool CSPSource::isSchemeOnly() const { 161 bool CSPSource::isSchemeOnly() const {
162 return m_host.isEmpty(); 162 return m_host.isEmpty();
163 } 163 }
164 164
165 bool CSPSource::firstSubsumesSecond(HeapVector<Member<CSPSource>> a,
166 HeapVector<Member<CSPSource>> b) {
Mike West 2016/11/10 15:04:54 Nit: `listA`, `listB`?
167 // Empty vector of CSPSources has an effect of 'none'.
168 if (a.size() == 0 || b.size() == 0)
169 return b.size() == 0;
Mike West 2016/11/10 15:04:54 Nit: For all of these, you can write `a.size() ==
170
171 for (const auto& bCspSrc : b) {
Mike West 2016/11/10 15:04:54 Please add a comment here: something like "Walk th
172 bool foundMatch = false;
173 for (const auto& aCspSrc : a) {
174 if ((foundMatch = aCspSrc->subsumes(bCspSrc)))
Mike West 2016/11/10 15:04:54 Nit: `sourceA`, `sourceB`?
175 break;
176 }
177 if (!foundMatch)
178 return false;
179 }
180 return true;
181 }
182
165 DEFINE_TRACE(CSPSource) { 183 DEFINE_TRACE(CSPSource) {
166 visitor->trace(m_policy); 184 visitor->trace(m_policy);
167 } 185 }
168 186
169 } // namespace blink 187 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698