Backed out changeset e97cfb1a3f88 (bug 1488951) by bhearsum`s request.

This commit is contained in:
Narcis Beleuzu 2018-09-11 22:01:36 +03:00
Родитель 21f7f10fe9
Коммит 3c3da81ebc
3 изменённых файлов: 6 добавлений и 24 удалений

Просмотреть файл

@ -20,7 +20,6 @@ const TP_PREF = "privacy.trackingprotection.enabled";
const TP_PB_PREF = "privacy.trackingprotection.pbmode.enabled"; const TP_PB_PREF = "privacy.trackingprotection.pbmode.enabled";
const FB_PREF = "browser.fastblock.enabled"; const FB_PREF = "browser.fastblock.enabled";
const FB_TIMEOUT_PREF = "browser.fastblock.timeout"; const FB_TIMEOUT_PREF = "browser.fastblock.timeout";
const FB_LIMIT_PREF = "browser.fastblock.limit";
const TPC_PREF = "network.cookie.cookieBehavior"; const TPC_PREF = "network.cookie.cookieBehavior";
const BENIGN_PAGE = "http://tracking.example.org/browser/browser/base/content/test/trackingUI/benignPage.html"; 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"; 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(CB_PREF);
Services.prefs.clearUserPref(FB_PREF); Services.prefs.clearUserPref(FB_PREF);
Services.prefs.clearUserPref(FB_TIMEOUT_PREF); Services.prefs.clearUserPref(FB_TIMEOUT_PREF);
Services.prefs.clearUserPref(FB_LIMIT_PREF);
Services.prefs.clearUserPref(TPC_PREF); Services.prefs.clearUserPref(TPC_PREF);
}); });
@ -451,7 +449,6 @@ add_task(async function testFastBlock() {
Services.prefs.setBoolPref(FB_PREF, true); Services.prefs.setBoolPref(FB_PREF, true);
Services.prefs.setIntPref(FB_TIMEOUT_PREF, 0); Services.prefs.setIntPref(FB_TIMEOUT_PREF, 0);
Services.prefs.setIntPref(FB_LIMIT_PREF, 0);
ok(FastBlock.enabled, "FB is enabled after setting the pref"); ok(FastBlock.enabled, "FB is enabled after setting the pref");
Services.prefs.setBoolPref(CB_PREF, true); Services.prefs.setBoolPref(CB_PREF, true);
ok(ContentBlocking.enabled, "CB is enabled after setting the pref"); 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_PREF);
Services.prefs.clearUserPref(FB_TIMEOUT_PREF); Services.prefs.clearUserPref(FB_TIMEOUT_PREF);
Services.prefs.clearUserPref(FB_LIMIT_PREF);
gBrowser.removeCurrentTab(); gBrowser.removeCurrentTab();
}); });

Просмотреть файл

@ -5868,17 +5868,11 @@ pref("general.document_open_conversion_depth_limit", 20);
// documentElement and document.body are passive by default. // documentElement and document.body are passive by default.
pref("dom.event.default_to_passive_touch_listeners", true); pref("dom.event.default_to_passive_touch_listeners", true);
// Enable FastBlock?
pref("browser.fastblock.enabled", false); pref("browser.fastblock.enabled", false);
// The amount of time (ms) since navigation start after which all // The timeout (ms) since navigation start, all tracker connections been made
// tracker connections will be cancelled. // after this timeout will be canceled.
pref("browser.fastblock.timeout", 5000); 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 // Enable clipboard readText() and writeText() by default
pref("dom.events.asyncClipboard", true); pref("dom.events.asyncClipboard", true);

Просмотреть файл

@ -701,13 +701,11 @@ nsHttpChannel::CheckFastBlocked()
static bool sFastBlockInited = false; static bool sFastBlockInited = false;
static bool sIsFastBlockEnabled = false; static bool sIsFastBlockEnabled = false;
static uint32_t sFastBlockTimeout = 0; static uint32_t sFastBlockTimeout = 0;
static uint32_t sFastBlockLimit = 0;
if (!sFastBlockInited) { if (!sFastBlockInited) {
sFastBlockInited = true; sFastBlockInited = true;
Preferences::AddBoolVarCache(&sIsFastBlockEnabled, "browser.fastblock.enabled"); Preferences::AddBoolVarCache(&sIsFastBlockEnabled, "browser.fastblock.enabled");
Preferences::AddUintVarCache(&sFastBlockTimeout, "browser.fastblock.timeout"); Preferences::AddUintVarCache(&sFastBlockTimeout, "browser.fastblock.timeout");
Preferences::AddUintVarCache(&sFastBlockLimit, "browser.fastblock.limit");
} }
TimeStamp timestamp; TimeStamp timestamp;
@ -729,20 +727,14 @@ nsHttpChannel::CheckFastBlocked()
} }
TimeDuration duration = TimeStamp::NowLoRes() - timestamp; TimeDuration duration = TimeStamp::NowLoRes() - timestamp;
bool hasFastBlockStarted = duration.ToMilliseconds() >= sFastBlockTimeout; bool isFastBlocking = duration.ToMilliseconds() >= sFastBlockTimeout;
bool hasFastBlockStopped = false;
if ((sFastBlockLimit != 0) && (sFastBlockLimit > sFastBlockTimeout)) {
hasFastBlockStopped = duration.ToMilliseconds() > sFastBlockLimit;
}
const bool isFastBlocking = hasFastBlockStarted && !hasFastBlockStopped;
if (isFastBlocking && mLoadInfo) { if (isFastBlocking && mLoadInfo) {
MOZ_ALWAYS_SUCCEEDS(mLoadInfo->SetIsTrackerBlocked(true)); MOZ_ALWAYS_SUCCEEDS(mLoadInfo->SetIsTrackerBlocked(true));
} }
LOG(("FastBlock started=%d stopped=%d (%lf) [this=%p]\n", LOG(("FastBlock %s (%lf) [this=%p]\n",
static_cast<int>(hasFastBlockStarted), isFastBlocking ? "timeout" : "passed",
static_cast<int>(hasFastBlockStopped),
duration.ToMilliseconds(), duration.ToMilliseconds(),
this)); this));
return isFastBlocking; return isFastBlocking;