зеркало из https://github.com/mozilla/gecko-dev.git
Bug 553869 - move error codes constants from UpdateChecker to AddonManager r=rhelmer p=lenikmutungi@gmail.com
MozReview-Commit-ID: 98XGu4M6RV1 --HG-- extra : rebase_source : 36bc03b0a60e2db34feba01a45391d237f07d419
This commit is contained in:
Родитель
0854f5772d
Коммит
487da1b0f4
|
@ -3341,7 +3341,18 @@ this.AddonManager = {
|
|||
// The addon did not have the expected ID
|
||||
["ERROR_INCORRECT_ID", -7],
|
||||
]),
|
||||
|
||||
// The update check timed out
|
||||
ERROR_TIMEOUT: -1,
|
||||
// There was an error while downloading the update information.
|
||||
ERROR_DOWNLOAD_ERROR: -2,
|
||||
// The update information was malformed in some way.
|
||||
ERROR_PARSE_ERROR: -3,
|
||||
// The update information was not in any known format.
|
||||
ERROR_UNKNOWN_FORMAT: -4,
|
||||
// The update information was not correctly signed or there was an SSL error.
|
||||
ERROR_SECURITY_ERROR: -5,
|
||||
// The update was cancelled
|
||||
ERROR_CANCELLED: -6,
|
||||
// These must be kept in sync with AddonUpdateChecker.
|
||||
// No error was encountered.
|
||||
UPDATE_STATUS_NO_ERROR: 0,
|
||||
|
@ -3357,7 +3368,6 @@ this.AddonManager = {
|
|||
UPDATE_STATUS_SECURITY_ERROR: -5,
|
||||
// The update was cancelled.
|
||||
UPDATE_STATUS_CANCELLED: -6,
|
||||
|
||||
// Constants to indicate why an update check is being performed
|
||||
// Update check has been requested by the user.
|
||||
UPDATE_WHEN_USER_REQUESTED: 1,
|
||||
|
|
|
@ -607,13 +607,13 @@ UpdateParser.prototype = {
|
|||
CertUtils.checkCert(request.channel, !requireBuiltIn);
|
||||
} catch (e) {
|
||||
logger.warn("Request failed: " + this.url + " - " + e);
|
||||
this.notifyError(AddonUpdateChecker.ERROR_DOWNLOAD_ERROR);
|
||||
this.notifyError(AddonManager.ERROR_DOWNLOAD_ERROR);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!Components.isSuccessCode(request.status)) {
|
||||
logger.warn("Request failed: " + this.url + " - " + request.status);
|
||||
this.notifyError(AddonUpdateChecker.ERROR_DOWNLOAD_ERROR);
|
||||
this.notifyError(AddonManager.ERROR_DOWNLOAD_ERROR);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -621,7 +621,7 @@ UpdateParser.prototype = {
|
|||
if (channel instanceof Ci.nsIHttpChannel && !channel.requestSucceeded) {
|
||||
logger.warn("Request failed: " + this.url + " - " + channel.responseStatus +
|
||||
": " + channel.responseStatusText);
|
||||
this.notifyError(AddonUpdateChecker.ERROR_DOWNLOAD_ERROR);
|
||||
this.notifyError(AddonManager.ERROR_DOWNLOAD_ERROR);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -646,7 +646,7 @@ UpdateParser.prototype = {
|
|||
}
|
||||
} catch (e) {
|
||||
logger.warn("onUpdateCheckComplete failed to determine manifest type");
|
||||
this.notifyError(AddonUpdateChecker.ERROR_UNKNOWN_FORMAT);
|
||||
this.notifyError(AddonManager.ERROR_UNKNOWN_FORMAT);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -655,7 +655,7 @@ UpdateParser.prototype = {
|
|||
results = parser();
|
||||
} catch (e) {
|
||||
logger.warn("onUpdateCheckComplete failed to parse update manifest", e);
|
||||
this.notifyError(AddonUpdateChecker.ERROR_PARSE_ERROR);
|
||||
this.notifyError(AddonManager.ERROR_PARSE_ERROR);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -677,7 +677,7 @@ UpdateParser.prototype = {
|
|||
this.request = null;
|
||||
this._doneAt = new Error("Timed out");
|
||||
logger.warn("Request for " + this.url + " timed out");
|
||||
this.notifyError(AddonUpdateChecker.ERROR_TIMEOUT);
|
||||
this.notifyError(AddonManager.ERROR_TIMEOUT);
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -703,7 +703,7 @@ UpdateParser.prototype = {
|
|||
this.request = null;
|
||||
this._doneAt = new Error("UP_onError");
|
||||
|
||||
this.notifyError(AddonUpdateChecker.ERROR_DOWNLOAD_ERROR);
|
||||
this.notifyError(AddonManager.ERROR_DOWNLOAD_ERROR);
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -730,7 +730,7 @@ UpdateParser.prototype = {
|
|||
this.request.abort();
|
||||
this.request = null;
|
||||
this._doneAt = new Error("UP_cancel");
|
||||
this.notifyError(AddonUpdateChecker.ERROR_CANCELLED);
|
||||
this.notifyError(AddonManager.ERROR_CANCELLED);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -781,20 +781,6 @@ function matchesVersions(aUpdate, aAppVersion, aPlatformVersion,
|
|||
}
|
||||
|
||||
this.AddonUpdateChecker = {
|
||||
// These must be kept in sync with AddonManager
|
||||
// The update check timed out
|
||||
ERROR_TIMEOUT: -1,
|
||||
// There was an error while downloading the update information.
|
||||
ERROR_DOWNLOAD_ERROR: -2,
|
||||
// The update information was malformed in some way.
|
||||
ERROR_PARSE_ERROR: -3,
|
||||
// The update information was not in any known format.
|
||||
ERROR_UNKNOWN_FORMAT: -4,
|
||||
// The update information was not correctly signed or there was an SSL error.
|
||||
ERROR_SECURITY_ERROR: -5,
|
||||
// The update was cancelled
|
||||
ERROR_CANCELLED: -6,
|
||||
|
||||
/**
|
||||
* Retrieves the best matching compatibility update for the application from
|
||||
* a list of available update objects.
|
||||
|
|
|
@ -9,7 +9,7 @@ var AddonUpdateChecker = tempScope.AddonUpdateChecker;
|
|||
const updaterdf = RELATIVE_DIR + "browser_updatessl.rdf";
|
||||
const redirect = RELATIVE_DIR + "redirect.sjs?";
|
||||
const SUCCESS = 0;
|
||||
const DOWNLOAD_ERROR = AddonUpdateChecker.ERROR_DOWNLOAD_ERROR;
|
||||
const DOWNLOAD_ERROR = AddonManager.ERROR_DOWNLOAD_ERROR;
|
||||
|
||||
const HTTP = "http://example.com/";
|
||||
const HTTPS = "https://example.com/";
|
||||
|
|
|
@ -180,7 +180,7 @@ add_task(async function() {
|
|||
|
||||
throw "Update check should have failed";
|
||||
} catch (e) {
|
||||
equal(e.status, AddonUpdateChecker.ERROR_PARSE_ERROR);
|
||||
equal(e.status, AddonManager.ERROR_PARSE_ERROR);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
Загрузка…
Ссылка в новой задаче