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

Unified Diff: chrome/browser/autocomplete/autocomplete.cc

Issue 8364001: Strip special characters in extension omnibox suggestions. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/autocomplete/autocomplete.cc
===================================================================
--- chrome/browser/autocomplete/autocomplete.cc (revision 107110)
+++ chrome/browser/autocomplete/autocomplete.cc (working copy)
@@ -652,6 +652,12 @@
}
void AutocompleteResult::AppendMatches(const ACMatches& matches) {
+#ifndef NDEBUG
+ for (size_t i = 0; i < matches.size(); i++) {
Peter Kasting 2011/10/25 20:37:07 Nit: This code tries to use iterators (begin() and
Alexei Svitkine (slow) 2011/10/25 21:37:16 Done.
+ DCHECK_EQ(AutocompleteMatch::SanitizeString(matches[i].contents),
Peter Kasting 2011/10/25 20:37:07 Nit: Here and below, we should also check the desc
Alexei Svitkine (slow) 2011/10/25 21:37:16 Done.
+ matches[i].contents);
+ }
+#endif
std::copy(matches.begin(), matches.end(), std::back_inserter(matches_));
default_match_ = end();
alternate_nav_url_ = GURL();
@@ -659,6 +665,8 @@
void AutocompleteResult::AddMatch(const AutocompleteMatch& match) {
DCHECK(default_match_ != end());
+ // Check that there are no invalid characters in |match.contents|.
Peter Kasting 2011/10/25 20:37:07 Nit: Remove this comment, it's redundant with the
Alexei Svitkine (slow) 2011/10/25 21:37:16 Done.
+ DCHECK_EQ(AutocompleteMatch::SanitizeString(match.contents), match.contents);
ACMatches::iterator insertion_point =
std::upper_bound(begin(), end(), match, &AutocompleteMatch::MoreRelevant);
ACMatches::iterator::difference_type default_offset =
« no previous file with comments | « no previous file | chrome/browser/autocomplete/autocomplete_match.h » ('j') | chrome/browser/autocomplete/autocomplete_match.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698