diff options
author | pkasting <pkasting@chromium.org> | 2014-10-07 15:38:35 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-10-07 22:39:04 +0000 |
commit | d932779e78df8ea1765b33acc70899a0d8a19f50 (patch) | |
tree | 9d0a34c236b77074a56eba30ccadefa33be8e4db /net/base/net_util.cc | |
parent | b3d5cf50a2aae19ed7604b54c0c93f8470e4e7ee (diff) | |
download | chromium_src-d932779e78df8ea1765b33acc70899a0d8a19f50.zip chromium_src-d932779e78df8ea1765b33acc70899a0d8a19f50.tar.gz chromium_src-d932779e78df8ea1765b33acc70899a0d8a19f50.tar.bz2 |
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}
Diffstat (limited to 'net/base/net_util.cc')
-rw-r--r-- | net/base/net_util.cc | 6 |
1 files changed, 2 insertions, 4 deletions
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) { |