Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(146)

Side by Side Diff: extensions/common/extension_messages.cc

Issue 2957233002: Fix parsing of effective TLD wildcarding across IPC. (Closed)
Patch Set: Fix nits Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "extensions/common/extension_messages.h" 5 #include "extensions/common/extension_messages.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <memory> 9 #include <memory>
10 10
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 if (!ReadParam(m, iter, &valid_schemes) || 133 if (!ReadParam(m, iter, &valid_schemes) ||
134 !ReadParam(m, iter, &spec)) 134 !ReadParam(m, iter, &spec))
135 return false; 135 return false;
136 136
137 // TODO(jstritar): We don't want the URLPattern to fail parsing when the 137 // TODO(jstritar): We don't want the URLPattern to fail parsing when the
138 // scheme is invalid. Instead, the pattern should parse but it should not 138 // scheme is invalid. Instead, the pattern should parse but it should not
139 // match the invalid patterns. We get around this by setting the valid 139 // match the invalid patterns. We get around this by setting the valid
140 // schemes after parsing the pattern. Update these method calls once we can 140 // schemes after parsing the pattern. Update these method calls once we can
141 // ignore scheme validation with URLPattern parse options. crbug.com/90544 141 // ignore scheme validation with URLPattern parse options. crbug.com/90544
142 p->SetValidSchemes(URLPattern::SCHEME_ALL); 142 p->SetValidSchemes(URLPattern::SCHEME_ALL);
143 URLPattern::ParseResult result = p->Parse(spec); 143 // Allow effective TLD wildcarding since this check is only needed on initial
144 // creation of URLPattern and not as part of deserialization.
145 URLPattern::ParseResult result =
146 p->Parse(spec, URLPattern::ALLOW_WILDCARD_FOR_EFFECTIVE_TLD);
144 p->SetValidSchemes(valid_schemes); 147 p->SetValidSchemes(valid_schemes);
145 return URLPattern::PARSE_SUCCESS == result; 148 return URLPattern::PARSE_SUCCESS == result;
146 } 149 }
147 150
148 void ParamTraits<URLPattern>::Log(const param_type& p, std::string* l) { 151 void ParamTraits<URLPattern>::Log(const param_type& p, std::string* l) {
149 LogParam(p.GetAsString(), l); 152 LogParam(p.GetAsString(), l);
150 } 153 }
151 154
152 void ParamTraits<URLPatternSet>::GetSize(base::PickleSizer* s, 155 void ParamTraits<URLPatternSet>::GetSize(base::PickleSizer* s,
153 const param_type& p) { 156 const param_type& p) {
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
390 ReadParam(m, iter, &p->policy_allowed_hosts) && 393 ReadParam(m, iter, &p->policy_allowed_hosts) &&
391 ReadParam(m, iter, &p->uses_default_policy_blocked_allowed_hosts); 394 ReadParam(m, iter, &p->uses_default_policy_blocked_allowed_hosts);
392 } 395 }
393 396
394 void ParamTraits<ExtensionMsg_Loaded_Params>::Log(const param_type& p, 397 void ParamTraits<ExtensionMsg_Loaded_Params>::Log(const param_type& p,
395 std::string* l) { 398 std::string* l) {
396 l->append(p.id); 399 l->append(p.id);
397 } 400 }
398 401
399 } // namespace IPC 402 } // namespace IPC
OLDNEW
« no previous file with comments | « chrome/browser/extensions/content_script_apitest.cc ('k') | extensions/common/extension_messages_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698