Bug 1211726 - fix nits, r?gijs
MozReview-Commit-ID: BRXelrBabHH
--- a/toolkit/components/places/UnifiedComplete.js
+++ b/toolkit/components/places/UnifiedComplete.js
@@ -765,17 +765,16 @@ function Search(searchString, searchPara
this._localMatchesStartIndex = 0;
// Counts the number of inserted local matches.
this._localMatchesCount = 0;
// Counts the number of inserted remote matches.
this._remoteMatchesCount = 0;
// Counts the number of inserted extension matches.
this._extensionMatchesCount = 0;
-
}
Search.prototype = {
/**
* Enables the desired AutoComplete behavior.
*
* @param type
* The behavior type to set.
@@ -945,21 +944,19 @@ Search.prototype = {
// to true so that when the result is added, "heuristic" can be included in
// its style.
this._addingHeuristicFirstMatch = true;
let hasHeuristic = yield this._matchFirstHeuristicResult(conn);
this._addingHeuristicFirstMatch = false;
if (!this.pending)
return;
- //--------------------------------------------------------------------
yield this._matchTop500()
if (!this.pending)
return;
- //--------------------------------------------------------------------
// We sleep a little between adding the heuristicFirstMatch and matching
// any other searches so we aren't kicking off potentially expensive
// searches on every keystroke.
// Though, if there's no heuristic result, we start searching immediately,
// since autocomplete may be waiting for us.
if (hasHeuristic) {
yield this._sleep(Prefs.delay);
@@ -1009,33 +1006,31 @@ Search.prototype = {
} else if (ExtensionSearchHandler.hasActiveInputSession()) {
ExtensionSearchHandler.handleInputCancelled();
}
// Ensure to fill any remaining space. Suggestions which come from extensions are
// inserted at the beginning, so any suggestions
yield Promise.all(this._remoteMatchesPromises);
}),
-
- //--------------------------------------------------------------------
+
*_matchTop500() {
for (let [url, title] of TOP500_SITES) {
if (url.toLowerCase().includes(this._searchString) ||
title.toLowerCase().includes(this._searchString)) {
let match = {
value: url,
comment: url + " - " + title, // More convenient look
style: "bookmark",
frecency: FRECENCY_DEFAULT + 1,
};
this._addMatch(match);
};
};
},
- //--------------------------------------------------------------------
*_matchFirstHeuristicResult(conn) {
// We always try to make the first result a special "heuristic" result. The
// heuristics below determine what type of result it will be, if any.
let hasSearchTerms = this._searchTokens.length > 0;
if (hasSearchTerms) {