Bug 1667639 - Make keyword at the start of the string take precedence over restrict symbols at the end of the string. r=mak

This patch modifies PlacesUtils to cache the keywords and adds functionality to
find a keyword. The Tokenizer calls PlacesUtils to know if the first word
is a keyword and if the first word is a keyword, then the rest of the search
string will be treated as text and Tokenizer won't filter any other restrict
symbols.

Differential Revision: https://phabricator.services.mozilla.com/D198208
This commit is contained in:
mcheang
2024-01-19 01:13:39 +00:00
parent 68a5caf0a8
commit 4ffcfc6cbc
8 changed files with 139 additions and 25 deletions

View File

@@ -1056,6 +1056,7 @@ add_task(async function test_onQueryCanceled() {
incognitoOverride: "spanning",
background() {
browser.urlbar.onBehaviorRequested.addListener(query => {
browser.test.sendMessage("onBehaviorRequested");
return "active";
}, "test");
browser.urlbar.onQueryCanceled.addListener(query => {
@@ -1079,6 +1080,9 @@ add_task(async function test_onQueryCanceled() {
let controller = UrlbarTestUtils.newMockController();
let startPromise = controller.startQuery(context);
// Ensure the query has started, before trying to cancel it, otherwise we
// won't get a `canceled` notification, as there's nothing to cancel.
await ext.awaitMessage("onBehaviorRequested");
controller.cancelQuery();
await startPromise;
@@ -1381,6 +1385,10 @@ add_task(async function test_privateBrowsing_allowed_onQueryCanceled() {
let controller = UrlbarTestUtils.newMockController();
let startPromise = controller.startQuery(context);
// Ensure the query has started, before trying to cancel it, otherwise we
// won't get a `canceled` notification, as there's nothing to cancel.
await ext.awaitMessage("onBehaviorRequested");
controller.cancelQuery();
await startPromise;