summaryrefslogtreecommitdiffstats
path: root/browser/components/urlbar/UrlbarProviderHeuristicFallback.sys.mjs
diff options
context:
space:
mode:
Diffstat (limited to 'browser/components/urlbar/UrlbarProviderHeuristicFallback.sys.mjs')
-rw-r--r--browser/components/urlbar/UrlbarProviderHeuristicFallback.sys.mjs23
1 files changed, 12 insertions, 11 deletions
diff --git a/browser/components/urlbar/UrlbarProviderHeuristicFallback.sys.mjs b/browser/components/urlbar/UrlbarProviderHeuristicFallback.sys.mjs
index ee85fbffa8..052b121ab3 100644
--- a/browser/components/urlbar/UrlbarProviderHeuristicFallback.sys.mjs
+++ b/browser/components/urlbar/UrlbarProviderHeuristicFallback.sys.mjs
@@ -53,20 +53,18 @@ class ProviderHeuristicFallback extends UrlbarProvider {
* If this method returns false, the providers manager won't start a query
* with this provider, to save on resources.
*
- * @param {UrlbarQueryContext} queryContext The query context object
* @returns {boolean} Whether this provider should be invoked for the search.
*/
- isActive(queryContext) {
+ isActive() {
return true;
}
/**
* Gets the provider's priority.
*
- * @param {UrlbarQueryContext} queryContext The query context object
* @returns {number} The provider's priority for the given query.
*/
- getPriority(queryContext) {
+ getPriority() {
return 0;
}
@@ -99,7 +97,7 @@ class ProviderHeuristicFallback extends UrlbarProvider {
}) ||
lazy.UrlbarTokenizer.REGEXP_COMMON_EMAIL.test(str))
) {
- let searchResult = this._engineSearchResult(queryContext);
+ let searchResult = await this._engineSearchResult(queryContext);
if (instance != this.queryInstance) {
return;
}
@@ -109,13 +107,16 @@ class ProviderHeuristicFallback extends UrlbarProvider {
return;
}
- result = this._searchModeKeywordResult(queryContext);
+ result = await this._searchModeKeywordResult(queryContext);
+ if (instance != this.queryInstance) {
+ return;
+ }
if (result) {
addCallback(this, result);
return;
}
- result = this._engineSearchResult(queryContext);
+ result = await this._engineSearchResult(queryContext);
if (instance != this.queryInstance) {
return;
}
@@ -230,7 +231,7 @@ class ProviderHeuristicFallback extends UrlbarProvider {
return result;
}
- _searchModeKeywordResult(queryContext) {
+ async _searchModeKeywordResult(queryContext) {
if (!queryContext.tokens.length) {
return null;
}
@@ -268,7 +269,7 @@ class ProviderHeuristicFallback extends UrlbarProvider {
let result;
if (queryContext.restrictSource == UrlbarUtils.RESULT_SOURCE.SEARCH) {
- result = this._engineSearchResult(queryContext, firstToken);
+ result = await this._engineSearchResult(queryContext, firstToken);
} else {
result = new lazy.UrlbarResult(
UrlbarUtils.RESULT_TYPE.SEARCH,
@@ -283,7 +284,7 @@ class ProviderHeuristicFallback extends UrlbarProvider {
return result;
}
- _engineSearchResult(queryContext, keyword = null) {
+ async _engineSearchResult(queryContext, keyword = null) {
let engine;
if (queryContext.searchMode?.engineName) {
engine = lazy.UrlbarSearchUtils.getEngineByName(
@@ -317,7 +318,7 @@ class ProviderHeuristicFallback extends UrlbarProvider {
UrlbarUtils.RESULT_SOURCE.SEARCH,
...lazy.UrlbarResult.payloadAndSimpleHighlights(queryContext.tokens, {
engine: [engine.name, UrlbarUtils.HIGHLIGHT.TYPED],
- icon: engine.getIconURL(),
+ icon: await engine.getIconURL(),
query: [query, UrlbarUtils.HIGHLIGHT.NONE],
keyword: keyword ? [keyword, UrlbarUtils.HIGHLIGHT.NONE] : undefined,
})