mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-18 15:55:36 +00:00
Bug 1655363 - Autofill is wrongly fixing up origins in certain cases. r=adw
A poorly thought fixup SQL condition was stripping "www." from the origin in any case, but when the search string contained "www.". This ended up stripping too often, for example when typing "w" and matching against "www.mozilla.org". Instead, the query should strip "www." from the origin only if it doesn't start with the search string. Differential Revision: https://phabricator.services.mozilla.com/D85006
This commit is contained in:
parent
2567ac6108
commit
4326222700
@ -89,7 +89,7 @@ function originQuery(where) {
|
||||
OR (host BETWEEN 'www.' || :searchString AND 'www.' || :searchString || X'FFFF')
|
||||
)
|
||||
SELECT :query_type AS query_type,
|
||||
iif(instr(:searchString, "www."), host, fixed) || '/' AS host_fixed,
|
||||
iif(instr(host, :searchString) = 1, host, fixed) || '/' AS host_fixed,
|
||||
ifnull(:prefix, host_prefix) || host || '/' AS url
|
||||
FROM origins
|
||||
${where}
|
||||
|
@ -83,7 +83,7 @@ add_task(async function() {
|
||||
{ host }
|
||||
);
|
||||
});
|
||||
await PlacesUtils.bookmarks.insert({
|
||||
bookmark = await PlacesUtils.bookmarks.insert({
|
||||
url: `http://${host}`,
|
||||
parentGuid: PlacesUtils.bookmarks.unfiledGuid,
|
||||
});
|
||||
@ -91,6 +91,60 @@ add_task(async function() {
|
||||
await checkOriginsOrder(host, ["https://", "http://"]);
|
||||
|
||||
await check_autofill();
|
||||
await PlacesUtils.history.clear();
|
||||
await PlacesUtils.bookmarks.remove(bookmark);
|
||||
});
|
||||
|
||||
add_task(async function test_www() {
|
||||
// Add a bookmark to the www version
|
||||
let host = "example.com";
|
||||
await PlacesUtils.bookmarks.insert({
|
||||
url: `http://www.${host}`,
|
||||
parentGuid: PlacesUtils.bookmarks.unfiledGuid,
|
||||
});
|
||||
|
||||
info("search for start of www.");
|
||||
let context = createContext("w", { isPrivate: false });
|
||||
await check_results({
|
||||
context,
|
||||
autofilled: `www.${host}/`,
|
||||
completed: `http://www.${host}/`,
|
||||
matches: [
|
||||
makeVisitResult(context, {
|
||||
uri: `http://www.${host}/`,
|
||||
title: `www.${host}`,
|
||||
heuristic: true,
|
||||
}),
|
||||
],
|
||||
});
|
||||
info("search for full www.");
|
||||
context = createContext("www.", { isPrivate: false });
|
||||
await check_results({
|
||||
context,
|
||||
autofilled: `www.${host}/`,
|
||||
completed: `http://www.${host}/`,
|
||||
matches: [
|
||||
makeVisitResult(context, {
|
||||
uri: `http://www.${host}/`,
|
||||
title: `www.${host}`,
|
||||
heuristic: true,
|
||||
}),
|
||||
],
|
||||
});
|
||||
info("search for host without www.");
|
||||
context = createContext("ex", { isPrivate: false });
|
||||
await check_results({
|
||||
context,
|
||||
autofilled: `${host}/`,
|
||||
completed: `http://www.${host}/`,
|
||||
matches: [
|
||||
makeVisitResult(context, {
|
||||
uri: `http://www.${host}/`,
|
||||
title: `www.${host}`,
|
||||
heuristic: true,
|
||||
}),
|
||||
],
|
||||
});
|
||||
});
|
||||
|
||||
async function checkOriginsOrder(host, prefixOrder) {
|
||||
|
Loading…
Reference in New Issue
Block a user