diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:13:33 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:13:33 +0000 |
commit | 086c044dc34dfc0f74fbe41f4ecb402b2cd34884 (patch) | |
tree | a4f824bd33cb075dd5aa3eb5a0a94af221bbe83a /browser/components/urlbar/UrlbarProviderInputHistory.sys.mjs | |
parent | Adding debian version 124.0.1-1. (diff) | |
download | firefox-086c044dc34dfc0f74fbe41f4ecb402b2cd34884.tar.xz firefox-086c044dc34dfc0f74fbe41f4ecb402b2cd34884.zip |
Merging upstream version 125.0.1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'browser/components/urlbar/UrlbarProviderInputHistory.sys.mjs')
-rw-r--r-- | browser/components/urlbar/UrlbarProviderInputHistory.sys.mjs | 55 |
1 files changed, 21 insertions, 34 deletions
diff --git a/browser/components/urlbar/UrlbarProviderInputHistory.sys.mjs b/browser/components/urlbar/UrlbarProviderInputHistory.sys.mjs index c1f0cfb289..f929a1c003 100644 --- a/browser/components/urlbar/UrlbarProviderInputHistory.sys.mjs +++ b/browser/components/urlbar/UrlbarProviderInputHistory.sys.mjs @@ -23,16 +23,6 @@ ChromeUtils.defineESModuleGetters(lazy, { UrlbarResult: "resource:///modules/UrlbarResult.sys.mjs", }); -// Sqlite result row index constants. -const QUERYINDEX = { - URL: 0, - TITLE: 1, - BOOKMARKED: 2, - BOOKMARKTITLE: 3, - TAGS: 4, - SWITCHTAB: 8, -}; - // Constants to support an alternative frecency algorithm. const PAGES_USE_ALT_FRECENCY = Services.prefs.getBoolPref( "places.frecency.pages.alternative.featureGate", @@ -42,23 +32,20 @@ const PAGES_FRECENCY_FIELD = PAGES_USE_ALT_FRECENCY ? "alt_frecency" : "frecency"; -// This SQL query fragment provides the following: -// - whether the entry is bookmarked (QUERYINDEX_BOOKMARKED) -// - the bookmark title, if it is a bookmark (QUERYINDEX_BOOKMARKTITLE) -// - the tags associated with a bookmarked entry (QUERYINDEX_TAGS) -const SQL_BOOKMARK_TAGS_FRAGMENT = `EXISTS(SELECT 1 FROM moz_bookmarks WHERE fk = h.id) AS bookmarked, - ( SELECT title FROM moz_bookmarks WHERE fk = h.id AND title NOTNULL - ORDER BY lastModified DESC LIMIT 1 - ) AS btitle, - ( SELECT GROUP_CONCAT(t.title ORDER BY t.title) - FROM moz_bookmarks b - JOIN moz_bookmarks t ON t.id = +b.parent AND t.parent = :parent - WHERE b.fk = h.id - ) AS tags`; - const SQL_ADAPTIVE_QUERY = `/* do not warn (bug 487789) */ - SELECT h.url, h.title, ${SQL_BOOKMARK_TAGS_FRAGMENT}, h.visit_count, - h.typed, h.id, t.open_count, ${PAGES_FRECENCY_FIELD} + SELECT h.url, + h.title, + EXISTS(SELECT 1 FROM moz_bookmarks WHERE fk = h.id) AS bookmarked, + ( SELECT title FROM moz_bookmarks WHERE fk = h.id AND title NOTNULL + ORDER BY lastModified DESC LIMIT 1 + ) AS bookmark_title, + ( SELECT GROUP_CONCAT(t.title ORDER BY t.title) + FROM moz_bookmarks b + JOIN moz_bookmarks t ON t.id = +b.parent AND t.parent = :parent + WHERE b.fk = h.id + ) AS tags, + t.open_count, + t.userContextId FROM ( SELECT ROUND(MAX(use_count) * (1 + (input = :search_string)), 1) AS rank, place_id @@ -71,7 +58,7 @@ const SQL_ADAPTIVE_QUERY = `/* do not warn (bug 487789) */ ON t.url = h.url AND (t.userContextId = :userContextId OR (t.userContextId <> -1 AND :userContextId IS NULL)) WHERE AUTOCOMPLETE_MATCH(NULL, h.url, - IFNULL(btitle, h.title), tags, + IFNULL(bookmark_title, h.title), tags, h.visit_count, h.typed, bookmarked, t.open_count, :matchBehavior, :searchBehavior, @@ -142,14 +129,14 @@ class ProviderInputHistory extends UrlbarProvider { } for (let row of rows) { - const url = row.getResultByIndex(QUERYINDEX.URL); - const openPageCount = row.getResultByIndex(QUERYINDEX.SWITCHTAB) || 0; - const historyTitle = row.getResultByIndex(QUERYINDEX.TITLE) || ""; - const bookmarked = row.getResultByIndex(QUERYINDEX.BOOKMARKED); + const url = row.getResultByName("url"); + const openPageCount = row.getResultByName("open_count") || 0; + const historyTitle = row.getResultByName("title") || ""; + const bookmarked = row.getResultByName("bookmarked"); const bookmarkTitle = bookmarked - ? row.getResultByIndex(QUERYINDEX.BOOKMARKTITLE) + ? row.getResultByName("bookmark_title") : null; - const tags = row.getResultByIndex(QUERYINDEX.TAGS) || ""; + const tags = row.getResultByName("tags") || ""; let resultTitle = historyTitle; if (openPageCount > 0 && lazy.UrlbarPrefs.get("suggest.openpage")) { @@ -164,7 +151,7 @@ class ProviderInputHistory extends UrlbarProvider { url: [url, UrlbarUtils.HIGHLIGHT.TYPED], title: [resultTitle, UrlbarUtils.HIGHLIGHT.TYPED], icon: UrlbarUtils.getIconForUrl(url), - userContextId: queryContext.userContextId || 0, + userContextId: row.getResultByName("userContextId") || 0, }) ); addCallback(this, result); |