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

Issue 2124563002: Don't try to create a verbatim match with an empty input. (Closed)

Created:
4 years, 5 months ago by jif
Modified:
4 years, 5 months ago
CC:
chromium-reviews, dcheng, rohitrao (ping after 24h)
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Don't try to create a verbatim match with an empty input. ## Description of the problem On iOS, tapping on an empty omnibox triggers a request to the ClipboardUrlProvider. The ClipboardURLProvider then calls VerbatimMatchForURL with an empty |input| (if the omnibox was empty), which eventually triggers a DCHECK_GT in |AutocompleteMatch::ClassifyLocationInString|: // Classifying an empty match makes no sense and will lead to validation // errors later. DCHECK_GT(match_length, 0U); ## Description of the solution This CL makes it forbidden to pass an empty input to |VerbatimMatchForURL|, and fixes the clipboard_url_provider. BUG=625313 Committed: https://crrev.com/3986ea5094d68640f88501cfddb01689d89eb8ba Cr-Commit-Position: refs/heads/master@{#405136}

Patch Set 1 #

Total comments: 10

Patch Set 2 : Addressed comments. #

Total comments: 4
Unified diffs Side-by-side diffs Delta from patch set Stats (+16 lines, -8 lines) Patch
M components/omnibox/browser/clipboard_url_provider.cc View 1 1 chunk +12 lines, -7 lines 3 comments Download
M components/omnibox/browser/verbatim_match.h View 1 chunk +2 lines, -1 line 0 comments Download
M components/omnibox/browser/verbatim_match.cc View 1 2 chunks +2 lines, -0 lines 1 comment Download

Messages

Total messages: 34 (16 generated)
jif
Hi, this is a somewhat urgent CL as the omnibox in Chrome iOS is pretty ...
4 years, 5 months ago (2016-07-04 16:45:54 UTC) #7
sdefresne
https://codereview.chromium.org/2124563002/diff/20001/components/omnibox/browser/clipboard_url_provider.cc File components/omnibox/browser/clipboard_url_provider.cc (right): https://codereview.chromium.org/2124563002/diff/20001/components/omnibox/browser/clipboard_url_provider.cc#newcode46 components/omnibox/browser/clipboard_url_provider.cc:46: // If the omnibox is not empty, adds a ...
4 years, 5 months ago (2016-07-05 10:08:57 UTC) #9
Mark P
I'm not yet convinced this changelist is the right approach. If you want a band-aid ...
4 years, 5 months ago (2016-07-05 22:01:57 UTC) #11
jif-google
On 2016/07/05 22:01:57, Mark P wrote: > I'm not yet convinced this changelist is the ...
4 years, 5 months ago (2016-07-06 08:13:23 UTC) #12
Mark P
Given your explanation, this sound looks reasonable. Some comments below. --mark https://codereview.chromium.org/2124563002/diff/20001/components/omnibox/browser/clipboard_url_provider.cc File components/omnibox/browser/clipboard_url_provider.cc (right): ...
4 years, 5 months ago (2016-07-06 18:56:47 UTC) #13
Peter Kasting
If the verbatim match cannot be constructed, won't we now add the clipboard match as ...
4 years, 5 months ago (2016-07-06 20:55:21 UTC) #14
Mark P
On 2016/07/06 20:55:21, Peter Kasting wrote: > If the verbatim match cannot be constructed, won't ...
4 years, 5 months ago (2016-07-06 21:17:27 UTC) #15
Peter Kasting
On 2016/07/06 21:17:27, Mark P wrote: > On 2016/07/06 20:55:21, Peter Kasting wrote: > > ...
4 years, 5 months ago (2016-07-06 21:28:09 UTC) #16
jif
On 2016/07/06 21:28:09, Peter Kasting (OOO til Jul 18) wrote: > On 2016/07/06 21:17:27, Mark ...
4 years, 5 months ago (2016-07-11 15:09:18 UTC) #17
jif
https://codereview.chromium.org/2124563002/diff/20001/components/omnibox/browser/clipboard_url_provider.cc File components/omnibox/browser/clipboard_url_provider.cc (right): https://codereview.chromium.org/2124563002/diff/20001/components/omnibox/browser/clipboard_url_provider.cc#newcode46 components/omnibox/browser/clipboard_url_provider.cc:46: // If the omnibox is not empty, adds a ...
4 years, 5 months ago (2016-07-11 15:09:36 UTC) #18
Mark P
lgtm though you may want to wait for others to re-review too --mark
4 years, 5 months ago (2016-07-11 17:04:16 UTC) #19
sdefresne
lgtm
4 years, 5 months ago (2016-07-12 08:40:31 UTC) #20
jif
On 2016/07/12 08:40:31, sdefresne wrote: > lgtm pkasting is OOO for the rest of the ...
4 years, 5 months ago (2016-07-13 13:06:15 UTC) #25
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/2124563002/40001
4 years, 5 months ago (2016-07-13 13:06:39 UTC) #27
commit-bot: I haz the power
Committed patchset #2 (id:40001)
4 years, 5 months ago (2016-07-13 13:43:59 UTC) #29
commit-bot: I haz the power
CQ bit was unchecked.
4 years, 5 months ago (2016-07-13 13:44:05 UTC) #30
commit-bot: I haz the power
Patchset 2 (id:??) landed as https://crrev.com/3986ea5094d68640f88501cfddb01689d89eb8ba Cr-Commit-Position: refs/heads/master@{#405136}
4 years, 5 months ago (2016-07-13 13:45:27 UTC) #32
Peter Kasting
4 years, 5 months ago (2016-07-18 22:16:15 UTC) #34
Message was sent while issue was closed.
I'm back now.

https://codereview.chromium.org/2124563002/diff/40001/components/omnibox/brow...
File components/omnibox/browser/clipboard_url_provider.cc (right):

https://codereview.chromium.org/2124563002/diff/40001/components/omnibox/brow...
components/omnibox/browser/clipboard_url_provider.cc:34: // If the user started
typing, do not offer clipboard based match.
Nit: I would not add these next two comments.  They simply restate the code
without adding any useful information such as motivation why we do this, so
they're just clutter.

https://codereview.chromium.org/2124563002/diff/40001/components/omnibox/brow...
components/omnibox/browser/clipboard_url_provider.cc:46: // If the omnibox is
not empty, add a default match.
Again, this adds detail that just restates the code.  If you think the old
comment is lacking, focus on describing why it matters that the omnibox is
non-empty, instead of just restating the code.

https://codereview.chromium.org/2124563002/diff/40001/components/omnibox/brow...
components/omnibox/browser/clipboard_url_provider.cc:55: AutocompleteMatch
match(this, 800, false, AutocompleteMatchType::CLIPBOARD);
I don't think we should hardcode 800 here.  If there is a verbatim match, using
its relevance - 1, as before, seems correct.  If there isn't, will there ever be
ZeroSuggest results either?  If not, then something like max(1, verbatim
relevance - 1) would probably be correct.

https://codereview.chromium.org/2124563002/diff/40001/components/omnibox/brow...
File components/omnibox/browser/verbatim_match.cc (right):

https://codereview.chromium.org/2124563002/diff/40001/components/omnibox/brow...
components/omnibox/browser/verbatim_match.cc:21: DCHECK(!input.text().empty());
How hard would it be to just be robust against this case (i.e. not try to
classify an empty string)?

That seems like a better answer, if it's doable.

Powered by Google App Engine
This is Rietveld 408576698