Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/browser/app/profile/zen-browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,8 @@ pref('zen.urlbar.behavior', 'floating-on-type'); // default, floating-on-type, f
pref('zen.urlbar.wait-to-clear', 45000); // in ms (default 45s)
pref('zen.urlbar.show-domain-only-in-sidebar', true);
pref('zen.urlbar.hide-one-offs', true);
pref('zen.urlbar.show-sponsored', false);
pref('zen.urlbar.show-pinned', false);

#ifdef XP_MACOSX
// Disable for macos in the meantime until @HarryHeres finds a solution for hight DPI screens
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
diff --git a/browser/components/urlbar/UrlbarProviderTopSites.sys.mjs b/browser/components/urlbar/UrlbarProviderTopSites.sys.mjs
index bb02701730daf2306a6d4ca0086650bc3185bce2..f1c7355f2832dfde4b1288186c402cf25d617a64 100644
--- a/browser/components/urlbar/UrlbarProviderTopSites.sys.mjs
+++ b/browser/components/urlbar/UrlbarProviderTopSites.sys.mjs
@@ -168,6 +168,10 @@ class ProviderTopSites extends UrlbarProvider {
);
}

+ // Store options to avoid repeatedly calling getBoolPref.
+ const showPinnedResults = Services.prefs.getBoolPref("zen.urlbar.show-pinned");
+ const showSponsoredResults = Services.prefs.getBoolPref("zen.urlbar.show-sponsored");
+
// We usually respect maxRichResults, though we never show a number of Top
// Sites greater than what is visible in the New Tab Page, because the
// additional ones couldn't be managed from the page.
@@ -175,7 +179,24 @@ class ProviderTopSites extends UrlbarProvider {
lazy.UrlbarPrefs.get("maxRichResults"),
lazy.TOP_SITES_MAX_SITES_PER_ROW * this.topSitesRows
);
- sites = sites.slice(0, numTopSites);
+
+ sites = sites
+ // First we filter out pinned and sponsored results
+ .filter(link => {
+ const isPinned = !!link.isPinned;
+ const isSponsored = !!link.sponsored_position;
+ // Check if we should show pinned results.
+ if (isPinned && !showPinnedResults) {
+ return false;
+ }
+ // Check if we should show sponsored results.
+ if (isSponsored && !showSponsoredResults) {
+ return false;
+ }
+ return true;
+ })
+ // Then we slice the result to the max limit
+ .slice(0, numTopSites);

let index = 1;
sites = sites.map(link => {
4 changes: 2 additions & 2 deletions src/browser/components/urlbar/UrlbarView-sys-mjs.patch
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
diff --git a/browser/components/urlbar/UrlbarView.sys.mjs b/browser/components/urlbar/UrlbarView.sys.mjs
index 197e0a1c3030b6346c49a010338130797c1e5f4b..333d38aea2116c5407ffc242b805db633df12968 100644
index 4b634e59f0303ee3f908ac7d54e3ae84a17dd437..d7223cbc70537c71d126bbb867b33bceb2463004 100644
--- a/browser/components/urlbar/UrlbarView.sys.mjs
+++ b/browser/components/urlbar/UrlbarView.sys.mjs
@@ -628,7 +628,7 @@ export class UrlbarView {
@@ -625,7 +625,7 @@ export class UrlbarView {
!this.input.value ||
this.input.getAttribute("pageproxystate") == "valid"
) {
Expand Down