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

Unified Diff: components/search_engines/template_url_service.cc

Issue 2433583002: Reduce buggy usage of the registry controlled domain service. (Closed)
Patch Set: . Created 4 years, 2 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 side-by-side diff with in-line comments
Download patch
Index: components/search_engines/template_url_service.cc
diff --git a/components/search_engines/template_url_service.cc b/components/search_engines/template_url_service.cc
index ee12247b7e05e9ee6eb700c5464e914503b57d10..98687484d6b01b95c9c995db243785688119968d 100644
--- a/components/search_engines/template_url_service.cc
+++ b/components/search_engines/template_url_service.cc
@@ -153,7 +153,11 @@ void LogDuplicatesHistogram(
// Returns the length of the registry portion of a hostname. For example,
// www.google.co.uk will return 5 (the length of co.uk).
size_t GetRegistryLength(const base::string16& host) {
- return net::registry_controlled_domains::GetRegistryLength(
+ // TODO(bug 657199) this is wrong! This function converts UTF-16 to UTF-8
+ // then it gets canonicalized by the registry controlled domain function, and
+ // then the length in the canonicalized string is returned. This length is
+ // not the length in UTF-8 or even UTF-16 in the input!
+ return net::registry_controlled_domains::BuggyGetHostRegistryLength(
base::UTF16ToUTF8(host),
net::registry_controlled_domains::EXCLUDE_UNKNOWN_REGISTRIES,
net::registry_controlled_domains::EXCLUDE_PRIVATE_REGISTRIES);

Powered by Google App Engine
This is Rietveld 408576698