Bug 1524510 - Freeze quantum bar results when the user interacts with them. r=mak

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Dão Gottwald 2019-03-29 14:53:52 +00:00
Родитель 2f9999a07a
Коммит 346b38ebad
2 изменённых файлов: 7 добавлений и 3 удалений

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

@ -115,7 +115,8 @@ class UrlbarController {
* The reason the query was cancelled.
*/
cancelQuery(reason) {
if (!this._lastQueryContext) {
if (!this._lastQueryContext ||
this._lastQueryContext._cancelled) {
return;
}
@ -123,8 +124,8 @@ class UrlbarController {
TelemetryStopwatch.cancel(TELEMETRY_6_FIRST_RESULTS, this._lastQueryContext);
this.manager.cancelQuery(this._lastQueryContext);
this._lastQueryContext._cancelled = true;
this._notify("onQueryCancelled", this._lastQueryContext);
delete this._lastQueryContext;
if (reason == UrlbarUtils.CANCEL_REASON.BLUR &&
ExtensionSearchHandler.hasActiveInputSession()) {

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

@ -36,8 +36,8 @@ class UrlbarView {
this._mainContainer = this.panel.querySelector(".urlbarView-body-inner");
this._rows = this.panel.querySelector("#urlbarView-results");
this._rows.addEventListener("mouseup", this);
this._rows.addEventListener("mousedown", this);
this._rows.addEventListener("mouseup", this);
// For the horizontal fade-out effect, set the overflow attribute on result
// rows when they overflow.
@ -140,6 +140,9 @@ class UrlbarView {
throw new Error("UrlbarView: Cannot select an item if the view isn't open.");
}
// Freeze results as the user is interacting with them.
this.controller.cancelQuery();
let row = this._selected;
if (!row) {