Bug 1535203 - Don't close and reopen the popup when an @alias offer is clicked. r=dao
authorDrew Willcoxon <adw@mozilla.com>
Thu, 14 Mar 2019 17:50:11 +0000
changeset 521921 b11e72c5c268
parent 521920 d3889d245691
child 521922 495029aae21b
push id10870
push usernbeleuzu@mozilla.com
push dateFri, 15 Mar 2019 20:00:07 +0000
treeherdermozilla-beta@c594aee5b7a4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdao
bugs1535203
milestone67.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1535203 - Don't close and reopen the popup when an @alias offer is clicked. r=dao Differential Revision: https://phabricator.services.mozilla.com/D23436
browser/components/urlbar/UrlbarInput.jsm
browser/components/urlbar/tests/browser/browser_urlbarTokenAlias.js
--- a/browser/components/urlbar/UrlbarInput.jsm
+++ b/browser/components/urlbar/UrlbarInput.jsm
@@ -366,17 +366,19 @@ class UrlbarInput {
   pickResult(event, resultIndex) {
     let result = this.view.getResult(resultIndex);
     let isCanonized = this.setValueFromResult(result, event);
     let where = this._whereToOpen(event);
     let openParams = {
       allowInheritPrincipal: false,
     };
 
-    this.view.close();
+    if (!result.payload.isKeywordOffer) {
+      this.view.close();
+    }
     this.controller.recordSelectedResult(event, resultIndex);
 
     if (isCanonized) {
       this._loadURL(this.value, where, openParams);
       return;
     }
 
     let {url, postData} = UrlbarUtils.getUrlFromResult(result);
--- a/browser/components/urlbar/tests/browser/browser_urlbarTokenAlias.js
+++ b/browser/components/urlbar/tests/browser/browser_urlbarTokenAlias.js
@@ -224,19 +224,17 @@ add_task(async function clickAndFillAlia
   for (let i = 0; !testEngineItem; i++) {
     let details = await UrlbarTestUtils.getDetailsOfResultAt(window, i);
     if (details.searchParams && details.searchParams.keyword == ALIAS) {
       testEngineItem = await waitForAutocompleteResultAt(i);
     }
   }
 
   // Click it.
-  await UrlbarTestUtils.promisePopupClose(window, () => {
-    EventUtils.synthesizeMouseAtCenter(testEngineItem, {});
-  });
+  EventUtils.synthesizeMouseAtCenter(testEngineItem, {});
 
   // A new search will start and its result should be the alias.
   await promiseSearchComplete();
   await waitForAutocompleteResultAt(0);
   await assertAlias(true);
 
   // The urlbar input value should be the alias followed by a space so that it's
   // ready for the user to start typing.
@@ -280,19 +278,17 @@ add_task(async function enterAndFillAlia
   if (!UrlbarPrefs.get("quantumbar")) {
     // With awesomebar, the first result ends up preselected, so one fewer key
     // down is needed to reach the engine.
     index--;
   }
 
   // Key down to it and press enter.
   EventUtils.synthesizeKey("KEY_ArrowDown", { repeat: index });
-  await UrlbarTestUtils.promisePopupClose(window, () => {
-    EventUtils.synthesizeKey("KEY_Enter");
-  });
+  EventUtils.synthesizeKey("KEY_Enter");
 
   // A new search will start and its result should be the alias.
   await promiseSearchComplete();
   await waitForAutocompleteResultAt(0);
   await assertAlias(true);
 
   // The urlbar input value should be the alias followed by a space so that it's
   // ready for the user to start typing.