Bug 830294 - Can't launch an app after canceling its update r=ferjm

This commit is contained in:
Fabrice Desré 2013-01-16 16:55:50 -08:00
Родитель ca8d20175e
Коммит d18fc8aa4a
1 изменённых файлов: 14 добавлений и 6 удалений

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

@ -898,6 +898,8 @@ this.DOMApplicationRegistry = {
return; return;
} }
let app = this.webapps[download.appId];
if (download.cacheUpdate) { if (download.cacheUpdate) {
// Cancel hosted app download. // Cancel hosted app download.
try { try {
@ -905,7 +907,12 @@ this.DOMApplicationRegistry = {
} catch (e) { debug (e); } } catch (e) { debug (e); }
} else if (download.channel) { } else if (download.channel) {
// Cancel packaged app download. // Cancel packaged app download.
download.channel.cancel(Cr.NS_BINDING_ABORTED); app.isCanceling = true;
try {
download.channel.cancel(Cr.NS_BINDING_ABORTED);
} catch(e) {
delete app.isCanceling;
}
} else { } else {
return; return;
} }
@ -1217,12 +1224,12 @@ this.DOMApplicationRegistry = {
this.webapps[id] = app; this.webapps[id] = app;
this._saveApps(function() { this._saveApps(function() {
let reg = DOMApplicationRegistry;
aData.app = app; aData.app = app;
app.manifest = aNewManifest || aOldManifest; app.manifest = aNewManifest || aOldManifest;
if (!manifest.appcache_path) { if (!manifest.appcache_path) {
aData.event = "downloadapplied"; aData.event = "downloadapplied";
DOMApplicationRegistry.broadcastMessage("Webapps:CheckForUpdate:Return:OK", reg.broadcastMessage("Webapps:CheckForUpdate:Return:OK", aData);
aData);
} else { } else {
// Check if the appcache is updatable, and send "downloadavailable" or // Check if the appcache is updatable, and send "downloadavailable" or
// "downloadapplied". // "downloadapplied".
@ -1234,8 +1241,8 @@ this.DOMApplicationRegistry = {
aTopic == "offline-cache-update-available" ? "downloadavailable" aTopic == "offline-cache-update-available" ? "downloadavailable"
: "downloadapplied"; : "downloadapplied";
aData.app.downloadAvailable = (aData.event == "downloadavailable"); aData.app.downloadAvailable = (aData.event == "downloadavailable");
DOMApplicationRegistry.broadcastMessage("Webapps:CheckForUpdate:Return:OK", reg._saveApps();
aData); reg.broadcastMessage("Webapps:CheckForUpdate:Return:OK", aData);
} }
} }
debug("updateHostedApp: updateSvc.checkForUpdate for " + debug("updateHostedApp: updateSvc.checkForUpdate for " +
@ -1818,7 +1825,8 @@ this.DOMApplicationRegistry = {
// We avoid notifying the error to the DOM side if the app download // We avoid notifying the error to the DOM side if the app download
// was cancelled via cancelDownload, which already sends its own // was cancelled via cancelDownload, which already sends its own
// notification. // notification.
if (!app.downloading && !app.downloadAvailable && !app.downloadSize) { if (app.isCanceling) {
delete app.isCanceling;
return; return;
} }