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

Issue 8502027: Fix AutocompleteMatch DCHECK() triggered by |RenderViewContextMenu::AppendSearchProvider()|. (Closed)

Created:
9 years, 1 month ago by Alexei Svitkine (slow)
Modified:
9 years, 1 month ago
CC:
chromium-reviews, Avi (use Gerrit), ajwong+watch_chromium.org, creis+watch_chromium.org, brettw-cc_chromium.org
Visibility:
Public.

Description

Fix AutocompleteMatch DCHECK() triggered by |RenderViewContextMenu::AppendSearchProvider()|. Makes |AppendSearchProvider()| sanitize the text by replacing unwanted whitespace characters with spaces. Do this instead of calling |AutocompleteMatch::SanitizeString()|, since we want to preserve the whitespace between words separated by newlines here, rather than appending such words together. Added |ReplaceChars()| to base/string_util to support replacing any occurence of the given characters with a replacement string. BUG=103338 TEST=Right click on multiline text in a text area in a Debug build. A DCHECK() shouldn't trigger. Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=109430

Patch Set 1 : '' #

Total comments: 7

Patch Set 2 : '' #

Total comments: 2

Patch Set 3 : '' #

Unified diffs Side-by-side diffs Delta from patch set Stats (+94 lines, -21 lines) Patch
M base/string_util.h View 1 2 chunks +19 lines, -5 lines 0 comments Download
M base/string_util.cc View 1 chunk +23 lines, -8 lines 0 comments Download
M base/string_util_unittest.cc View 1 2 1 chunk +33 lines, -0 lines 0 comments Download
M chrome/browser/autocomplete/autocomplete_match.h View 2 chunks +5 lines, -1 line 0 comments Download
M chrome/browser/autocomplete/autocomplete_match.cc View 2 chunks +9 lines, -6 lines 0 comments Download
M chrome/browser/tab_contents/render_view_context_menu.cc View 3 chunks +5 lines, -1 line 0 comments Download

Messages

Total messages: 15 (0 generated)
Alexei Svitkine (slow)
Peter: Please review autocomplete_match and render_view_context_menu changes. Will: Please review base/string_util changes.
9 years, 1 month ago (2011-11-09 17:46:30 UTC) #1
willchan no longer on Chromium
Sending to mark since I think he's more familiar with string_util. I'm a bit surprised ...
9 years, 1 month ago (2011-11-09 19:52:57 UTC) #2
Mark Mentovai
This is a pretty specific-purpose function, but it’s probably OK to take in string_util if ...
9 years, 1 month ago (2011-11-09 20:31:31 UTC) #3
Alexei Svitkine (slow)
Thanks Mark! http://codereview.chromium.org/8502027/diff/7002/base/string_util.cc File base/string_util.cc (right): http://codereview.chromium.org/8502027/diff/7002/base/string_util.cc#newcode194 base/string_util.cc:194: bool ReplaceChars(const std::string& input, On 2011/11/09 20:31:32, ...
9 years, 1 month ago (2011-11-09 21:03:58 UTC) #4
Mark Mentovai
LGTM with this change. http://codereview.chromium.org/8502027/diff/2006/base/string_util_unittest.cc File base/string_util_unittest.cc (right): http://codereview.chromium.org/8502027/diff/2006/base/string_util_unittest.cc#newcode1097 base/string_util_unittest.cc:1097: DCHECK_EQ(cases[i].result, result); You don’t want ...
9 years, 1 month ago (2011-11-09 21:08:38 UTC) #5
Alexei Svitkine (slow)
http://codereview.chromium.org/8502027/diff/2006/base/string_util_unittest.cc File base/string_util_unittest.cc (right): http://codereview.chromium.org/8502027/diff/2006/base/string_util_unittest.cc#newcode1097 base/string_util_unittest.cc:1097: DCHECK_EQ(cases[i].result, result); On 2011/11/09 21:08:38, Mark Mentovai wrote: > ...
9 years, 1 month ago (2011-11-09 21:13:17 UTC) #6
Mark Mentovai
LGTM
9 years, 1 month ago (2011-11-09 21:15:42 UTC) #7
Peter Kasting
My parts LGTM. Passing question: Can we change all these string_util functions that take null-terminated ...
9 years, 1 month ago (2011-11-09 23:20:29 UTC) #8
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/asvitkine@chromium.org/8502027/11002
9 years, 1 month ago (2011-11-10 04:32:00 UTC) #9
Alexei Svitkine (slow)
> > Passing question: Can we change all these string_util functions that take > null-terminated ...
9 years, 1 month ago (2011-11-10 04:54:22 UTC) #10
commit-bot: I haz the power
Try job failure for 8502027-11002 (retry) (retry) on win_rel for step "chrome_frame_net_tests". It's a second ...
9 years, 1 month ago (2011-11-10 06:48:57 UTC) #11
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/asvitkine@chromium.org/8502027/11002
9 years, 1 month ago (2011-11-10 13:33:00 UTC) #12
commit-bot: I haz the power
Change committed as 109430
9 years, 1 month ago (2011-11-10 15:08:56 UTC) #13
Peter Kasting
On 2011/11/10 04:54:22, Alexei Svitkine wrote: > > > > Passing question: Can we change ...
9 years, 1 month ago (2011-11-15 00:55:05 UTC) #14
Alexei Svitkine (slow)
9 years, 1 month ago (2011-11-15 05:07:06 UTC) #15
On Mon, Nov 14, 2011 at 7:55 PM, <pkasting@chromium.org> wrote:

> On 2011/11/10 04:54:22, Alexei Svitkine wrote:
>
>> >
>> > Passing question: Can we change all these string_util functions that
>> take
>> > null-terminated arrays to instead take a const std::vector<char>&, const
>> > std::string& (with each character being one invalid character), or const
>> > char[]
>> > + size_t?  All three of these methods seem safer to me than the current
>> > method.
>> >
>>
>
>  I'd vote for array + size_t length, since the other suggestions would make
>> it difficult to use static constants for these without introducing evil
>> static initializers.
>>
>
> const std::string& would work fine for that too, as it would construct the
> string at the time of the call.
>

In that case, a src/base/string_piece.h would be a better choice to avoid
std::string needlessly allocing a buffer and copying chars for the
temporary.


> Were you planning to make this change, file a bug, or should I file?  I
> didn't
> want this to get lost.
>

I'll let you file the bug.

-Alexei

Powered by Google App Engine
This is Rietveld 408576698