Bug 1563996 - Make privacy.trackingprotection.{pbmode.,}enabled static prefs. r=bzbarsky

Differential Revision: https://phabricator.services.mozilla.com/D37202

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Nicholas Nethercote 2019-07-09 07:59:22 +00:00
parent 7c43c6f952
commit 2a0a298b36
3 changed files with 20 additions and 18 deletions

View File

@ -12447,20 +12447,10 @@ NS_IMETHODIMP
nsDocShell::GetUseTrackingProtection(bool* aUseTrackingProtection) {
*aUseTrackingProtection = false;
static bool sTPEnabled = false;
static bool sTPInPBEnabled = false;
static bool sPrefsInit = false;
if (!sPrefsInit) {
sPrefsInit = true;
Preferences::AddBoolVarCache(&sTPEnabled,
"privacy.trackingprotection.enabled", false);
Preferences::AddBoolVarCache(
&sTPInPBEnabled, "privacy.trackingprotection.pbmode.enabled", false);
}
if (mUseTrackingProtection || sTPEnabled ||
(UsePrivateBrowsing() && sTPInPBEnabled)) {
if (mUseTrackingProtection ||
StaticPrefs::privacy_trackingprotection_enabled() ||
(UsePrivateBrowsing() &&
StaticPrefs::privacy_trackingprotection_pbmode_enabled())) {
*aUseTrackingProtection = true;
return NS_OK;
}

View File

@ -6920,6 +6920,22 @@ VARCACHE_PREF(
)
#undef PREF_VALUE
// Enforce tracking protection in all modes.
VARCACHE_PREF(
Live,
"privacy.trackingprotection.enabled",
privacy_trackingprotection_enabled,
bool, false
)
// Enforce tracking protection in Private Browsing mode.
VARCACHE_PREF(
Live,
"privacy.trackingprotection.pbmode.enabled",
privacy_trackingprotection_pbmode_enabled,
bool, true
)
// Annotate channels based on the tracking protection list in all modes
VARCACHE_PREF(
Live,

View File

@ -1231,10 +1231,6 @@ pref("privacy.restrict3rdpartystorage.userInteractionRequiredForHosts", "");
// opened more than this number of popups.
pref("privacy.popups.maxReported", 100);
// Enforce tracking protection in all modes
pref("privacy.trackingprotection.enabled", false);
// Enforce tracking protection in Private Browsing mode
pref("privacy.trackingprotection.pbmode.enabled", true);
// Enable Origin Telemetry by default
#ifdef NIGHTLY_BUILD
pref("privacy.trackingprotection.origin_telemetry.enabled", true);