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

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

Issue 2470083002: Part 2.1: Is policy list subsumed under subsuming policy? (Closed)
Patch Set: Rebasing on master 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/SourceListDirective.h" 5 #include "core/frame/csp/SourceListDirective.h"
6 6
7 #include "core/frame/csp/CSPSource.h" 7 #include "core/frame/csp/CSPSource.h"
8 #include "core/frame/csp/ContentSecurityPolicy.h" 8 #include "core/frame/csp/ContentSecurityPolicy.h"
9 #include "platform/network/ContentSecurityPolicyParsers.h" 9 #include "platform/network/ContentSecurityPolicyParsers.h"
10 #include "platform/weborigin/KURL.h" 10 #include "platform/weborigin/KURL.h"
(...skipping 551 matching lines...) Expand 10 before | Expand all | Expand 10 after
562 const KURL& url, 562 const KURL& url,
563 ResourceRequest::RedirectStatus redirectStatus) const { 563 ResourceRequest::RedirectStatus redirectStatus) const {
564 for (size_t i = 0; i < m_list.size(); ++i) { 564 for (size_t i = 0; i < m_list.size(); ++i) {
565 if (m_list[i]->matches(url, redirectStatus)) 565 if (m_list[i]->matches(url, redirectStatus))
566 return true; 566 return true;
567 } 567 }
568 568
569 return false; 569 return false;
570 } 570 }
571 571
572 HeapVector<Member<CSPSource>> SourceListDirective::getIntersectCSPSources(
573 HeapVector<Member<CSPSource>> otherVector) {
574 HeapVector<Member<CSPSource>> normalized;
575 for (const auto& aCspSource : m_list) {
576 Member<CSPSource> matchedCspSource(nullptr);
577 for (const auto& bCspSource : otherVector) {
578 if ((matchedCspSource = bCspSource->intersect(aCspSource)))
579 break;
580 }
581 if (matchedCspSource)
582 normalized.append(matchedCspSource);
583 }
584 return normalized;
585 }
586
572 DEFINE_TRACE(SourceListDirective) { 587 DEFINE_TRACE(SourceListDirective) {
573 visitor->trace(m_policy); 588 visitor->trace(m_policy);
574 visitor->trace(m_list); 589 visitor->trace(m_list);
575 CSPDirective::trace(visitor); 590 CSPDirective::trace(visitor);
576 } 591 }
577 592
578 } // namespace blink 593 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698