Bug 1520668 - Make UnifiedComplete set the default index before adding search @alias autofill matches. r=mak
authorDrew Willcoxon <adw@mozilla.com>
Thu, 17 Jan 2019 13:24:51 +0000
changeset 514282 9875054a2a07c3d5f571446f24426d6b9d7d36e0
parent 514281 f4edf77f5ca0a72735303a478cd7a517f8f08e25
child 514283 bbc57e229df64bdf5b4fa2d86bf419686bacf496
push id1953
push userffxbld-merge
push dateMon, 11 Mar 2019 12:10:20 +0000
treeherdermozilla-release@9c35dcbaa899 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmak
bugs1520668
milestone66.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 1520668 - Make UnifiedComplete set the default index before adding search @alias autofill matches. r=mak Differential Revision: https://phabricator.services.mozilla.com/D16767
toolkit/components/places/UnifiedComplete.js
--- a/toolkit/components/places/UnifiedComplete.js
+++ b/toolkit/components/places/UnifiedComplete.js
@@ -1197,30 +1197,30 @@ Search.prototype = {
           // to others.  It needs to be an autofill match and its `value` must
           // be the string that will be autofilled so that the controller will
           // autofill it.  But it also must be a searchengine action so that the
           // front end will style it as a search engine result.  The front end
           // uses `finalCompleteValue` as the URL for autofill results, so set
           // that to the moz-action URL.
           let aliasPreservingUserCase = token + alias.substr(token.length);
           let value = aliasPreservingUserCase + " ";
+          this._result.setDefaultIndex(0);
           this._addMatch({
             value,
             finalCompleteValue: PlacesUtils.mozActionURI("searchengine", {
               engineName: engine.name,
               alias: aliasPreservingUserCase,
               input: value,
               searchQuery: "",
             }),
             comment: engine.name,
             frecency: FRECENCY_DEFAULT,
             style: "autofill action searchengine",
             icon: engine.iconURI ? engine.iconURI.spec : null,
           });
-          this._result.setDefaultIndex(0);
 
           // Set _searchEngineAliasMatch with an empty query so that we don't
           // attempt to add any more matches.  When a token alias is autofilled,
           // the only match should be the one we just added.
           this._searchEngineAliasMatch = {
             engine,
             alias: aliasPreservingUserCase,
             query: "",