zen-realigned/src/browser/components/urlbar/UrlbarProviderPlaces-sys-mjs.patch

56 lines
2.7 KiB
C++

diff --git a/browser/components/urlbar/UrlbarProviderPlaces.sys.mjs b/browser/components/urlbar/UrlbarProviderPlaces.sys.mjs
index 899e808c5f8cf14577404e3d1766fe967b32b065..82854a04edc21ac4552d06d6ba45c4714b5ef5cb 100644
--- a/browser/components/urlbar/UrlbarProviderPlaces.sys.mjs
+++ b/browser/components/urlbar/UrlbarProviderPlaces.sys.mjs
@@ -35,6 +35,8 @@ const QUERYINDEX_SWITCHTAB = 9;
const QUERYINDEX_FRECENCY = 10;
const QUERYINDEX_USERCONTEXTID = 11;
const QUERYINDEX_LASTVIST = 12;
+const QUERYINDEX_PINNEDTITLE = 13;
+const QUERYINDEX_PINNEDURL = 14;
// This SQL query fragment provides the following:
// - whether the entry is bookmarked (QUERYINDEX_BOOKMARKED)
@@ -56,11 +58,14 @@ const SQL_BOOKMARK_TAGS_FRAGMENT = `EXISTS(SELECT 1 FROM moz_bookmarks WHERE fk
// condition once, and avoid evaluating "btitle" and "tags" when it is false.
function defaultQuery(conditions = "") {
let query = `SELECT :query_type, h.url, h.title, ${SQL_BOOKMARK_TAGS_FRAGMENT},
- h.visit_count, h.typed, h.id, t.open_count, ${lazy.PAGES_FRECENCY_FIELD}, t.userContextId, h.last_visit_date
+ h.visit_count, h.typed, h.id, t.open_count, ${lazy.PAGES_FRECENCY_FIELD}, t.userContextId, h.last_visit_date,
+ zp.title AS pinned_title, zp.url AS pinned_url
FROM moz_places h
LEFT JOIN moz_openpages_temp t
ON t.url = h.url
AND (t.userContextId = :userContextId OR (t.userContextId <> -1 AND :userContextId IS NULL))
+ LEFT JOIN zen_pins zp
+ ON zp.url = h.url
WHERE (
(:switchTabsEnabled AND t.open_count > 0) OR
${lazy.PAGES_FRECENCY_FIELD} <> 0
@@ -74,7 +79,7 @@ function defaultQuery(conditions = "") {
:matchBehavior, :searchBehavior, NULL)
ELSE
AUTOCOMPLETE_MATCH(:searchString, h.url,
- h.title, '',
+ IFNULL(zp.title, h.title), '',
h.visit_count, h.typed,
0, t.open_count,
:matchBehavior, :searchBehavior, NULL)
@@ -1130,11 +1135,14 @@ Search.prototype = {
let lastVisit = lastVisitPRTime
? lazy.PlacesUtils.toDate(lastVisitPRTime).getTime()
: undefined;
-
+ let pinnedTitle = row.getResultByIndex(QUERYINDEX_PINNEDTITLE);
+ let pinnedUrl = row.getResultByIndex(QUERYINDEX_PINNEDURL);
+
+
let match = {
placeId,
- value: url,
- comment: bookmarkTitle || historyTitle,
+ value: pinnedUrl || url,
+ comment: pinnedTitle || bookmarkTitle || historyTitle,
icon: UrlbarUtils.getIconForUrl(url),
frecency: frecency || FRECENCY_DEFAULT,
userContextId,