diff --git a/toolkit/locales/en-US/chrome/mozapps/update/updates.dtd b/toolkit/locales/en-US/chrome/mozapps/update/updates.dtd
index 927e2f75d1f..993f1b23e7f 100755
--- a/toolkit/locales/en-US/chrome/mozapps/update/updates.dtd
+++ b/toolkit/locales/en-US/chrome/mozapps/update/updates.dtd
@@ -38,7 +38,7 @@
-
+
diff --git a/toolkit/locales/en-US/chrome/mozapps/update/updates.properties b/toolkit/locales/en-US/chrome/mozapps/update/updates.properties
index 937a6ebcf98..0601b9b3601 100755
--- a/toolkit/locales/en-US/chrome/mozapps/update/updates.properties
+++ b/toolkit/locales/en-US/chrome/mozapps/update/updates.properties
@@ -10,6 +10,8 @@ license404Error=The license file could not be found. Please contact the distribu
downloadingLicense=Downloading license text...
statusSucceededFormat=Installed on: %S
statusFailed=Install Failed
+pauseButtonPause=Pause
+pauseButtonResume=Resume
# The prefix /update2/0/ uniquely identifies the format of this URL. If you
# change the format of this URL, then you MUST change the prefix (i.e.,
# increment 0 to 1).
diff --git a/toolkit/mozapps/update/content/updates.js b/toolkit/mozapps/update/content/updates.js
index eb3c09d36d3..97566786f14 100755
--- a/toolkit/mozapps/update/content/updates.js
+++ b/toolkit/mozapps/update/content/updates.js
@@ -318,6 +318,7 @@ var gDownloadingPage = {
else
updates.pauseDownload();
this._paused = !this._paused;
+ document.getElementById("activeDownloadItem").paused = this._paused;
},
onClose: function() {
@@ -361,31 +362,35 @@ var gDownloadingPage = {
// Flip the progressmeter back to "undetermined" mode in case we need to
// download a new (complete) update patch.
var active = document.getElementById("activeDownloadItem");
- active.stopDownload();
-
- var state = STATE_FAILED;
+ active.state = gUpdates.update.state;
+
const NS_BINDING_ABORTED = 0x804b0002;
- var updates =
- Components.classes["@mozilla.org/updates/update-service;1"]
- .getService(Components.interfaces.nsIApplicationUpdateService);
- if (status == Components.results.NS_ERROR_UNEXPECTED) {
- if (!gUpdates.update.isCompleteUpdate) {
- // If we were downloading a patch and the patch verification phase
- // failed, log this and then commence downloading the complete update.
- LOG("Verification of patch failed, downloading complete update");
- gUpdates.update.isCompleteUpdate = true;
- state = updates.downloadUpdate(gUpdates.update, false);
- }
- if (state == STATE_FAILED)
+ switch (status) {
+ case Components.results.NS_ERROR_UNEXPECTED:
+ LOG("DLP:STATE = " + gUpdates.update.state);
+ if (gUpdates.update.state == STATE_FAILED)
this.showVerificationError();
- else
+ else {
+ // Verification failed for a partial patch, complete patch is now
+ // downloading so return early and do NOT remove the download listener!
+
+ // Reset the progress meter to "undertermined" mode so that we don't
+ // show old progress for the new download of the "complete" patch.
+ active.stopDownload();
return;
- }
- else if (status == NS_BINDING_ABORTED) {
- state = gUpdates.update.state;
+ }
+ break;
+ case NS_BINDING_ABORTED:
LOG("gDownloadingPage.onStopRequest: Pausing Download");
+ // Return early, do not remove UI listener since the user may resume
+ // downloading again.
+ return;
}
- active.state = state;
+
+ LOG("Removing Listener");
+ var updates =
+ Components.classes["@mozilla.org/updates/update-service;1"].
+ getService(Components.interfaces.nsIApplicationUpdateService);
updates.removeDownloadListener(this);
},
diff --git a/toolkit/mozapps/update/content/updates.xml b/toolkit/mozapps/update/content/updates.xml
index 43bde32a0f0..3ecb0dac8d9 100644
--- a/toolkit/mozapps/update/content/updates.xml
+++ b/toolkit/mozapps/update/content/updates.xml
@@ -66,7 +66,7 @@
mode="undetermined"/>
-
@@ -85,6 +85,9 @@
document.getAnonymousElementByAttribute(this, "anonid", "modeDeck");
+
+ document.getAnonymousElementByAttribute(this, "anonid", "pauseButton");
+
@@ -119,11 +123,25 @@
+ false
+
+
+
+
+
diff --git a/toolkit/mozapps/update/src/nsUpdateService.js.in b/toolkit/mozapps/update/src/nsUpdateService.js.in
index 2b7ba761e20..4f1e219da21 100644
--- a/toolkit/mozapps/update/src/nsUpdateService.js.in
+++ b/toolkit/mozapps/update/src/nsUpdateService.js.in
@@ -1489,6 +1489,17 @@ Downloader.prototype = {
state = STATE_FAILED;
// TODO: use more informative error code here
status = Components.results.NS_ERROR_UNEXPECTED;
+
+ if (!this._update.isCompleteUpdate) {
+ // If we were downloading a patch and the patch verification phase
+ // failed, log this and then commence downloading the complete update.
+ LOG("Downloader.onStopRequest: Verification of patch failed, downloading complete update");
+ this._update.isCompleteUpdate = true;
+ var rv = this.downloadUpdate(this._update);
+ LOG("US:STATE = " + rv);
+ // This will reset the |.state| property on this._update if a new
+ // download initiates.
+ }
}
this._writeStatusFile(this._getUpdatesDir(), state);
this._update.state = state;