Chromium Code Reviews| 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 "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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 67 UseCounter::count(*document, | 67 UseCounter::count(*document, |
| 68 UseCounter::CSPSourceWildcardWouldMatchExactHost); | 68 UseCounter::CSPSourceWildcardWouldMatchExactHost); |
| 69 } else { | 69 } else { |
| 70 match = equalHosts; | 70 match = equalHosts; |
| 71 } | 71 } |
| 72 | 72 |
| 73 return match; | 73 return match; |
| 74 } | 74 } |
| 75 | 75 |
| 76 bool CSPSource::pathMatches(const String& urlPath) const { | 76 bool CSPSource::pathMatches(const String& urlPath) const { |
| 77 if (m_path.isEmpty()) | 77 if (m_path.isEmpty() || (m_path == "/" && urlPath.isEmpty())) |
|
Mike West
2016/12/08 08:25:52
Can you add a test to `CSPSourceTest.cpp`?
| |
| 78 return true; | 78 return true; |
| 79 | 79 |
| 80 String path = decodeURLEscapeSequences(urlPath); | 80 String path = decodeURLEscapeSequences(urlPath); |
| 81 | 81 |
| 82 if (m_path.endsWith("/")) | 82 if (m_path.endsWith("/")) |
| 83 return path.startsWith(m_path); | 83 return path.startsWith(m_path); |
| 84 | 84 |
| 85 return path == m_path; | 85 return path == m_path; |
| 86 } | 86 } |
| 87 | 87 |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 189 return false; | 189 return false; |
| 190 } | 190 } |
| 191 return true; | 191 return true; |
| 192 } | 192 } |
| 193 | 193 |
| 194 DEFINE_TRACE(CSPSource) { | 194 DEFINE_TRACE(CSPSource) { |
| 195 visitor->trace(m_policy); | 195 visitor->trace(m_policy); |
| 196 } | 196 } |
| 197 | 197 |
| 198 } // namespace blink | 198 } // namespace blink |
| OLD | NEW |