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

Issue 2378213002: Mark URLs with empty schemes as invalid. (Closed)

Created:
4 years, 2 months ago by brettw
Modified:
4 years, 2 months ago
Reviewers:
Peter Kasting
CC:
chromium-reviews
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Mark URLs with empty schemes as invalid. Previously Chrome allowed empty schemes. This meant that URLs such as ":" or ":foo" were marked as valid. According to WHATWG: A scheme must be one ASCII alpha, followed by zero or more of ASCII alphanumeric, "+", "-", and ".". This change marks URLs with empty schemes as invalid. This forced some changes to the URL fixer and autocomplete systems to keep from breaking the behavior of input like ":w" (which we want to do a search). Previously the URL fixer would see ":w" as having a valid (but empty) scheme. Therefore, it would not attempt to prepend "http://" and the autocomplete system would make a GURL out of that literal string. GURL would interpret it as a "path" URL (with no host). AutocompleteInput::Parse checks for URLs with no host and a comment that this only happens for URLs beginning with a colon, and converts those to a query. With this change, ":w" becomes invalid and url_fixer attempts to prepend schemes. This changes the behavior for certain invalid URLs like ":b005::68]" in the tests which used to mean "give up" and now is treated like "http" like most other garbage input that doesn't start with a colon. For these types of inputs, I think either behavior should be fine. To preserve ":w" means query this patch just checks for a colon at the beginning of the input and removes the empty host check. I was originally trying to avoid this, but since there was already a special check for this unusual case, it seems inevitable that some check for this case will always be present. BUG=515497 Committed: https://crrev.com/46f9b83f18486b8b735afbc108b75ed0d9537123 Cr-Commit-Position: refs/heads/master@{#423249}

Patch Set 1 #

Patch Set 2 : Fixes #

Patch Set 3 : . #

Total comments: 5

Patch Set 4 : . #

Total comments: 4

Patch Set 5 : Comments #

Unified diffs Side-by-side diffs Delta from patch set Stats (+19 lines, -21 lines) Patch
M components/omnibox/browser/autocomplete_input.cc View 1 2 3 4 1 chunk +0 lines, -7 lines 0 comments Download
M components/omnibox/browser/autocomplete_input_unittest.cc View 1 2 3 4 1 chunk +2 lines, -2 lines 0 comments Download
M components/url_formatter/url_fixer.cc View 1 2 3 4 1 chunk +4 lines, -1 line 0 comments Download
M components/url_formatter/url_fixer_unittest.cc View 1 2 2 chunks +7 lines, -6 lines 0 comments Download
M url/gurl_unittest.cc View 2 chunks +1 line, -1 line 0 comments Download
M url/url_canon_etc.cc View 1 chunk +1 line, -1 line 0 comments Download
M url/url_canon_unittest.cc View 1 2 3 4 chunks +4 lines, -3 lines 0 comments Download

Messages

Total messages: 41 (25 generated)
brettw
.
4 years, 2 months ago (2016-09-28 23:35:01 UTC) #6
brettw
4 years, 2 months ago (2016-09-28 23:35:37 UTC) #8
Peter Kasting
What's the practical effect of our current behavior? I'm not necessarily opposed to fixing it ...
4 years, 2 months ago (2016-09-29 04:54:12 UTC) #13
brettw
On 2016/09/29 04:54:12, Peter Kasting (busy Sep 29) wrote: > What's the practical effect of ...
4 years, 2 months ago (2016-09-29 17:02:48 UTC) #14
brettw
.
4 years, 2 months ago (2016-09-29 17:03:16 UTC) #15
brettw
(new snap up if that wasn't clear)
4 years, 2 months ago (2016-09-30 20:24:05 UTC) #24
Peter Kasting
Will re-review. Nice-to-have: if you can reply on the codereview tool, rather than by email, ...
4 years, 2 months ago (2016-09-30 20:29:33 UTC) #25
brettw
ping
4 years, 2 months ago (2016-10-03 18:09:37 UTC) #26
Peter Kasting
On 2016/10/03 18:09:37, brettw (ping on IM after 24h) wrote: > ping Will try to ...
4 years, 2 months ago (2016-10-04 07:56:37 UTC) #27
Peter Kasting
This all seems fine save the autocomplete_input.cc issue. https://codereview.chromium.org/2378213002/diff/60001/components/omnibox/browser/autocomplete_input.cc File components/omnibox/browser/autocomplete_input.cc (right): https://codereview.chromium.org/2378213002/diff/60001/components/omnibox/browser/autocomplete_input.cc#newcode162 components/omnibox/browser/autocomplete_input.cc:162: return ...
4 years, 2 months ago (2016-10-05 00:56:30 UTC) #28
brettw
Comments
4 years, 2 months ago (2016-10-05 05:08:47 UTC) #29
brettw
New snap up. https://codereview.chromium.org/2378213002/diff/60001/components/omnibox/browser/autocomplete_input.cc File components/omnibox/browser/autocomplete_input.cc (right): https://codereview.chromium.org/2378213002/diff/60001/components/omnibox/browser/autocomplete_input.cc#newcode162 components/omnibox/browser/autocomplete_input.cc:162: return metrics::OmniboxInputType::QUERY; It does return UNKNOWN ...
4 years, 2 months ago (2016-10-05 05:10:12 UTC) #30
Peter Kasting
LGTM
4 years, 2 months ago (2016-10-05 19:06:16 UTC) #35
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2378213002/80001
4 years, 2 months ago (2016-10-05 19:15:34 UTC) #37
commit-bot: I haz the power
Committed patchset #5 (id:80001)
4 years, 2 months ago (2016-10-05 19:23:08 UTC) #39
commit-bot: I haz the power
4 years, 2 months ago (2016-10-05 19:25:23 UTC) #41
Message was sent while issue was closed.
Patchset 5 (id:??) landed as
https://crrev.com/46f9b83f18486b8b735afbc108b75ed0d9537123
Cr-Commit-Position: refs/heads/master@{#423249}

Powered by Google App Engine
This is Rietveld 408576698