Bug 804571: Implement download cancel (pause) for B2G. r=fabrice

--HG--
extra : rebase_source : f6fe2a4416913f55dab81cd0c8801563a4e409f1
This commit is contained in:
Marshall Culpepper 2012-11-30 13:35:54 -06:00
parent e092247eaa
commit d42964acc0

View File

@ -260,10 +260,23 @@ UpdatePrompt.prototype = {
},
downloadUpdate: function UP_downloadUpdate(aUpdate) {
if (!aUpdate) {
aUpdate = Services.um.activeUpdate;
if (!aUpdate) {
log("No active update found to download");
return;
}
}
Services.aus.downloadUpdate(aUpdate, true);
Services.aus.addDownloadListener(this);
},
handleDownloadCancel: function UP_handleDownloadCancel() {
log("Pausing download");
Services.aus.pauseDownload();
},
finishUpdate: function UP_finishUpdate() {
if (!this._update.isOSUpdate) {
// Standard gecko+gaia updates will just need to restart the process
@ -347,6 +360,9 @@ UpdatePrompt.prototype = {
this.handleAvailableResult(detail);
this._update = null;
break;
case "update-download-cancel":
this.handleDownloadCancel();
break;
case "update-prompt-apply-result":
this.handleApplyPromptResult(detail);
break;