OLD | NEW |
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 "config.h" | 5 #include "config.h" |
6 #include "core/frame/csp/CSPSourceList.h" | 6 #include "core/frame/csp/CSPSourceList.h" |
7 | 7 |
8 #include "core/frame/csp/CSPSource.h" | 8 #include "core/frame/csp/CSPSource.h" |
9 #include "core/frame/csp/ContentSecurityPolicy.h" | 9 #include "core/frame/csp/ContentSecurityPolicy.h" |
10 #include "platform/ParsingUtilities.h" | 10 #include "platform/ParsingUtilities.h" |
(...skipping 30 matching lines...) Expand all Loading... |
41 , m_allowEval(false) | 41 , m_allowEval(false) |
42 , m_hashAlgorithmsUsed(0) | 42 , m_hashAlgorithmsUsed(0) |
43 { | 43 { |
44 } | 44 } |
45 | 45 |
46 bool CSPSourceList::matches(const KURL& url, ContentSecurityPolicy::RedirectStat
us redirectStatus) const | 46 bool CSPSourceList::matches(const KURL& url, ContentSecurityPolicy::RedirectStat
us redirectStatus) const |
47 { | 47 { |
48 if (m_allowStar) | 48 if (m_allowStar) |
49 return true; | 49 return true; |
50 | 50 |
51 KURL effectiveURL = SecurityOrigin::shouldUseInnerURL(url) ? SecurityOrigin:
:extractInnerURL(url) : url; | 51 KURL effectiveURL = m_policy->selfMatchesInnerURL() && SecurityOrigin::shoul
dUseInnerURL(url) ? SecurityOrigin::extractInnerURL(url) : url; |
52 | 52 |
53 if (m_allowSelf && m_policy->urlMatchesSelf(effectiveURL)) | 53 if (m_allowSelf && m_policy->urlMatchesSelf(effectiveURL)) |
54 return true; | 54 return true; |
55 | 55 |
56 for (size_t i = 0; i < m_list.size(); ++i) { | 56 for (size_t i = 0; i < m_list.size(); ++i) { |
57 if (m_list[i].matches(effectiveURL, redirectStatus)) | 57 if (m_list[i].matches(effectiveURL, redirectStatus)) |
58 return true; | 58 return true; |
59 } | 59 } |
60 | 60 |
61 return false; | 61 return false; |
(...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
485 } | 485 } |
486 | 486 |
487 void CSPSourceList::addSourceHash(const ContentSecurityPolicyHashAlgorithm& algo
rithm, const DigestValue& hash) | 487 void CSPSourceList::addSourceHash(const ContentSecurityPolicyHashAlgorithm& algo
rithm, const DigestValue& hash) |
488 { | 488 { |
489 m_hashes.add(CSPHashValue(algorithm, hash)); | 489 m_hashes.add(CSPHashValue(algorithm, hash)); |
490 m_hashAlgorithmsUsed |= algorithm; | 490 m_hashAlgorithmsUsed |= algorithm; |
491 } | 491 } |
492 | 492 |
493 | 493 |
494 } // namespace blink | 494 } // namespace blink |
OLD | NEW |