Bug 1695747 - Remove sponsored top sites from address bar results. r=mikedeboer

Differential Revision: https://phabricator.services.mozilla.com/D106866
This commit is contained in:
Dão Gottwald 2021-03-02 13:09:34 +00:00
parent 2e8a91f39a
commit f33af33f30
4 changed files with 11 additions and 0 deletions

View File

@ -365,6 +365,9 @@ pref("browser.urlbar.openintab", false);
// If true, we show tail suggestions when available.
pref("browser.urlbar.richSuggestions.tail", true);
// If true, top sites may include sponsored ones.
pref("browser.urlbar.sponsoredTopSites", false);
// Controls the empty search behavior in Search Mode:
// 0 - Show nothing
// 1 - Show search history

View File

@ -205,6 +205,9 @@ const PREF_URLBAR_DEFAULTS = new Map([
// Remove redundant portions from URLs.
["trimURLs", true],
// If true, top sites may include sponsored ones.
["sponsoredTopSites", false],
// Results will include a built-in set of popular domains when this is true.
["usepreloadedtopurls.enabled", false],

View File

@ -122,6 +122,10 @@ class ProviderTopSites extends UrlbarProvider {
// on about:newtab.
sites = sites.filter(site => site);
if (!UrlbarPrefs.get("sponsoredTopSites")) {
sites = sites.filter(site => !site.sponsored_position);
}
// This is done here, rather than in the global scope, because
// TOP_SITES_DEFAULT_ROWS causes the import of Reducers.jsm, and we want to
// do that only when actually querying for Top Sites.

View File

@ -42,6 +42,7 @@ add_task(async function setup() {
await SpecialPowers.pushPrefEnv({
set: [
["browser.urlbar.sponsoredTopSites", true],
["browser.urlbar.suggest.topsites", true],
["browser.newtabpage.activity-stream.default.sites", EN_US_TOPSITES],
[