Backed out changeset 2467ce87767e (bug 1421500) for ESLint failure /toolkit/components/url-classifier/nsUrlClassifierLib.js:108. r=backout on a CLOSED TREE

This commit is contained in:
Csoregi Natalia
2017-12-14 04:38:07 +02:00
parent 0529bb896b
commit 7828fc1a71
5 changed files with 6 additions and 29 deletions

View File

@@ -8,13 +8,10 @@
const Cc = Components.classes;
const Ci = Components.interfaces;
const Cu = Components.utils;
const G_GDEBUG = false;
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.import("resource://gre/modules/Services.jsm");
Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
const PREF_DISABLE_TEST_BACKOFF = "browser.safebrowsing.provider.test.disableBackoff";
/**
* Partially applies a function to a particular "this object" and zero or
* more arguments. The result is a new function with some arguments of the first
@@ -86,7 +83,7 @@ this.RequestBackoff =
function RequestBackoff(maxErrors, retryIncrement,
maxRequests, requestPeriod,
timeoutIncrement, maxTimeout,
tolerance, provider = null) {
tolerance) {
this.MAX_ERRORS_ = maxErrors;
this.RETRY_INCREMENT_ = retryIncrement;
this.MAX_REQUESTS_ = maxRequests;
@@ -101,17 +98,6 @@ function RequestBackoff(maxErrors, retryIncrement,
this.numErrors_ = 0;
this.errorTimeout_ = 0;
this.nextRequestTime_ = 0;
// For test provider, we will disable backoff if preference is set to false.
if (provider === "test") {
this.canMakeRequestDefault = this.canMakeRequest;
this.canMakeRequest = function () {
if (Services.prefs.getBoolPref(PREF_DISABLE_TEST_BACKOFF, true)) {
return true;
}
return this.canMakeRequestDefault();
}
}
};
/**
@@ -189,8 +175,7 @@ RequestBackoff.prototype.isErrorStatus = function(status) {
// since both listmanager and hashcompleter would use it.
// Note that |maxRequests| and |requestPeriod| is still configurable
// to throttle pending requests.
function RequestBackoffV4(maxRequests, requestPeriod,
provider = null) {
function RequestBackoffV4(maxRequests, requestPeriod) {
let rand = Math.random();
let retryInterval = Math.floor(15 * 60 * 1000 * (rand + 1)); // 15 ~ 30 min.
let backoffInterval = Math.floor(30 * 60 * 1000 * (rand + 1)); // 30 ~ 60 min.
@@ -201,8 +186,7 @@ function RequestBackoffV4(maxRequests, requestPeriod,
requestPeriod /* request time, 60 min */,
backoffInterval /* backoff interval, 60 min */,
24 * 60 * 60 * 1000 /* max backoff, 24hr */,
1000 /* tolerance of 1 sec */,
provider /* provider name */);
1000 /* tolerance of 1 sec */);
}
// Expose this whole component.