зеркало из https://github.com/mozilla/gecko-dev.git
Bug 423790: Back off of safebrowsing updates for 4xx errors. r=tony, blocking-firefox3=beltzner
This commit is contained in:
Родитель
c16bc5775c
Коммит
88ec70bb2a
|
@ -467,6 +467,9 @@ PROT_ListManager.prototype.updateSuccess_ = function(waitForUpdate) {
|
|||
if (delay >= (5 * 60) && this.updateChecker_)
|
||||
this.updateChecker_.setDelay(delay * 1000);
|
||||
}
|
||||
|
||||
// Let the backoff object know that we completed successfully.
|
||||
this.requestBackoff_.noteServerResponse(200);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -492,9 +495,11 @@ PROT_ListManager.prototype.downloadError_ = function(status) {
|
|||
status = parseInt(status, 10);
|
||||
this.requestBackoff_.noteServerResponse(status);
|
||||
|
||||
// Try again in a minute
|
||||
this.currentUpdateChecker_ =
|
||||
new G_Alarm(BindToObject(this.checkForUpdates, this), 60000);
|
||||
if (this.requestBackoff_.isErrorStatus(status)) {
|
||||
// Try again in a minute
|
||||
this.currentUpdateChecker_ =
|
||||
new G_Alarm(BindToObject(this.checkForUpdates, this), 60000);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -90,7 +90,7 @@ RequestBackoff.prototype.canMakeRequest = function() {
|
|||
* Notify this object of the last server response. If it's an error,
|
||||
*/
|
||||
RequestBackoff.prototype.noteServerResponse = function(status) {
|
||||
if (this.isErrorStatus_(status)) {
|
||||
if (this.isErrorStatus(status)) {
|
||||
var now = Date.now();
|
||||
this.errorTimes_.push(now);
|
||||
|
||||
|
@ -120,12 +120,12 @@ RequestBackoff.prototype.noteServerResponse = function(status) {
|
|||
}
|
||||
|
||||
/**
|
||||
* We consider 302, 303, 307, and 5xx http responses to be errors.
|
||||
* We consider 302, 303, 307, 4xx, and 5xx http responses to be errors.
|
||||
* @param status Number http status
|
||||
* @return Boolean true if we consider this http status an error
|
||||
*/
|
||||
RequestBackoff.prototype.isErrorStatus_ = function(status) {
|
||||
return ((500 <= status && status <= 599) ||
|
||||
RequestBackoff.prototype.isErrorStatus = function(status) {
|
||||
return ((400 <= status && status <= 599) ||
|
||||
HTTP_FOUND == status ||
|
||||
HTTP_SEE_OTHER == status ||
|
||||
HTTP_TEMPORARY_REDIRECT == status);
|
||||
|
|
Загрузка…
Ссылка в новой задаче