Bug 1092152 - Don't calculate the downloaded file hash if we didn't download it. r=fabrice

This commit is contained in:
Antonio M. Amaya 2014-10-31 10:36:00 -04:00
Родитель ab47caf917
Коммит acef08daa0
1 изменённых файлов: 10 добавлений и 3 удалений

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

@ -3243,10 +3243,17 @@ this.DOMApplicationRegistry = {
// After this point, it's too late to cancel the download.
AppDownloadManager.remove(aNewApp.manifestURL);
let hash = yield this._computeFileHash(zipFile.path);
let responseStatus = requestChannel.responseStatus;
let oldPackage = (responseStatus == 304 || hash == aOldApp.packageHash);
let oldPackage = responseStatus == 304;
// If the response was 304 we probably won't have anything to hash.
let hash = null;
if (!oldPackage) {
hash = yield this._computeFileHash(zipFile.path);
}
oldPackage = oldPackage || (hash == aOldApp.packageHash);
if (oldPackage) {
debug("package's etag or hash unchanged; sending 'applied' event");