forked from mirrors/gecko-dev
Bug 1486092 - Part 1: Move the browser.contentblocking.enabled pref to StaticPrefs; r=baku
This commit is contained in:
parent
ee452067ce
commit
2d62042b5c
4 changed files with 13 additions and 9 deletions
|
|
@ -1487,7 +1487,6 @@ pref("browser.ping-centre.production.endpoint", "https://tiles.services.mozilla.
|
|||
// Enable GMP support in the addon manager.
|
||||
pref("media.gmp-provider.enabled", true);
|
||||
|
||||
pref("browser.contentblocking.enabled", true);
|
||||
pref("browser.contentblocking.cookies-site-data.ui.reject-trackers.recommended", true);
|
||||
pref("browser.contentblocking.fastblock.control-center.ui.enabled", true);
|
||||
pref("browser.contentblocking.trackingprotection.control-center.ui.enabled", true);
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@
|
|||
#include "mozilla/Preferences.h"
|
||||
#include "mozilla/ResultExtensions.h"
|
||||
#include "mozilla/Services.h"
|
||||
#include "mozilla/StaticPrefs.h"
|
||||
#include "mozilla/StartupTimeline.h"
|
||||
#include "mozilla/Telemetry.h"
|
||||
#include "mozilla/Unused.h"
|
||||
|
|
@ -13115,23 +13116,21 @@ nsDocShell::GetUseTrackingProtection(bool* aUseTrackingProtection)
|
|||
{
|
||||
*aUseTrackingProtection = false;
|
||||
|
||||
static bool sCBEnabled = false;
|
||||
bool cbEnabled = StaticPrefs::browser_contentblocking_enabled();
|
||||
static bool sTPEnabled = false;
|
||||
static bool sTPInPBEnabled = false;
|
||||
static bool sPrefsInit = false;
|
||||
|
||||
if (!sPrefsInit) {
|
||||
sPrefsInit = true;
|
||||
Preferences::AddBoolVarCache(&sCBEnabled,
|
||||
"browser.contentblocking.enabled", true);
|
||||
Preferences::AddBoolVarCache(&sTPEnabled,
|
||||
"privacy.trackingprotection.enabled", false);
|
||||
Preferences::AddBoolVarCache(&sTPInPBEnabled,
|
||||
"privacy.trackingprotection.pbmode.enabled", false);
|
||||
}
|
||||
|
||||
if (mUseTrackingProtection || (sCBEnabled && sTPEnabled) ||
|
||||
(sCBEnabled && UsePrivateBrowsing() && sTPInPBEnabled)) {
|
||||
if (mUseTrackingProtection || (cbEnabled && sTPEnabled) ||
|
||||
(cbEnabled && UsePrivateBrowsing() && sTPInPBEnabled)) {
|
||||
*aUseTrackingProtection = true;
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1246,6 +1246,13 @@ PREF("preferences.allow.omt-write", bool, true)
|
|||
// Privacy prefs
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
// Whether Content Blocking has been enabled
|
||||
VARCACHE_PREF(
|
||||
"browser.contentblocking.enabled",
|
||||
browser_contentblocking_enabled,
|
||||
bool, true
|
||||
)
|
||||
|
||||
VARCACHE_PREF(
|
||||
"privacy.restrict3rdpartystorage.ui.enabled",
|
||||
privacy_restrict3rdpartystorage_ui_enabled,
|
||||
|
|
|
|||
|
|
@ -695,13 +695,11 @@ nsHttpChannel::CheckFastBlocked()
|
|||
LOG(("nsHttpChannel::CheckFastBlocked [this=%p]\n", this));
|
||||
|
||||
static bool sFastBlockInited = false;
|
||||
static bool sIsContentBlockingEnabled = false;
|
||||
static bool sIsFastBlockEnabled = false;
|
||||
static uint32_t sFastBlockTimeout = 0;
|
||||
|
||||
if (!sFastBlockInited) {
|
||||
sFastBlockInited = true;
|
||||
Preferences::AddBoolVarCache(&sIsContentBlockingEnabled, "browser.contentblocking.enabled");
|
||||
Preferences::AddBoolVarCache(&sIsFastBlockEnabled, "browser.fastblock.enabled");
|
||||
Preferences::AddUintVarCache(&sFastBlockTimeout, "browser.fastblock.timeout");
|
||||
}
|
||||
|
|
@ -711,7 +709,8 @@ nsHttpChannel::CheckFastBlocked()
|
|||
return false;
|
||||
}
|
||||
|
||||
if (!sIsContentBlockingEnabled || !sIsFastBlockEnabled ||
|
||||
if (!StaticPrefs::browser_contentblocking_enabled() ||
|
||||
!sIsFastBlockEnabled ||
|
||||
IsContentPolicyTypeWhitelistedForFastBlock(mLoadInfo) ||
|
||||
!timestamp) {
|
||||
return false;
|
||||
|
|
|
|||
Loading…
Reference in a new issue