OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2009 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 if (dot == kNotFound) | 102 if (dot == kNotFound) |
103 m_registerableDomain = host; | 103 m_registerableDomain = host; |
104 else | 104 else |
105 m_registerableDomain = host.substring(dot + 1); | 105 m_registerableDomain = host.substring(dot + 1); |
106 } | 106 } |
107 } | 107 } |
108 } | 108 } |
109 | 109 |
110 OriginAccessEntry::MatchResult OriginAccessEntry::matchesOrigin(const SecurityOr
igin& origin) const | 110 OriginAccessEntry::MatchResult OriginAccessEntry::matchesOrigin(const SecurityOr
igin& origin) const |
111 { | 111 { |
112 ASSERT(origin.host() == origin.host().lower()); | |
113 ASSERT(origin.protocol() == origin.protocol().lower()); | 112 ASSERT(origin.protocol() == origin.protocol().lower()); |
114 | 113 |
115 if (m_protocol != origin.protocol()) | 114 if (m_protocol != origin.protocol()) |
116 return DoesNotMatchOrigin; | 115 return DoesNotMatchOrigin; |
117 | 116 |
| 117 return matchesDomain(origin); |
| 118 } |
| 119 |
| 120 OriginAccessEntry::MatchResult OriginAccessEntry::matchesDomain(const SecurityOr
igin& origin) const |
| 121 { |
| 122 ASSERT(origin.host() == origin.host().lower()); |
118 // Special case: Include subdomains and empty host means "all hosts, includi
ng ip addresses". | 123 // Special case: Include subdomains and empty host means "all hosts, includi
ng ip addresses". |
119 if (m_subdomainSettings != DisallowSubdomains && m_host.isEmpty()) | 124 if (m_subdomainSettings != DisallowSubdomains && m_host.isEmpty()) |
120 return MatchesOrigin; | 125 return MatchesOrigin; |
121 | 126 |
122 // Exact match. | 127 // Exact match. |
123 if (m_host == origin.host()) | 128 if (m_host == origin.host()) |
124 return MatchesOrigin; | 129 return MatchesOrigin; |
125 | 130 |
126 // Don't try to do subdomain matching on IP addresses. | 131 // Don't try to do subdomain matching on IP addresses. |
127 if (m_hostIsIPAddress) | 132 if (m_hostIsIPAddress) |
(...skipping 20 matching lines...) Expand all Loading... |
148 break; | 153 break; |
149 }; | 154 }; |
150 | 155 |
151 if (m_hostIsPublicSuffix) | 156 if (m_hostIsPublicSuffix) |
152 return MatchesOriginButIsPublicSuffix; | 157 return MatchesOriginButIsPublicSuffix; |
153 | 158 |
154 return MatchesOrigin; | 159 return MatchesOrigin; |
155 } | 160 } |
156 | 161 |
157 } // namespace blink | 162 } // namespace blink |
OLD | NEW |