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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 if (dot == kNotFound) | 101 if (dot == kNotFound) |
102 m_registerableDomain = host; | 102 m_registerableDomain = host; |
103 else | 103 else |
104 m_registerableDomain = host.substring(dot + 1); | 104 m_registerableDomain = host.substring(dot + 1); |
105 } | 105 } |
106 } | 106 } |
107 } | 107 } |
108 | 108 |
109 OriginAccessEntry::MatchResult OriginAccessEntry::matchesOrigin(const SecurityOr
igin& origin) const | 109 OriginAccessEntry::MatchResult OriginAccessEntry::matchesOrigin(const SecurityOr
igin& origin) const |
110 { | 110 { |
111 ASSERT(origin.host() == origin.host().lower()); | |
112 ASSERT(origin.protocol() == origin.protocol().lower()); | 111 ASSERT(origin.protocol() == origin.protocol().lower()); |
113 | 112 |
114 if (m_protocol != origin.protocol()) | 113 if (m_protocol != origin.protocol()) |
115 return DoesNotMatchOrigin; | 114 return DoesNotMatchOrigin; |
116 | 115 |
| 116 return matchesDomain(origin); |
| 117 } |
| 118 |
| 119 OriginAccessEntry::MatchResult OriginAccessEntry::matchesDomain(const SecurityOr
igin& origin) const |
| 120 { |
| 121 ASSERT(origin.host() == origin.host().lower()); |
117 // Special case: Include subdomains and empty host means "all hosts, includi
ng ip addresses". | 122 // Special case: Include subdomains and empty host means "all hosts, includi
ng ip addresses". |
118 if (m_subdomainSettings != DisallowSubdomains && m_host.isEmpty()) | 123 if (m_subdomainSettings != DisallowSubdomains && m_host.isEmpty()) |
119 return MatchesOrigin; | 124 return MatchesOrigin; |
120 | 125 |
121 // Exact match. | 126 // Exact match. |
122 if (m_host == origin.host()) | 127 if (m_host == origin.host()) |
123 return MatchesOrigin; | 128 return MatchesOrigin; |
124 | 129 |
125 // Don't try to do subdomain matching on IP addresses. | 130 // Don't try to do subdomain matching on IP addresses. |
126 if (m_hostIsIPAddress) | 131 if (m_hostIsIPAddress) |
(...skipping 20 matching lines...) Expand all Loading... |
147 break; | 152 break; |
148 }; | 153 }; |
149 | 154 |
150 if (m_hostIsPublicSuffix) | 155 if (m_hostIsPublicSuffix) |
151 return MatchesOriginButIsPublicSuffix; | 156 return MatchesOriginButIsPublicSuffix; |
152 | 157 |
153 return MatchesOrigin; | 158 return MatchesOrigin; |
154 } | 159 } |
155 | 160 |
156 } // namespace blink | 161 } // namespace blink |
OLD | NEW |