Bug 1481319 - Include prefix when matching bookmark keywords. r=mak

Differential Revision: https://phabricator.services.mozilla.com/D2804

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Matt Brubeck 2018-08-07 17:47:46 +00:00
parent 168027fec9
commit bb9689b710
2 changed files with 9 additions and 2 deletions

View File

@ -1531,7 +1531,7 @@ Search.prototype = {
async _matchPlacesKeyword() {
// The first word could be a keyword, so that's what we'll search.
let keyword = this._searchTokens[0];
let keyword = this._strippedPrefix + this._searchTokens[0];
let entry = await PlacesUtils.keywords.fetch(keyword);
if (!entry)
return false;

View File

@ -19,7 +19,7 @@ add_task(async function test_keyword_searc() {
await PlacesTestUtils.addVisits([
{ uri: uri1, title: "Generic page title" },
{ uri: uri2, title: "Generic page title" },
{ uri: uri3, title: "This page shouldn't be suggested" },
{ uri: uri3, title: "This page uri contains the keyword" },
]);
await addBookmark({ uri: uri1, title: "Bookmark title", keyword: "key"});
@ -94,5 +94,12 @@ add_task(async function test_keyword_searc() {
matches: [ { uri: NetUtil.newURI("http://abc/?search=test"), title: "abc", style: ["keyword", "heuristic"] } ]
});
info("Bug 1481319 - Keyword with a prefix in front");
await check_autocomplete({
search: "http://key",
matches: [ { uri: uri3, title: "This page uri contains the keyword" } ],
completed: "http://key",
});
await cleanup();
});