mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 910618 - Clear progress on download cancel and on interaction with infobar. r=jmathies
This commit is contained in:
parent
a570d547c2
commit
7504b6bfd0
@ -53,6 +53,7 @@
|
||||
|
||||
// Fire notification closed event.
|
||||
let event = new Event('AlertClose');
|
||||
event.notification = aItem;
|
||||
this.dispatchEvent(event);
|
||||
|
||||
return aItem;
|
||||
|
@ -57,6 +57,7 @@ var Downloads = {
|
||||
Services.obs.addObserver(this, "dl-request", true);
|
||||
|
||||
this._notificationBox = Browser.getNotificationBox();
|
||||
this._notificationBox.addEventListener('AlertClose', this.handleEvent, true);
|
||||
|
||||
this._progress = new DownloadProgressListener(this);
|
||||
this.manager.addListener(this._progress);
|
||||
@ -225,6 +226,7 @@ var Downloads = {
|
||||
accessKey: "",
|
||||
callback: function() {
|
||||
Downloads.cancelDownload(aDownload);
|
||||
Downloads._downloadProgressIndicator.reset();
|
||||
}
|
||||
}
|
||||
];
|
||||
@ -397,6 +399,7 @@ var Downloads = {
|
||||
accessKey: "",
|
||||
callback: function() {
|
||||
Downloads.cancelDownloads();
|
||||
Downloads._downloadProgressIndicator.reset();
|
||||
}
|
||||
}
|
||||
];
|
||||
@ -431,6 +434,17 @@ var Downloads = {
|
||||
}
|
||||
},
|
||||
|
||||
handleEvent: function handleEvent(aEvent) {
|
||||
switch (aEvent.type) {
|
||||
case "AlertClose":
|
||||
if (aEvent.notification.value == "download-complete" &&
|
||||
!Downloads._notificationBox.getNotificationWithValue("download-complete")) {
|
||||
Downloads._downloadProgressIndicator.reset();
|
||||
}
|
||||
break;
|
||||
}
|
||||
},
|
||||
|
||||
observe: function (aSubject, aTopic, aData) {
|
||||
let message = "";
|
||||
let msgTitle = "";
|
||||
@ -459,7 +473,6 @@ var Downloads = {
|
||||
this._showDownloadCompleteToast(download);
|
||||
this._showDownloadCompleteNotification(download);
|
||||
}
|
||||
this._downloadProgressIndicator.reset();
|
||||
this._progressNotificationInfo.clear();
|
||||
this._downloadCount = 0;
|
||||
this._notificationBox.removeNotification(this._progressNotification);
|
||||
@ -469,7 +482,6 @@ var Downloads = {
|
||||
case "dl-failed":
|
||||
download = aSubject.QueryInterface(Ci.nsIDownload);
|
||||
this._showDownloadFailedNotification(download);
|
||||
this._downloadProgressIndicator.reset();
|
||||
break;
|
||||
case "dl-request":
|
||||
setTimeout(function() {
|
||||
|
Loading…
Reference in New Issue
Block a user