mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 817821: Part 1 - Communicate update download events better to Gaia. r=fabrice
This commit is contained in:
parent
d9b9fc0db3
commit
2b4fe2d2fb
@ -460,11 +460,20 @@ UpdatePrompt.prototype = {
|
||||
|
||||
// nsIRequestObserver
|
||||
|
||||
_startedSent: false,
|
||||
|
||||
onStartRequest: function UP_onStartRequest(aRequest, aContext) {
|
||||
this.sendChromeEvent("update-downloading");
|
||||
// Wait until onProgress to send the update-download-started event, in case
|
||||
// this request turns out to fail for some reason
|
||||
this._startedSent = false;
|
||||
},
|
||||
|
||||
onStopRequest: function UP_onStopRequest(aRequest, aContext, aStatusCode) {
|
||||
let paused = !Components.isSuccessCode(aStatusCode);
|
||||
this.sendChromeEvent("update-download-stopped", {
|
||||
paused: paused
|
||||
});
|
||||
|
||||
Services.aus.removeDownloadListener(this);
|
||||
},
|
||||
|
||||
@ -472,7 +481,14 @@ UpdatePrompt.prototype = {
|
||||
|
||||
onProgress: function UP_onProgress(aRequest, aContext, aProgress,
|
||||
aProgressMax) {
|
||||
this.sendChromeEvent("update-progress", {
|
||||
if (!this._startedSent) {
|
||||
this.sendChromeEvent("update-download-started", {
|
||||
total: aProgressMax
|
||||
});
|
||||
this._startedSent = true;
|
||||
}
|
||||
|
||||
this.sendChromeEvent("update-download-progress", {
|
||||
progress: aProgress,
|
||||
total: aProgressMax
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user