Skip to content

Commit

Permalink
Bug 1481319 - Include prefix when matching bookmark keywords. r=mak
Browse files Browse the repository at this point in the history
Differential Revision: https://phabricator.services.mozilla.com/D2804

--HG--
extra : moz-landing-system : lando
  • Loading branch information
mbrubeck committed Aug 7, 2018
1 parent 168027f commit bb9689b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion toolkit/components/places/UnifiedComplete.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"});

Expand Down Expand Up @@ -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();
});

0 comments on commit bb9689b

Please sign in to comment.