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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 bool CSPSource::portMatches(const KURL& url) const | 84 bool CSPSource::portMatches(const KURL& url) const |
85 { | 85 { |
86 if (m_portWildcard == HasWildcard) | 86 if (m_portWildcard == HasWildcard) |
87 return true; | 87 return true; |
88 | 88 |
89 int port = url.port(); | 89 int port = url.port(); |
90 | 90 |
91 if (port == m_port) | 91 if (port == m_port) |
92 return true; | 92 return true; |
93 | 93 |
| 94 if (m_port == 80 && (port == 443 || (port == 0 && defaultPortForProtocol(url
.protocol()) == 443))) |
| 95 return true; |
| 96 |
94 if (!port) | 97 if (!port) |
95 return isDefaultPortForProtocol(m_port, url.protocol()); | 98 return isDefaultPortForProtocol(m_port, url.protocol()); |
96 | 99 |
97 if (!m_port) | 100 if (!m_port) |
98 return isDefaultPortForProtocol(port, url.protocol()); | 101 return isDefaultPortForProtocol(port, url.protocol()); |
99 | 102 |
100 return false; | 103 return false; |
101 } | 104 } |
102 | 105 |
103 bool CSPSource::isSchemeOnly() const | 106 bool CSPSource::isSchemeOnly() const |
104 { | 107 { |
105 return m_host.isEmpty(); | 108 return m_host.isEmpty(); |
106 } | 109 } |
107 | 110 |
108 DEFINE_TRACE(CSPSource) | 111 DEFINE_TRACE(CSPSource) |
109 { | 112 { |
110 visitor->trace(m_policy); | 113 visitor->trace(m_policy); |
111 } | 114 } |
112 | 115 |
113 } // namespace blink | 116 } // namespace blink |
OLD | NEW |