Bug 1572329 - Fix error that prevented the top history result from being deleted. r=mak

AFAICT this bug isn't reproducible anymore after bug 1623666. i.e., it's no
longer possible to show the history view. You can still see a history-like view
by typing ^ or a space, but in that case the first result is a search result,
not a history result, so it can't be deleted anyway. Nevertheless we should fix
this error.

Differential Revision: https://phabricator.services.mozilla.com/D79576
This commit is contained in:
Drew Willcoxon 2020-06-16 08:01:27 +00:00
Родитель f1d9bd0a46
Коммит 8c5c5746f8
1 изменённых файлов: 3 добавлений и 2 удалений

Просмотреть файл

@ -593,14 +593,15 @@ class UrlbarController {
const selectedResult = this.input.view.selectedResult;
if (
!selectedResult ||
selectedResult.source != UrlbarUtils.RESULT_SOURCE.HISTORY
selectedResult.source != UrlbarUtils.RESULT_SOURCE.HISTORY ||
selectedResult.heuristic
) {
return false;
}
let { queryContext } = this._lastQueryContextWrapper;
let index = queryContext.results.indexOf(selectedResult);
if (!index) {
if (index < 0) {
Cu.reportError("Failed to find the selected result in the results");
return false;
}