From 086c044dc34dfc0f74fbe41f4ecb402b2cd34884 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Fri, 19 Apr 2024 03:13:33 +0200 Subject: Merging upstream version 125.0.1. Signed-off-by: Daniel Baumann --- .../urlbar/UrlbarProviderHeuristicFallback.sys.mjs | 23 +++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) (limited to 'browser/components/urlbar/UrlbarProviderHeuristicFallback.sys.mjs') 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, }) -- cgit v1.2.3