mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-18 15:55:36 +00:00
Bug 1096971 - Don't propagate an error when the package downloaded was the same we had. r=fabrice
This commit is contained in:
parent
123849abdb
commit
f748c30af9
@ -3263,7 +3263,7 @@ this.DOMApplicationRegistry = {
|
||||
// can proceed to access the app. We also throw an error to alert
|
||||
// the caller that the package wasn't downloaded.
|
||||
this._sendAppliedEvent(aOldApp);
|
||||
throw new Error("PACKAGE_UNCHANGED");
|
||||
throw "PACKAGE_UNCHANGED";
|
||||
}
|
||||
|
||||
let newManifest = yield this._openAndReadPackage(zipFile, aOldApp, aNewApp,
|
||||
@ -3922,6 +3922,13 @@ this.DOMApplicationRegistry = {
|
||||
return;
|
||||
}
|
||||
|
||||
// If the error that got us here was that the package hasn't changed,
|
||||
// since we already sent a success and an applied, let's not confuse
|
||||
// the clients...
|
||||
if (aError == "PACKAGE_UNCHANGED") {
|
||||
return;
|
||||
}
|
||||
|
||||
let download = AppDownloadManager.get(aNewApp.manifestURL);
|
||||
aOldApp.downloading = false;
|
||||
|
||||
|
@ -72,12 +72,13 @@ function checkLastAppState(aMiniManifestURL, aExpectedReady, aExpectedDownload,
|
||||
expected, true, false, aCb);
|
||||
}
|
||||
|
||||
function updateApp(aExpectedReady, aPreviousVersion, aNextVersion) {
|
||||
function updateApp(aExpectedReady, aPreviousVersion, aNextVersion, aFailOnError) {
|
||||
var lApp = PackagedTestHelper.gApp;
|
||||
|
||||
var ondownloadappliedhandler =
|
||||
checkLastAppState.bind(PackagedTestHelper, miniManifestURL, false, false,
|
||||
aNextVersion, PackagedTestHelper.next);
|
||||
aNextVersion,
|
||||
setTimeout.bind(undefined, PackagedTestHelper.next, 500));
|
||||
|
||||
var ondownloadsuccesshandler =
|
||||
checkLastAppState.bind(undefined, miniManifestURL,
|
||||
@ -86,8 +87,15 @@ function updateApp(aExpectedReady, aPreviousVersion, aNextVersion) {
|
||||
navigator.mozApps.mgmt.applyDownload(lApp);
|
||||
});
|
||||
|
||||
var ondownloaderrorhandler = aFailOnError ?
|
||||
function() {
|
||||
ok(false, "We should not get an error but got " +
|
||||
lApp.downloadError.name);
|
||||
PackagedTestHelper.finish();
|
||||
} : null;
|
||||
|
||||
checkForUpdate(true, ondownloadsuccesshandler, ondownloadappliedhandler,
|
||||
null, true);
|
||||
ondownloaderrorhandler, true);
|
||||
|
||||
}
|
||||
|
||||
@ -238,7 +246,7 @@ var steps = [
|
||||
},
|
||||
function() {
|
||||
info("== TEST == Update packaged app - same package");
|
||||
updateApp(false, 3, 3);
|
||||
updateApp(false, 3, 3, true);
|
||||
},
|
||||
function() {
|
||||
info("== TEST == Check for Update after getting the same package");
|
||||
|
Loading…
Reference in New Issue
Block a user