| Index: components/url_formatter/url_fixer.cc
|
| diff --git a/components/url_formatter/url_fixer.cc b/components/url_formatter/url_fixer.cc
|
| index c49b31ba08cb4ee680a9498c64abbd69c728f9d6..0009b2fc6425f6832ad096f3c6fea0ecfef2703d 100644
|
| --- a/components/url_formatter/url_fixer.cc
|
| +++ b/components/url_formatter/url_fixer.cc
|
| @@ -201,20 +201,16 @@ void AddDesiredTLD(const std::string& desired_tld, std::string* domain) {
|
| if (desired_tld.empty() || domain->empty())
|
| return;
|
|
|
| - // Check the TLD. If the return value is positive, we already have a TLD, so
|
| - // abort. If the return value is std::string::npos, there's no valid host,
|
| - // but we can try to append a TLD anyway, since the host may become valid once
|
| - // the TLD is attached -- for example, "999999999999" is detected as a broken
|
| - // IP address and marked invalid, but attaching ".com" makes it legal. When
|
| - // the return value is 0, there's a valid host with no known TLD, so we can
|
| - // definitely append the user's TLD. We disallow unknown registries here so
|
| - // users can input "mail.yahoo" and hit ctrl-enter to get
|
| - // "www.mail.yahoo.com".
|
| - const size_t registry_length =
|
| - net::registry_controlled_domains::GetRegistryLength(
|
| - *domain, net::registry_controlled_domains::EXCLUDE_UNKNOWN_REGISTRIES,
|
| - net::registry_controlled_domains::EXCLUDE_PRIVATE_REGISTRIES);
|
| - if ((registry_length != 0) && (registry_length != std::string::npos))
|
| + // Abort if we already have a known TLD. In the case of an invalid host,
|
| + // HostHasRegistryControlledDomain will return false and we will try to
|
| + // append a TLD (which may make it valid). For example, "999999999999" is
|
| + // detected as a broken IP address and marked invalid, but attaching ".com"
|
| + // makes it legal. We disallow unknown registries here so users can input
|
| + // "mail.yahoo" and hit ctrl-enter to get "www.mail.yahoo.com".
|
| + if (net::registry_controlled_domains::HostHasRegistryControlledDomain(
|
| + *domain,
|
| + net::registry_controlled_domains::EXCLUDE_UNKNOWN_REGISTRIES,
|
| + net::registry_controlled_domains::EXCLUDE_PRIVATE_REGISTRIES))
|
| return;
|
|
|
| // Add the suffix at the end of the domain.
|
|
|