Bug 552617 - A paused update can't be resumed when closing the window using a window manager control. r=dolske, a=LegNeato
--- a/toolkit/mozapps/update/content/updates.js
+++ b/toolkit/mozapps/update/content/updates.js
@@ -1093,16 +1093,18 @@ var gDownloadingPage = {
/**
* Member variables for updating download status
*/
_lastSec: Infinity,
_startTime: Date.now(),
_pausedStatus: "",
+ _hiding: false,
+
/**
* Initialize
*/
onPageShow: function() {
this._downloadName = document.getElementById("downloadName");
this._downloadStatus = document.getElementById("downloadStatus");
this._downloadProgress = document.getElementById("downloadProgress");
this._downloadProgress.hidden = false;
@@ -1258,19 +1260,34 @@ var gDownloadingPage = {
}
this._paused = !this._paused;
// Update the UI
this._setUIState(this._paused);
},
/**
+ * When the user has closed the window using a Window Manager control (this
+ * page doesn't have a cancel button) cancel the update in progress.
+ */
+ onWizardCancel: function() {
+ if (this._hiding)
+ return;
+
+ this.removeDownloadListener();
+ },
+
+ /**
* When the user closes the Wizard UI by clicking the Hide button
*/
onHide: function() {
+ // Set _hiding to true to prevent onWizardCancel from cancelling the update
+ // that is in progress.
+ this._hiding = true;
+
// Remove ourself as a download listener so that we don't continue to be
// fed progress and state notifications after the UI we're updating has
// gone away.
var aus = CoC["@mozilla.org/updates/update-service;1"].
getService(CoI.nsIApplicationUpdateService);
aus.removeDownloadListener(this);
var um = CoC["@mozilla.org/updates/update-manager;1"].