зеркало из https://github.com/mozilla/gecko-dev.git
Backed out changeset e97cfb1a3f88 (bug 1488951) by bhearsum`s request.
This commit is contained in:
Родитель
21f7f10fe9
Коммит
3c3da81ebc
|
@ -20,7 +20,6 @@ const TP_PREF = "privacy.trackingprotection.enabled";
|
|||
const TP_PB_PREF = "privacy.trackingprotection.pbmode.enabled";
|
||||
const FB_PREF = "browser.fastblock.enabled";
|
||||
const FB_TIMEOUT_PREF = "browser.fastblock.timeout";
|
||||
const FB_LIMIT_PREF = "browser.fastblock.limit";
|
||||
const TPC_PREF = "network.cookie.cookieBehavior";
|
||||
const BENIGN_PAGE = "http://tracking.example.org/browser/browser/base/content/test/trackingUI/benignPage.html";
|
||||
const TRACKING_PAGE = "http://tracking.example.org/browser/browser/base/content/test/trackingUI/trackingPage.html";
|
||||
|
@ -41,7 +40,6 @@ registerCleanupFunction(function() {
|
|||
Services.prefs.clearUserPref(CB_PREF);
|
||||
Services.prefs.clearUserPref(FB_PREF);
|
||||
Services.prefs.clearUserPref(FB_TIMEOUT_PREF);
|
||||
Services.prefs.clearUserPref(FB_LIMIT_PREF);
|
||||
Services.prefs.clearUserPref(TPC_PREF);
|
||||
});
|
||||
|
||||
|
@ -451,7 +449,6 @@ add_task(async function testFastBlock() {
|
|||
|
||||
Services.prefs.setBoolPref(FB_PREF, true);
|
||||
Services.prefs.setIntPref(FB_TIMEOUT_PREF, 0);
|
||||
Services.prefs.setIntPref(FB_LIMIT_PREF, 0);
|
||||
ok(FastBlock.enabled, "FB is enabled after setting the pref");
|
||||
Services.prefs.setBoolPref(CB_PREF, true);
|
||||
ok(ContentBlocking.enabled, "CB is enabled after setting the pref");
|
||||
|
@ -466,7 +463,6 @@ add_task(async function testFastBlock() {
|
|||
|
||||
Services.prefs.clearUserPref(FB_PREF);
|
||||
Services.prefs.clearUserPref(FB_TIMEOUT_PREF);
|
||||
Services.prefs.clearUserPref(FB_LIMIT_PREF);
|
||||
gBrowser.removeCurrentTab();
|
||||
});
|
||||
|
||||
|
|
|
@ -5868,17 +5868,11 @@ pref("general.document_open_conversion_depth_limit", 20);
|
|||
// documentElement and document.body are passive by default.
|
||||
pref("dom.event.default_to_passive_touch_listeners", true);
|
||||
|
||||
// Enable FastBlock?
|
||||
pref("browser.fastblock.enabled", false);
|
||||
// The amount of time (ms) since navigation start after which all
|
||||
// tracker connections will be cancelled.
|
||||
// The timeout (ms) since navigation start, all tracker connections been made
|
||||
// after this timeout will be canceled.
|
||||
pref("browser.fastblock.timeout", 5000);
|
||||
// The amount of time (ms) since navigation start after which
|
||||
// we'll stop blocking tracker connections (0 = no limit).
|
||||
#ifdef NIGHTLY_BUILD
|
||||
pref("browser.fastblock.limit", 20000);
|
||||
#else
|
||||
pref("browser.fastblock.limit", 0);
|
||||
#endif
|
||||
|
||||
// Enable clipboard readText() and writeText() by default
|
||||
pref("dom.events.asyncClipboard", true);
|
||||
|
|
|
@ -701,13 +701,11 @@ nsHttpChannel::CheckFastBlocked()
|
|||
static bool sFastBlockInited = false;
|
||||
static bool sIsFastBlockEnabled = false;
|
||||
static uint32_t sFastBlockTimeout = 0;
|
||||
static uint32_t sFastBlockLimit = 0;
|
||||
|
||||
if (!sFastBlockInited) {
|
||||
sFastBlockInited = true;
|
||||
Preferences::AddBoolVarCache(&sIsFastBlockEnabled, "browser.fastblock.enabled");
|
||||
Preferences::AddUintVarCache(&sFastBlockTimeout, "browser.fastblock.timeout");
|
||||
Preferences::AddUintVarCache(&sFastBlockLimit, "browser.fastblock.limit");
|
||||
}
|
||||
|
||||
TimeStamp timestamp;
|
||||
|
@ -729,20 +727,14 @@ nsHttpChannel::CheckFastBlocked()
|
|||
}
|
||||
|
||||
TimeDuration duration = TimeStamp::NowLoRes() - timestamp;
|
||||
bool hasFastBlockStarted = duration.ToMilliseconds() >= sFastBlockTimeout;
|
||||
bool hasFastBlockStopped = false;
|
||||
if ((sFastBlockLimit != 0) && (sFastBlockLimit > sFastBlockTimeout)) {
|
||||
hasFastBlockStopped = duration.ToMilliseconds() > sFastBlockLimit;
|
||||
}
|
||||
const bool isFastBlocking = hasFastBlockStarted && !hasFastBlockStopped;
|
||||
bool isFastBlocking = duration.ToMilliseconds() >= sFastBlockTimeout;
|
||||
|
||||
if (isFastBlocking && mLoadInfo) {
|
||||
MOZ_ALWAYS_SUCCEEDS(mLoadInfo->SetIsTrackerBlocked(true));
|
||||
}
|
||||
|
||||
LOG(("FastBlock started=%d stopped=%d (%lf) [this=%p]\n",
|
||||
static_cast<int>(hasFastBlockStarted),
|
||||
static_cast<int>(hasFastBlockStopped),
|
||||
LOG(("FastBlock %s (%lf) [this=%p]\n",
|
||||
isFastBlocking ? "timeout" : "passed",
|
||||
duration.ToMilliseconds(),
|
||||
this));
|
||||
return isFastBlocking;
|
||||
|
|
Загрузка…
Ссылка в новой задаче