From d932779e78df8ea1765b33acc70899a0d8a19f50 Mon Sep 17 00:00:00 2001 From: pkasting Date: Tue, 7 Oct 2014 15:38:35 -0700 Subject: Fix crash due to checkfailure in AutocompleteInput::Parse(). I hadn't meant to check this in, but I'm glad I did, as it helped me understand the code here better. I made a number of changes to how Parse() works in the aim of simpler code and more consistent behavior; the primary change is that we use the host from the fixed-up, canonicalized URL as much as possible. This change touches a lot of files, because I made two API changes: (1) CanonicalizeHost() no longer takes a desired TLD. (2) AutocompleteInput takes the desired TLD as a std::string() instead of a base::string16(). BUG=420010 TEST=Paste the text in https://code.google.com/p/chromium/issues/detail?id=420010#c3 into the omnibox and verify Chrome doesn't crash TBR=sky, pauljensen Review URL: https://codereview.chromium.org/633673002 Cr-Commit-Position: refs/heads/master@{#298594} --- net/base/net_util.cc | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'net/base/net_util.cc') diff --git a/net/base/net_util.cc b/net/base/net_util.cc index d63dfe8..b9cf59f 100644 --- a/net/base/net_util.cc +++ b/net/base/net_util.cc @@ -251,8 +251,7 @@ inline bool IsHostCharAlphanumeric(char c) { return ((c >= 'a') && (c <= 'z')) || ((c >= '0') && (c <= '9')); } -bool IsCanonicalizedHostCompliant(const std::string& host, - const std::string& desired_tld) { +bool IsCanonicalizedHostCompliant(const std::string& host) { if (host.empty()) return false; @@ -282,8 +281,7 @@ bool IsCanonicalizedHostCompliant(const std::string& host, } } - return most_recent_component_started_alphanumeric || - (!desired_tld.empty() && IsHostCharAlphanumeric(desired_tld[0])); + return most_recent_component_started_alphanumeric; } base::string16 StripWWW(const base::string16& text) { -- cgit v1.1