зеркало из https://github.com/mozilla/gecko-dev.git
Backed out changeset 3c32d4e19a92 (bug 1582234) for ES Lint failrue on UnifiedComplete.jsm. CLOSED TREE
This commit is contained in:
Родитель
be72bce5f7
Коммит
f505e68560
|
@ -178,7 +178,7 @@ const SQL_AUTOFILL_FRECENCY_THRESHOLD = `(
|
|||
SELECT value FROM autofill_frecency_threshold
|
||||
)`;
|
||||
|
||||
function originQuery({ select = "", where = "", having = "" }) {
|
||||
function originQuery(conditions = "") {
|
||||
return `${SQL_AUTOFILL_WITH}
|
||||
SELECT :query_type,
|
||||
fixed_up_host || '/',
|
||||
|
@ -195,13 +195,12 @@ function originQuery({ select = "", where = "", having = "" }) {
|
|||
FROM moz_places
|
||||
WHERE moz_places.origin_id = moz_origins.id
|
||||
) AS bookmarked
|
||||
${select}
|
||||
FROM moz_origins
|
||||
WHERE host BETWEEN :searchString AND :searchString || X'FFFF'
|
||||
${where}
|
||||
${conditions}
|
||||
GROUP BY host
|
||||
HAVING host_frecency >= ${SQL_AUTOFILL_FRECENCY_THRESHOLD}
|
||||
${having}
|
||||
OR bookmarked
|
||||
UNION ALL
|
||||
SELECT host,
|
||||
fixup_url(host) AS fixed_up_host,
|
||||
|
@ -211,62 +210,44 @@ function originQuery({ select = "", where = "", having = "" }) {
|
|||
FROM moz_places
|
||||
WHERE moz_places.origin_id = moz_origins.id
|
||||
) AS bookmarked
|
||||
${select}
|
||||
FROM moz_origins
|
||||
WHERE host BETWEEN 'www.' || :searchString AND 'www.' || :searchString || X'FFFF'
|
||||
${where}
|
||||
${conditions}
|
||||
GROUP BY host
|
||||
HAVING host_frecency >= ${SQL_AUTOFILL_FRECENCY_THRESHOLD}
|
||||
${having}
|
||||
OR bookmarked
|
||||
) AS grouped_hosts
|
||||
JOIN moz_origins ON moz_origins.host = grouped_hosts.host
|
||||
ORDER BY frecency DESC, id DESC
|
||||
LIMIT 1 `;
|
||||
}
|
||||
|
||||
const QUERY_ORIGIN_HISTORY_BOOKMARK = originQuery({
|
||||
having: `OR bookmarked`,
|
||||
});
|
||||
const SQL_ORIGIN_QUERY = originQuery();
|
||||
|
||||
const QUERY_ORIGIN_PREFIX_HISTORY_BOOKMARK = originQuery({
|
||||
where: `AND prefix BETWEEN :prefix AND :prefix || X'FFFF'`,
|
||||
having: `OR bookmarked`,
|
||||
});
|
||||
const SQL_ORIGIN_PREFIX_QUERY = originQuery(
|
||||
`AND prefix BETWEEN :prefix AND :prefix || X'FFFF'`
|
||||
);
|
||||
|
||||
const QUERY_ORIGIN_HISTORY = originQuery({
|
||||
select: `, (
|
||||
SELECT TOTAL(visit_count) > 0
|
||||
FROM moz_places
|
||||
WHERE moz_places.origin_id = moz_origins.id
|
||||
) AS visited`,
|
||||
having: `AND (visited OR NOT bookmarked)`,
|
||||
});
|
||||
const SQL_ORIGIN_NOT_BOOKMARKED_QUERY = originQuery(`AND NOT bookmarked`);
|
||||
|
||||
const QUERY_ORIGIN_PREFIX_HISTORY = originQuery({
|
||||
select: `, (
|
||||
SELECT TOTAL(visit_count) > 0
|
||||
FROM moz_places
|
||||
WHERE moz_places.origin_id = moz_origins.id
|
||||
) AS visited`,
|
||||
where: `AND prefix BETWEEN :prefix AND :prefix || X'FFFF'`,
|
||||
having: `AND (visited OR NOT bookmarked)`,
|
||||
});
|
||||
const SQL_ORIGIN_PREFIX_NOT_BOOKMARKED_QUERY = originQuery(
|
||||
`AND NOT bookmarked
|
||||
AND prefix BETWEEN :prefix AND :prefix || X'FFFF'`
|
||||
);
|
||||
|
||||
const QUERY_ORIGIN_BOOKMARK = originQuery({
|
||||
having: `AND bookmarked`,
|
||||
});
|
||||
const SQL_ORIGIN_BOOKMARKED_QUERY = originQuery(`AND bookmarked`);
|
||||
|
||||
const QUERY_ORIGIN_PREFIX_BOOKMARK = originQuery({
|
||||
where: `AND prefix BETWEEN :prefix AND :prefix || X'FFFF'`,
|
||||
having: `AND bookmarked`,
|
||||
});
|
||||
const SQL_ORIGIN_PREFIX_BOOKMARKED_QUERY = originQuery(
|
||||
`AND bookmarked
|
||||
AND prefix BETWEEN :prefix AND :prefix || X'FFFF'`
|
||||
);
|
||||
|
||||
// Result row indexes for urlQuery()
|
||||
const QUERYINDEX_URL_URL = 1;
|
||||
const QUERYINDEX_URL_STRIPPED_URL = 2;
|
||||
const QUERYINDEX_URL_FRECENCY = 3;
|
||||
|
||||
function urlQuery(where1, where2) {
|
||||
function urlQuery(conditions1, conditions2) {
|
||||
// We limit the search to places that are either bookmarked or have a frecency
|
||||
// over some small, arbitrary threshold (20) in order to avoid scanning as few
|
||||
// rows as possible. Keep in mind that we run this query every time the user
|
||||
|
@ -277,66 +258,58 @@ function urlQuery(where1, where2) {
|
|||
:strippedURL,
|
||||
frecency,
|
||||
foreign_count > 0 AS bookmarked,
|
||||
visit_count > 0 AS visited,
|
||||
id
|
||||
FROM moz_places
|
||||
WHERE rev_host = :revHost
|
||||
${where1}
|
||||
AND (bookmarked OR frecency > 20)
|
||||
${conditions1}
|
||||
UNION ALL
|
||||
SELECT :query_type,
|
||||
url,
|
||||
:strippedURL,
|
||||
frecency,
|
||||
foreign_count > 0 AS bookmarked,
|
||||
visit_count > 0 AS visited,
|
||||
id
|
||||
FROM moz_places
|
||||
WHERE rev_host = :revHost || 'www.'
|
||||
${where2}
|
||||
AND (bookmarked OR frecency > 20)
|
||||
${conditions2}
|
||||
ORDER BY frecency DESC, id DESC
|
||||
LIMIT 1 `;
|
||||
}
|
||||
|
||||
const QUERY_URL_HISTORY_BOOKMARK = urlQuery(
|
||||
`AND (bookmarked OR frecency > 20)
|
||||
const SQL_URL_QUERY = urlQuery(
|
||||
`AND strip_prefix_and_userinfo(url) BETWEEN :strippedURL AND :strippedURL || X'FFFF'`,
|
||||
`AND strip_prefix_and_userinfo(url) BETWEEN 'www.' || :strippedURL AND 'www.' || :strippedURL || X'FFFF'`
|
||||
);
|
||||
|
||||
const SQL_URL_PREFIX_QUERY = urlQuery(
|
||||
`AND url BETWEEN :prefix || :strippedURL AND :prefix || :strippedURL || X'FFFF'`,
|
||||
`AND url BETWEEN :prefix || 'www.' || :strippedURL AND :prefix || 'www.' || :strippedURL || X'FFFF'`
|
||||
);
|
||||
|
||||
const SQL_URL_NOT_BOOKMARKED_QUERY = urlQuery(
|
||||
`AND NOT bookmarked
|
||||
AND strip_prefix_and_userinfo(url) BETWEEN :strippedURL AND :strippedURL || X'FFFF'`,
|
||||
`AND (bookmarked OR frecency > 20)
|
||||
`AND NOT bookmarked
|
||||
AND strip_prefix_and_userinfo(url) BETWEEN 'www.' || :strippedURL AND 'www.' || :strippedURL || X'FFFF'`
|
||||
);
|
||||
|
||||
const QUERY_URL_PREFIX_HISTORY_BOOKMARK = urlQuery(
|
||||
`AND (bookmarked OR frecency > 20)
|
||||
const SQL_URL_PREFIX_NOT_BOOKMARKED_QUERY = urlQuery(
|
||||
`AND NOT bookmarked
|
||||
AND url BETWEEN :prefix || :strippedURL AND :prefix || :strippedURL || X'FFFF'`,
|
||||
`AND (bookmarked OR frecency > 20)
|
||||
`AND NOT bookmarked
|
||||
AND url BETWEEN :prefix || 'www.' || :strippedURL AND :prefix || 'www.' || :strippedURL || X'FFFF'`
|
||||
);
|
||||
|
||||
const QUERY_URL_HISTORY = urlQuery(
|
||||
`AND (visited OR NOT bookmarked)
|
||||
AND frecency > 20
|
||||
AND strip_prefix_and_userinfo(url) BETWEEN :strippedURL AND :strippedURL || X'FFFF'`,
|
||||
`AND (visited OR NOT bookmarked)
|
||||
AND frecency > 20
|
||||
AND strip_prefix_and_userinfo(url) BETWEEN 'www.' || :strippedURL AND 'www.' || :strippedURL || X'FFFF'`
|
||||
);
|
||||
|
||||
const QUERY_URL_PREFIX_HISTORY = urlQuery(
|
||||
`AND (visited OR NOT bookmarked)
|
||||
AND frecency > 20
|
||||
AND url BETWEEN :prefix || :strippedURL AND :prefix || :strippedURL || X'FFFF'`,
|
||||
`AND (visited OR NOT bookmarked)
|
||||
AND frecency > 20
|
||||
AND url BETWEEN :prefix || 'www.' || :strippedURL AND :prefix || 'www.' || :strippedURL || X'FFFF'`
|
||||
);
|
||||
|
||||
const QUERY_URL_BOOKMARK = urlQuery(
|
||||
const SQL_URL_BOOKMARKED_QUERY = urlQuery(
|
||||
`AND bookmarked
|
||||
AND strip_prefix_and_userinfo(url) BETWEEN :strippedURL AND :strippedURL || X'FFFF'`,
|
||||
`AND bookmarked
|
||||
AND strip_prefix_and_userinfo(url) BETWEEN 'www.' || :strippedURL AND 'www.' || :strippedURL || X'FFFF'`
|
||||
);
|
||||
|
||||
const QUERY_URL_PREFIX_BOOKMARK = urlQuery(
|
||||
const SQL_URL_PREFIX_BOOKMARKED_QUERY = urlQuery(
|
||||
`AND bookmarked
|
||||
AND url BETWEEN :prefix || :strippedURL AND :prefix || :strippedURL || X'FFFF'`,
|
||||
`AND bookmarked
|
||||
|
@ -2650,25 +2623,23 @@ Search.prototype = {
|
|||
|
||||
if (this.hasBehavior("history") && this.hasBehavior("bookmark")) {
|
||||
return [
|
||||
this._strippedPrefix
|
||||
? QUERY_ORIGIN_PREFIX_HISTORY_BOOKMARK
|
||||
: QUERY_ORIGIN_HISTORY_BOOKMARK,
|
||||
this._strippedPrefix ? SQL_ORIGIN_PREFIX_QUERY : SQL_ORIGIN_QUERY,
|
||||
opts,
|
||||
];
|
||||
}
|
||||
if (this.hasBehavior("history")) {
|
||||
return [
|
||||
this._strippedPrefix
|
||||
? QUERY_ORIGIN_PREFIX_HISTORY
|
||||
: QUERY_ORIGIN_HISTORY,
|
||||
? SQL_ORIGIN_PREFIX_NOT_BOOKMARKED_QUERY
|
||||
: SQL_ORIGIN_NOT_BOOKMARKED_QUERY,
|
||||
opts,
|
||||
];
|
||||
}
|
||||
if (this.hasBehavior("bookmark")) {
|
||||
return [
|
||||
this._strippedPrefix
|
||||
? QUERY_ORIGIN_PREFIX_BOOKMARK
|
||||
: QUERY_ORIGIN_BOOKMARK,
|
||||
? SQL_ORIGIN_PREFIX_BOOKMARKED_QUERY
|
||||
: SQL_ORIGIN_BOOKMARKED_QUERY,
|
||||
opts,
|
||||
];
|
||||
}
|
||||
|
@ -2722,25 +2693,23 @@ Search.prototype = {
|
|||
|
||||
if (this.hasBehavior("history") && this.hasBehavior("bookmark")) {
|
||||
return [
|
||||
this._strippedPrefix
|
||||
? QUERY_URL_PREFIX_HISTORY_BOOKMARK
|
||||
: QUERY_URL_HISTORY_BOOKMARK,
|
||||
this._strippedPrefix ? SQL_URL_PREFIX_QUERY : SQL_URL_QUERY,
|
||||
opts,
|
||||
];
|
||||
}
|
||||
if (this.hasBehavior("history")) {
|
||||
return [
|
||||
this._strippedPrefix
|
||||
? QUERY_URL_PREFIX_HISTORY
|
||||
: QUERY_URL_HISTORY,
|
||||
? SQL_URL_PREFIX_NOT_BOOKMARKED_QUERY
|
||||
: SQL_URL_NOT_BOOKMARKED_QUERY,
|
||||
opts,
|
||||
];
|
||||
}
|
||||
if (this.hasBehavior("bookmark")) {
|
||||
return [
|
||||
this._strippedPrefix
|
||||
? QUERY_URL_PREFIX_BOOKMARK
|
||||
: QUERY_URL_BOOKMARK,
|
||||
? SQL_URL_PREFIX_BOOKMARKED_QUERY
|
||||
: SQL_URL_BOOKMARKED_QUERY,
|
||||
opts,
|
||||
];
|
||||
}
|
||||
|
|
|
@ -1245,14 +1245,14 @@ function addAutofillTasks(origins) {
|
|||
// Config:
|
||||
// suggest.history = true
|
||||
// suggest.bookmark = false
|
||||
// search for: unvisited bookmark
|
||||
// search for: bookmark
|
||||
// prefix search: no
|
||||
// prefix matches search: n/a
|
||||
// origin matches search: yes
|
||||
//
|
||||
// Expected result:
|
||||
// should autofill: no
|
||||
add_task(async function suggestBookmarkFalse_unvisitedBookmark() {
|
||||
add_task(async function suggestBookmarkFalse_bookmark() {
|
||||
await addBookmark({
|
||||
uri: "http://" + url,
|
||||
});
|
||||
|
@ -1281,14 +1281,14 @@ function addAutofillTasks(origins) {
|
|||
// Config:
|
||||
// suggest.history = true
|
||||
// suggest.bookmark = false
|
||||
// search for: unvisited bookmark
|
||||
// search for: bookmark
|
||||
// prefix search: yes
|
||||
// prefix matches search: yes
|
||||
// origin matches search: yes
|
||||
//
|
||||
// Expected result:
|
||||
// should autofill: no
|
||||
add_task(async function suggestBookmarkFalse_unvisitedBookmark_prefix_0() {
|
||||
add_task(async function suggestBookmarkFalse_bookmark_prefix() {
|
||||
await addBookmark({
|
||||
uri: "http://" + url,
|
||||
});
|
||||
|
@ -1311,544 +1311,6 @@ function addAutofillTasks(origins) {
|
|||
});
|
||||
await cleanup();
|
||||
});
|
||||
|
||||
// Tests interaction between the suggest.history and suggest.bookmark prefs.
|
||||
//
|
||||
// Config:
|
||||
// suggest.history = true
|
||||
// suggest.bookmark = false
|
||||
// search for: unvisited bookmark
|
||||
// prefix search: yes
|
||||
// prefix matches search: no
|
||||
// origin matches search: yes
|
||||
//
|
||||
// Expected result:
|
||||
// should autofill: no
|
||||
add_task(async function suggestBookmarkFalse_unvisitedBookmark_prefix_1() {
|
||||
await addBookmark({
|
||||
uri: "ftp://" + url,
|
||||
});
|
||||
Services.prefs.setBoolPref("browser.urlbar.suggest.bookmark", false);
|
||||
await check_autocomplete({
|
||||
search: "http://" + search,
|
||||
matches: [],
|
||||
});
|
||||
await cleanup();
|
||||
});
|
||||
|
||||
// Tests interaction between the suggest.history and suggest.bookmark prefs.
|
||||
//
|
||||
// Config:
|
||||
// suggest.history = true
|
||||
// suggest.bookmark = false
|
||||
// search for: unvisited bookmark
|
||||
// prefix search: yes
|
||||
// prefix matches search: yes
|
||||
// origin matches search: no
|
||||
//
|
||||
// Expected result:
|
||||
// should autofill: no
|
||||
add_task(async function suggestBookmarkFalse_unvisitedBookmark_prefix_2() {
|
||||
await addBookmark({
|
||||
uri: "http://non-matching-" + url,
|
||||
});
|
||||
Services.prefs.setBoolPref("browser.urlbar.suggest.bookmark", false);
|
||||
await check_autocomplete({
|
||||
search: "http://" + search,
|
||||
matches: [],
|
||||
});
|
||||
await cleanup();
|
||||
});
|
||||
|
||||
// Tests interaction between the suggest.history and suggest.bookmark prefs.
|
||||
//
|
||||
// Config:
|
||||
// suggest.history = true
|
||||
// suggest.bookmark = false
|
||||
// search for: unvisited bookmark
|
||||
// prefix search: yes
|
||||
// prefix matches search: no
|
||||
// origin matches search: no
|
||||
//
|
||||
// Expected result:
|
||||
// should autofill: no
|
||||
add_task(async function suggestBookmarkFalse_unvisitedBookmark_prefix_3() {
|
||||
await addBookmark({
|
||||
uri: "ftp://non-matching-" + url,
|
||||
});
|
||||
Services.prefs.setBoolPref("browser.urlbar.suggest.bookmark", false);
|
||||
await check_autocomplete({
|
||||
search: "http://" + search,
|
||||
matches: [],
|
||||
});
|
||||
await cleanup();
|
||||
});
|
||||
|
||||
// Tests interaction between the suggest.history and suggest.bookmark prefs.
|
||||
//
|
||||
// Config:
|
||||
// suggest.history = true
|
||||
// suggest.bookmark = false
|
||||
// search for: visited bookmark above autofill threshold
|
||||
// prefix search: no
|
||||
// prefix matches search: n/a
|
||||
// origin matches search: yes
|
||||
//
|
||||
// Expected result:
|
||||
// should autofill: yes
|
||||
add_task(async function suggestBookmarkFalse_visitedBookmark_above() {
|
||||
await PlacesTestUtils.addVisits("http://" + url);
|
||||
await addBookmark({
|
||||
uri: "http://" + url,
|
||||
});
|
||||
Services.prefs.setBoolPref("browser.urlbar.suggest.bookmark", false);
|
||||
await check_autocomplete({
|
||||
search,
|
||||
autofilled: url,
|
||||
completed: "http://" + url,
|
||||
matches: [
|
||||
{
|
||||
value: url,
|
||||
comment,
|
||||
style: ["autofill", "heuristic"],
|
||||
},
|
||||
],
|
||||
});
|
||||
await cleanup();
|
||||
});
|
||||
|
||||
// Tests interaction between the suggest.history and suggest.bookmark prefs.
|
||||
//
|
||||
// Config:
|
||||
// suggest.history = true
|
||||
// suggest.bookmark = false
|
||||
// search for: visited bookmark above autofill threshold
|
||||
// prefix search: yes
|
||||
// prefix matches search: yes
|
||||
// origin matches search: yes
|
||||
//
|
||||
// Expected result:
|
||||
// should autofill: yes
|
||||
add_task(async function suggestBookmarkFalse_visitedBookmarkAbove_prefix_0() {
|
||||
await PlacesTestUtils.addVisits("http://" + url);
|
||||
await addBookmark({
|
||||
uri: "http://" + url,
|
||||
});
|
||||
Services.prefs.setBoolPref("browser.urlbar.suggest.bookmark", false);
|
||||
await check_autocomplete({
|
||||
search: "http://" + search,
|
||||
autofilled: "http://" + url,
|
||||
completed: "http://" + url,
|
||||
matches: [
|
||||
{
|
||||
value: "http://" + url,
|
||||
comment,
|
||||
style: ["autofill", "heuristic"],
|
||||
},
|
||||
],
|
||||
});
|
||||
await cleanup();
|
||||
});
|
||||
|
||||
// Tests interaction between the suggest.history and suggest.bookmark prefs.
|
||||
//
|
||||
// Config:
|
||||
// suggest.history = true
|
||||
// suggest.bookmark = false
|
||||
// search for: visited bookmark above autofill threshold
|
||||
// prefix search: yes
|
||||
// prefix matches search: no
|
||||
// origin matches search: yes
|
||||
//
|
||||
// Expected result:
|
||||
// should autofill: no
|
||||
add_task(async function suggestBookmarkFalse_visitedBookmarkAbove_prefix_1() {
|
||||
await PlacesTestUtils.addVisits("ftp://" + url);
|
||||
await addBookmark({
|
||||
uri: "ftp://" + url,
|
||||
});
|
||||
Services.prefs.setBoolPref("browser.urlbar.suggest.bookmark", false);
|
||||
await check_autocomplete({
|
||||
search: "http://" + search,
|
||||
matches: [
|
||||
{
|
||||
value: "ftp://" + url,
|
||||
comment: "A bookmark",
|
||||
style: ["favicon"],
|
||||
},
|
||||
],
|
||||
});
|
||||
await cleanup();
|
||||
});
|
||||
|
||||
// Tests interaction between the suggest.history and suggest.bookmark prefs.
|
||||
//
|
||||
// Config:
|
||||
// suggest.history = true
|
||||
// suggest.bookmark = false
|
||||
// search for: visited bookmark above autofill threshold
|
||||
// prefix search: yes
|
||||
// prefix matches search: yes
|
||||
// origin matches search: no
|
||||
//
|
||||
// Expected result:
|
||||
// should autofill: no
|
||||
add_task(async function suggestBookmarkFalse_visitedBookmarkAbove_prefix_2() {
|
||||
await PlacesTestUtils.addVisits("http://non-matching-" + url);
|
||||
await addBookmark({
|
||||
uri: "http://non-matching-" + url,
|
||||
});
|
||||
Services.prefs.setBoolPref("browser.urlbar.suggest.bookmark", false);
|
||||
await check_autocomplete({
|
||||
search: "http://" + search,
|
||||
matches: [
|
||||
{
|
||||
value: "http://non-matching-" + url,
|
||||
comment: "A bookmark",
|
||||
style: ["favicon"],
|
||||
},
|
||||
],
|
||||
});
|
||||
await cleanup();
|
||||
});
|
||||
|
||||
// Tests interaction between the suggest.history and suggest.bookmark prefs.
|
||||
//
|
||||
// Config:
|
||||
// suggest.history = true
|
||||
// suggest.bookmark = false
|
||||
// search for: visited bookmark above autofill threshold
|
||||
// prefix search: yes
|
||||
// prefix matches search: no
|
||||
// origin matches search: no
|
||||
//
|
||||
// Expected result:
|
||||
// should autofill: no
|
||||
add_task(async function suggestBookmarkFalse_visitedBookmarkAbove_prefix_3() {
|
||||
await PlacesTestUtils.addVisits("ftp://non-matching-" + url);
|
||||
await addBookmark({
|
||||
uri: "ftp://non-matching-" + url,
|
||||
});
|
||||
Services.prefs.setBoolPref("browser.urlbar.suggest.bookmark", false);
|
||||
await check_autocomplete({
|
||||
search: "http://" + search,
|
||||
matches: [
|
||||
{
|
||||
value: "ftp://non-matching-" + url,
|
||||
comment: "A bookmark",
|
||||
style: ["favicon"],
|
||||
},
|
||||
],
|
||||
});
|
||||
await cleanup();
|
||||
});
|
||||
|
||||
// The following suggestBookmarkFalse_visitedBookmarkBelow* tests are similar
|
||||
// to the suggestBookmarkFalse_visitedBookmarkAbove* tests, but instead of
|
||||
// checking visited bookmarks above the autofill threshold, they check visited
|
||||
// bookmarks below the threshold. These tests don't make sense for URL
|
||||
// queries (as opposed to origin queries) because URL queries don't use the
|
||||
// same autofill threshold, so we skip them when !origins.
|
||||
|
||||
// Tests interaction between the suggest.history and suggest.bookmark prefs.
|
||||
//
|
||||
// Config:
|
||||
// suggest.history = true
|
||||
// suggest.bookmark = false
|
||||
// search for: visited bookmark below autofill threshold
|
||||
// prefix search: no
|
||||
// prefix matches search: n/a
|
||||
// origin matches search: yes
|
||||
//
|
||||
// Expected result:
|
||||
// should autofill: no
|
||||
add_task(async function suggestBookmarkFalse_visitedBookmarkBelow() {
|
||||
if (!origins) {
|
||||
// See comment above suggestBookmarkFalse_visitedBookmarkBelow.
|
||||
return;
|
||||
}
|
||||
// First, make sure that `url` is below the autofill threshold.
|
||||
await PlacesTestUtils.addVisits("http://" + url);
|
||||
for (let i = 0; i < 3; i++) {
|
||||
await PlacesTestUtils.addVisits("http://some-other-" + url);
|
||||
}
|
||||
await check_autocomplete({
|
||||
search,
|
||||
matches: [
|
||||
{
|
||||
value: "http://some-other-" + url,
|
||||
comment: "test visit for http://some-other-" + url,
|
||||
style: ["favicon"],
|
||||
},
|
||||
{
|
||||
value: "http://" + url,
|
||||
comment: "test visit for http://" + url,
|
||||
style: ["favicon"],
|
||||
},
|
||||
],
|
||||
});
|
||||
// Now bookmark it and set suggest.bookmark to false.
|
||||
await addBookmark({
|
||||
uri: "http://" + url,
|
||||
});
|
||||
Services.prefs.setBoolPref("browser.urlbar.suggest.bookmark", false);
|
||||
await check_autocomplete({
|
||||
search,
|
||||
matches: [
|
||||
{
|
||||
value: "http://some-other-" + url,
|
||||
comment: "test visit for http://some-other-" + url,
|
||||
style: ["favicon"],
|
||||
},
|
||||
{
|
||||
value: "http://" + url,
|
||||
comment: "A bookmark",
|
||||
style: ["favicon"],
|
||||
},
|
||||
],
|
||||
});
|
||||
await cleanup();
|
||||
});
|
||||
|
||||
// Tests interaction between the suggest.history and suggest.bookmark prefs.
|
||||
//
|
||||
// Config:
|
||||
// suggest.history = true
|
||||
// suggest.bookmark = false
|
||||
// search for: visited bookmark below autofill threshold
|
||||
// prefix search: yes
|
||||
// prefix matches search: yes
|
||||
// origin matches search: yes
|
||||
//
|
||||
// Expected result:
|
||||
// should autofill: no
|
||||
add_task(async function suggestBookmarkFalse_visitedBookmarkBelow_prefix_0() {
|
||||
if (!origins) {
|
||||
// See comment above suggestBookmarkFalse_visitedBookmarkBelow.
|
||||
return;
|
||||
}
|
||||
// First, make sure that `url` is below the autofill threshold.
|
||||
await PlacesTestUtils.addVisits("http://" + url);
|
||||
for (let i = 0; i < 3; i++) {
|
||||
await PlacesTestUtils.addVisits("http://some-other-" + url);
|
||||
}
|
||||
await check_autocomplete({
|
||||
search: "http://" + search,
|
||||
matches: [
|
||||
{
|
||||
value: "http://some-other-" + url,
|
||||
comment: "test visit for http://some-other-" + url,
|
||||
style: ["favicon"],
|
||||
},
|
||||
{
|
||||
value: "http://" + url,
|
||||
comment: "test visit for http://" + url,
|
||||
style: ["favicon"],
|
||||
},
|
||||
],
|
||||
});
|
||||
// Now bookmark it and set suggest.bookmark to false.
|
||||
await addBookmark({
|
||||
uri: "http://" + url,
|
||||
});
|
||||
Services.prefs.setBoolPref("browser.urlbar.suggest.bookmark", false);
|
||||
await check_autocomplete({
|
||||
search: "http://" + search,
|
||||
matches: [
|
||||
{
|
||||
value: "http://some-other-" + url,
|
||||
comment: "test visit for http://some-other-" + url,
|
||||
style: ["favicon"],
|
||||
},
|
||||
{
|
||||
value: "http://" + url,
|
||||
comment: "A bookmark",
|
||||
style: ["favicon"],
|
||||
},
|
||||
],
|
||||
});
|
||||
await cleanup();
|
||||
});
|
||||
|
||||
// Tests interaction between the suggest.history and suggest.bookmark prefs.
|
||||
//
|
||||
// Config:
|
||||
// suggest.history = true
|
||||
// suggest.bookmark = false
|
||||
// search for: visited bookmark below autofill threshold
|
||||
// prefix search: yes
|
||||
// prefix matches search: no
|
||||
// origin matches search: yes
|
||||
//
|
||||
// Expected result:
|
||||
// should autofill: no
|
||||
add_task(async function suggestBookmarkFalse_visitedBookmarkBelow_prefix_1() {
|
||||
if (!origins) {
|
||||
// See comment above suggestBookmarkFalse_visitedBookmarkBelow.
|
||||
return;
|
||||
}
|
||||
// First, make sure that `url` is below the autofill threshold.
|
||||
await PlacesTestUtils.addVisits("ftp://" + url);
|
||||
for (let i = 0; i < 3; i++) {
|
||||
await PlacesTestUtils.addVisits("ftp://some-other-" + url);
|
||||
}
|
||||
await check_autocomplete({
|
||||
search: "http://" + search,
|
||||
matches: [
|
||||
{
|
||||
value: "ftp://some-other-" + url,
|
||||
comment: "test visit for ftp://some-other-" + url,
|
||||
style: ["favicon"],
|
||||
},
|
||||
{
|
||||
value: "ftp://" + url,
|
||||
comment: "test visit for ftp://" + url,
|
||||
style: ["favicon"],
|
||||
},
|
||||
],
|
||||
});
|
||||
// Now bookmark it and set suggest.bookmark to false.
|
||||
await addBookmark({
|
||||
uri: "ftp://" + url,
|
||||
});
|
||||
Services.prefs.setBoolPref("browser.urlbar.suggest.bookmark", false);
|
||||
await check_autocomplete({
|
||||
search: "http://" + search,
|
||||
matches: [
|
||||
{
|
||||
value: "ftp://some-other-" + url,
|
||||
comment: "test visit for ftp://some-other-" + url,
|
||||
style: ["favicon"],
|
||||
},
|
||||
{
|
||||
value: "ftp://" + url,
|
||||
comment: "A bookmark",
|
||||
style: ["favicon"],
|
||||
},
|
||||
],
|
||||
});
|
||||
await cleanup();
|
||||
});
|
||||
|
||||
// Tests interaction between the suggest.history and suggest.bookmark prefs.
|
||||
//
|
||||
// Config:
|
||||
// suggest.history = true
|
||||
// suggest.bookmark = false
|
||||
// search for: visited bookmark below autofill threshold
|
||||
// prefix search: yes
|
||||
// prefix matches search: yes
|
||||
// origin matches search: no
|
||||
//
|
||||
// Expected result:
|
||||
// should autofill: no
|
||||
add_task(async function suggestBookmarkFalse_visitedBookmarkBelow_prefix_2() {
|
||||
if (!origins) {
|
||||
// See comment above suggestBookmarkFalse_visitedBookmarkBelow.
|
||||
return;
|
||||
}
|
||||
// First, make sure that `url` is below the autofill threshold.
|
||||
await PlacesTestUtils.addVisits("http://non-matching-" + url);
|
||||
for (let i = 0; i < 3; i++) {
|
||||
await PlacesTestUtils.addVisits("http://some-other-" + url);
|
||||
}
|
||||
await check_autocomplete({
|
||||
search: "http://" + search,
|
||||
matches: [
|
||||
{
|
||||
value: "http://some-other-" + url,
|
||||
comment: "test visit for http://some-other-" + url,
|
||||
style: ["favicon"],
|
||||
},
|
||||
{
|
||||
value: "http://non-matching-" + url,
|
||||
comment: "test visit for http://non-matching-" + url,
|
||||
style: ["favicon"],
|
||||
},
|
||||
],
|
||||
});
|
||||
// Now bookmark it and set suggest.bookmark to false.
|
||||
await addBookmark({
|
||||
uri: "http://non-matching-" + url,
|
||||
});
|
||||
Services.prefs.setBoolPref("browser.urlbar.suggest.bookmark", false);
|
||||
await check_autocomplete({
|
||||
search: "http://" + search,
|
||||
matches: [
|
||||
{
|
||||
value: "http://some-other-" + url,
|
||||
comment: "test visit for http://some-other-" + url,
|
||||
style: ["favicon"],
|
||||
},
|
||||
{
|
||||
value: "http://non-matching-" + url,
|
||||
comment: "A bookmark",
|
||||
style: ["favicon"],
|
||||
},
|
||||
],
|
||||
});
|
||||
await cleanup();
|
||||
});
|
||||
|
||||
// Tests interaction between the suggest.history and suggest.bookmark prefs.
|
||||
//
|
||||
// Config:
|
||||
// suggest.history = true
|
||||
// suggest.bookmark = false
|
||||
// search for: visited bookmark below autofill threshold
|
||||
// prefix search: yes
|
||||
// prefix matches search: no
|
||||
// origin matches search: no
|
||||
//
|
||||
// Expected result:
|
||||
// should autofill: no
|
||||
add_task(async function suggestBookmarkFalse_visitedBookmarkBelow_prefix_3() {
|
||||
if (!origins) {
|
||||
// See comment above suggestBookmarkFalse_visitedBookmarkBelow.
|
||||
return;
|
||||
}
|
||||
// First, make sure that `url` is below the autofill threshold.
|
||||
await PlacesTestUtils.addVisits("ftp://non-matching-" + url);
|
||||
for (let i = 0; i < 3; i++) {
|
||||
await PlacesTestUtils.addVisits("ftp://some-other-" + url);
|
||||
}
|
||||
await check_autocomplete({
|
||||
search: "http://" + search,
|
||||
matches: [
|
||||
{
|
||||
value: "ftp://some-other-" + url,
|
||||
comment: "test visit for ftp://some-other-" + url,
|
||||
style: ["favicon"],
|
||||
},
|
||||
{
|
||||
value: "ftp://non-matching-" + url,
|
||||
comment: "test visit for ftp://non-matching-" + url,
|
||||
style: ["favicon"],
|
||||
},
|
||||
],
|
||||
});
|
||||
// Now bookmark it and set suggest.bookmark to false.
|
||||
await addBookmark({
|
||||
uri: "ftp://non-matching-" + url,
|
||||
});
|
||||
Services.prefs.setBoolPref("browser.urlbar.suggest.bookmark", false);
|
||||
await check_autocomplete({
|
||||
search: "http://" + search,
|
||||
matches: [
|
||||
{
|
||||
value: "ftp://some-other-" + url,
|
||||
comment: "test visit for ftp://some-other-" + url,
|
||||
style: ["favicon"],
|
||||
},
|
||||
{
|
||||
value: "ftp://non-matching-" + url,
|
||||
comment: "A bookmark",
|
||||
style: ["favicon"],
|
||||
},
|
||||
],
|
||||
});
|
||||
await cleanup();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Загрузка…
Ссылка в новой задаче