OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chrome/common/content_settings_pattern_parser.h" | 5 #include "chrome/common/content_settings_pattern_parser.h" |
6 | 6 |
7 #include "base/string_util.h" | 7 #include "base/string_util.h" |
8 #include "chrome/common/url_constants.h" | 8 #include "chrome/common/url_constants.h" |
9 #include "extensions/common/constants.h" | 9 #include "extensions/common/constants.h" |
10 #include "googleurl/src/gurl.h" | 10 #include "googleurl/src/gurl.h" |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
132 } else { | 132 } else { |
133 builder->WithScheme(scheme); | 133 builder->WithScheme(scheme); |
134 } | 134 } |
135 } else { | 135 } else { |
136 builder->WithSchemeWildcard(); | 136 builder->WithSchemeWildcard(); |
137 } | 137 } |
138 | 138 |
139 if (host_component.IsNonEmpty()) { | 139 if (host_component.IsNonEmpty()) { |
140 std::string host = pattern_spec.substr(host_component.start, | 140 std::string host = pattern_spec.substr(host_component.start, |
141 host_component.len); | 141 host_component.len); |
142 if (host == "." || host.find("..") != std::string::npos) { | |
jochen (gone - plz use gerrit)
2013/04/03 09:12:36
sorry for being late to the party
I would expect
markusheintz_
2013/04/03 09:48:40
Do you have any particular checks do you have in m
yhirano
2013/04/03 09:59:10
Let me clarify.
As you say, Builder::Validate() is
| |
143 builder->Invalid(); | |
144 return; | |
145 } | |
146 | |
142 if (host == kHostWildcard) { | 147 if (host == kHostWildcard) { |
143 builder->WithDomainWildcard(); | 148 builder->WithDomainWildcard(); |
144 } else if (StartsWithASCII(host, kDomainWildcard, true)) { | 149 } else if (StartsWithASCII(host, kDomainWildcard, true)) { |
145 host = host.substr(kDomainWildcardLength); | 150 host = host.substr(kDomainWildcardLength); |
146 builder->WithDomainWildcard(); | 151 builder->WithDomainWildcard(); |
147 builder->WithHost(host); | 152 builder->WithHost(host); |
148 } else { | 153 } else { |
149 // If the host contains a wildcard symbol then it is invalid. | 154 // If the host contains a wildcard symbol then it is invalid. |
150 if (host.find(kHostWildcard) != std::string::npos) { | 155 if (host.find(kHostWildcard) != std::string::npos) { |
151 builder->Invalid(); | 156 builder->Invalid(); |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
223 } | 228 } |
224 | 229 |
225 if (!parts.is_port_wildcard) { | 230 if (!parts.is_port_wildcard) { |
226 str += std::string(kUrlPortSeparator) + parts.port; | 231 str += std::string(kUrlPortSeparator) + parts.port; |
227 } | 232 } |
228 | 233 |
229 return str; | 234 return str; |
230 } | 235 } |
231 | 236 |
232 } // namespace content_settings | 237 } // namespace content_settings |
OLD | NEW |