Index: chrome/browser/autocomplete/history_quick_provider.cc |
diff --git a/chrome/browser/autocomplete/history_quick_provider.cc b/chrome/browser/autocomplete/history_quick_provider.cc |
index 64a3d27a13d1e1992d7946952f9b08a7badcd59e..d94b7db734f89c020846bff5103b8940fd2652bf 100644 |
--- a/chrome/browser/autocomplete/history_quick_provider.cc |
+++ b/chrome/browser/autocomplete/history_quick_provider.cc |
@@ -262,8 +262,18 @@ AutocompleteMatch HistoryQuickProvider::QuickMatchToACMatch( |
match.contents_class = |
SpansFromTermMatch(new_matches, match.contents.length(), true); |
- if (history_match.can_inline()) { |
- DCHECK(!new_matches.empty()); |
+ // Set |inline_autocompletion| and |allowed_to_be_default_match| if possible. |
+ // The second part of this test can happen if the only match(es) of the user's |
+ // term occur in places FormatUrl() decides to omit in the formatted url. |
+ // In these cases, it's impossible to set |inline_autocompletion| correctly |
+ // and hence the match cannot be the default match. I (mpearson@) believe |
+ // this is likely caused by the mismatch that offsets are originally |
+ // computed with respect to the cleaned-up URL yet then applied and |
+ // updated by FormatUrl() as if they applied to the original string. |
+ // See crbug.com/252630. |
+ // TODO(mpearson): replacing the second clause with a DCHECK after fixing |
+ // 252630. |
+ if (history_match.can_inline() && !new_matches.empty()) { |
size_t inline_autocomplete_offset = new_matches[0].offset + |
new_matches[0].length; |
// |inline_autocomplete_offset| may be beyond the end of the |