Bug 1527724 - Let the preselected result not modify the urlbar value. r=Standard8

Differential Revision: https://phabricator.services.mozilla.com/D19762

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Dão Gottwald 2019-02-14 14:43:51 +00:00
Родитель 11e921c983
Коммит b6a41eda70
2 изменённых файлов: 6 добавлений и 2 удалений

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

@ -162,7 +162,7 @@ class UrlbarView {
if (queryContext.lastResultCount == 0) {
if (queryContext.preselected) {
this._selectItem(fragment.firstElementChild);
this._selectItem(fragment.firstElementChild, false);
} else {
// Clear the selection when we get a new set of results.
this._selectItem(null);
@ -172,7 +172,7 @@ class UrlbarView {
// TODO bug 1523602: the selection should stay on the node that had it, if
// it's still in the current result set.
let resultIndex = this._selected.getAttribute("resultIndex");
this._selectItem(fragment.children[resultIndex]);
this._selectItem(fragment.children[resultIndex], false);
}
// TODO bug 1523602: For now, clear the results for each set received.

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

@ -31,6 +31,10 @@ add_task(async function() {
await PlacesUtils.history.clear();
});
await promiseAutocompleteResultPopup("moz");
Assert.equal(gURLBar.textValue, "moz",
"Preselected search keyword result shouldn't automatically add a space");
await promiseAutocompleteResultPopup("moz open a search");
let result = await UrlbarTestUtils.getDetailsOfResultAt(window, 0);
if (UrlbarPrefs.get("quantumbar")) {