diff --git a/src/browser/app/profile/zen-browser.js b/src/browser/app/profile/zen-browser.js index 102fc4a3fe..32750a540a 100644 --- a/src/browser/app/profile/zen-browser.js +++ b/src/browser/app/profile/zen-browser.js @@ -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 diff --git a/src/browser/components/urlbar/UrlbarProviderTopSites-sys-mjs.patch b/src/browser/components/urlbar/UrlbarProviderTopSites-sys-mjs.patch new file mode 100644 index 0000000000..4bc314aeb9 --- /dev/null +++ b/src/browser/components/urlbar/UrlbarProviderTopSites-sys-mjs.patch @@ -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 => { diff --git a/src/browser/components/urlbar/UrlbarView-sys-mjs.patch b/src/browser/components/urlbar/UrlbarView-sys-mjs.patch index 046c8d571c..2fe6253402 100644 --- a/src/browser/components/urlbar/UrlbarView-sys-mjs.patch +++ b/src/browser/components/urlbar/UrlbarView-sys-mjs.patch @@ -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" ) {