Skip to content

Commit c7199a8

Browse files
committed
Bug 1986128 - Let "Show search suggestions in address bar results" setting not affect the new search bar implementation. r=mak
Differential Revision: https://phabricator.services.mozilla.com/D263272
1 parent 24c1b8a commit c7199a8

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

browser/components/urlbar/UrlbarProviderSearchSuggestions.sys.mjs

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,10 @@ export class UrlbarProviderSearchSuggestions extends UrlbarProvider {
7575
* If this method returns false, the providers manager won't start a query
7676
* with this provider, to save on resources.
7777
*
78-
* @param {UrlbarQueryContext} queryContext The query context object
78+
* @param {UrlbarQueryContext} queryContext The query context object.
79+
* @param {UrlbarController} controller The current controller.
7980
*/
80-
async isActive(queryContext) {
81+
async isActive(queryContext, controller) {
8182
// If the sources don't include search or the user used a restriction
8283
// character other than search, don't allow any suggestions.
8384
if (
@@ -98,7 +99,7 @@ export class UrlbarProviderSearchSuggestions extends UrlbarProvider {
9899
return false;
99100
}
100101

101-
if (!this._allowSuggestions(queryContext)) {
102+
if (!this._allowSuggestions(queryContext, controller)) {
102103
return false;
103104
}
104105

@@ -138,15 +139,17 @@ export class UrlbarProviderSearchSuggestions extends UrlbarProvider {
138139
* context. If this returns false, then we shouldn't fetch either form
139140
* history or remote suggestions.
140141
*
141-
* @param {object} queryContext The query context object
142+
* @param {object} queryContext The query context object.
143+
* @param {UrlbarController} controller The current controller.
142144
* @returns {boolean} True if suggestions in general are allowed and false if
143145
* not.
144146
*/
145-
_allowSuggestions(queryContext) {
147+
_allowSuggestions(queryContext, controller) {
146148
if (
147149
// If the user typed a restriction token or token alias, we ignore the
148150
// pref to disable suggestions in the Urlbar.
149-
(!lazy.UrlbarPrefs.get("suggest.searches") &&
151+
(controller.input.isAddressbar &&
152+
!lazy.UrlbarPrefs.get("suggest.searches") &&
150153
!this._isTokenOrRestrictionPresent(queryContext)) ||
151154
!lazy.UrlbarPrefs.get("browser.search.suggest.enabled") ||
152155
(queryContext.isPrivate &&

0 commit comments

Comments
 (0)