mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 823150 - The ondownloadavailable callback is not triggered on all the instances of the app. r=vingtetun
This commit is contained in:
parent
165dd0b752
commit
93d05c663e
@ -324,9 +324,10 @@ WebappsApplication.prototype = {
|
||||
"Webapps:CheckForUpdate:Return:OK",
|
||||
"Webapps:CheckForUpdate:Return:KO",
|
||||
"Webapps:PackageEvent"]);
|
||||
|
||||
cpmm.sendAsyncMessage("Webapps:RegisterForMessages",
|
||||
["Webapps:Uninstall:Return:OK", "Webapps:OfflineCache",
|
||||
"Webapps:PackageEvent"]);
|
||||
"Webapps:PackageEvent", "Webapps:CheckForUpdate:Return:OK"]);
|
||||
},
|
||||
|
||||
get manifest() {
|
||||
@ -432,7 +433,7 @@ WebappsApplication.prototype = {
|
||||
this._onprogress = null;
|
||||
cpmm.sendAsyncMessage("Webapps:UnregisterForMessages",
|
||||
["Webapps:Uninstall:Return:OK", "Webapps:OfflineCache",
|
||||
"Webapps:PackageEvent"]);
|
||||
"Webapps:PackageEvent", "Webapps:CheckForUpdate:Return:OK"]);
|
||||
},
|
||||
|
||||
_fireEvent: function(aName, aHandler) {
|
||||
@ -445,9 +446,12 @@ WebappsApplication.prototype = {
|
||||
receiveMessage: function(aMessage) {
|
||||
let msg = aMessage.json;
|
||||
let req = this.takeRequest(msg.requestID);
|
||||
|
||||
// ondownload* callbacks should be triggered on all app instances
|
||||
if ((msg.oid != this._id || !req) &&
|
||||
aMessage.name !== "Webapps:OfflineCache" &&
|
||||
aMessage.name !== "Webapps:PackageEvent")
|
||||
aMessage.name !== "Webapps:PackageEvent" &&
|
||||
aMessage.name !== "Webapps:CheckForUpdate:Return:OK")
|
||||
return;
|
||||
switch (aMessage.name) {
|
||||
case "Webapps:Uninstall:Return:OK":
|
||||
@ -462,6 +466,27 @@ WebappsApplication.prototype = {
|
||||
case "Webapps:Uninstall:Return:KO":
|
||||
Services.DOMRequest.fireError(req, "NOT_INSTALLED");
|
||||
break;
|
||||
case "Webapps:CheckForUpdate:Return:KO":
|
||||
Services.DOMRequest.fireError(req, msg.error);
|
||||
break;
|
||||
case "Webapps:CheckForUpdate:Return:OK":
|
||||
if (msg.manifestURL != this.manifestURL)
|
||||
return;
|
||||
|
||||
for (let prop in msg.app) {
|
||||
this[prop] = msg.app[prop];
|
||||
}
|
||||
|
||||
if (msg.event == "downloadapplied") {
|
||||
this._fireEvent("downloadapplied", this._ondownloadapplied);
|
||||
} else if (msg.event == "downloadavailable") {
|
||||
this._fireEvent("downloadavailable", this._ondownloadavailable);
|
||||
}
|
||||
|
||||
if (req) {
|
||||
Services.DOMRequest.fireSuccess(req, this.manifestURL);
|
||||
}
|
||||
break;
|
||||
case "Webapps:OfflineCache":
|
||||
if (msg.manifest != this.manifestURL)
|
||||
return;
|
||||
@ -482,58 +507,43 @@ WebappsApplication.prototype = {
|
||||
this._fireEvent("downloaderror", this._ondownloaderror);
|
||||
}
|
||||
break;
|
||||
case "Webapps:CheckForUpdate:Return:OK":
|
||||
for (let prop in msg.app) {
|
||||
this[prop] = msg.app[prop];
|
||||
}
|
||||
if (msg.event == "downloadapplied") {
|
||||
Services.DOMRequest.fireSuccess(req, this.manifestURL);
|
||||
case "Webapps:PackageEvent":
|
||||
if (msg.manifestURL != this.manifestURL)
|
||||
return;
|
||||
|
||||
// Set app values according to parent process results.
|
||||
let app = msg.app;
|
||||
this.downloading = app.downloading;
|
||||
this.downloadAvailable = app.downloadAvailable;
|
||||
this.downloadSize = app.downloadSize || 0;
|
||||
this.installState = app.installState;
|
||||
this.progress = app.progress || msg.progress || 0;
|
||||
this.readyToApplyDownload = app.readyToApplyDownload;
|
||||
this.updateTime = app.updateTime;
|
||||
|
||||
switch(msg.type) {
|
||||
case "error":
|
||||
case "canceled":
|
||||
this._downloadError = msg.error;
|
||||
this._fireEvent("downloaderror", this._ondownloaderror);
|
||||
break;
|
||||
case "progress":
|
||||
this._fireEvent("downloadprogress", this._onprogress);
|
||||
break;
|
||||
case "installed":
|
||||
this._manifest = msg.manifest;
|
||||
this._fireEvent("downloadsuccess", this._ondownloadsuccess);
|
||||
this._fireEvent("downloadapplied", this._ondownloadapplied);
|
||||
} else if (msg.event == "downloadavailable") {
|
||||
Services.DOMRequest.fireSuccess(req, this.manifestURL);
|
||||
this._fireEvent("downloadavailable", this._ondownloadavailable);
|
||||
}
|
||||
break;
|
||||
case "Webapps:CheckForUpdate:Return:KO":
|
||||
Services.DOMRequest.fireError(req, msg.error);
|
||||
break;
|
||||
case "Webapps:PackageEvent":
|
||||
if (msg.manifestURL != this.manifestURL)
|
||||
return;
|
||||
|
||||
// Set app values according to parent process results.
|
||||
let app = msg.app;
|
||||
this.downloading = app.downloading;
|
||||
this.downloadAvailable = app.downloadAvailable;
|
||||
this.downloadSize = app.downloadSize || 0;
|
||||
this.installState = app.installState;
|
||||
this.progress = app.progress || msg.progress || 0;
|
||||
this.readyToApplyDownload = app.readyToApplyDownload;
|
||||
this.updateTime = app.updateTime;
|
||||
|
||||
switch(msg.type) {
|
||||
case "error":
|
||||
case "canceled":
|
||||
this._downloadError = msg.error;
|
||||
this._fireEvent("downloaderror", this._ondownloaderror);
|
||||
break;
|
||||
case "progress":
|
||||
this._fireEvent("downloadprogress", this._onprogress);
|
||||
break;
|
||||
case "installed":
|
||||
this._manifest = msg.manifest;
|
||||
this._fireEvent("downloadsuccess", this._ondownloadsuccess);
|
||||
this._fireEvent("downloadapplied", this._ondownloadapplied);
|
||||
break;
|
||||
case "downloaded":
|
||||
this._manifest = msg.manifest;
|
||||
this._fireEvent("downloadsuccess", this._ondownloadsuccess);
|
||||
break;
|
||||
case "applied":
|
||||
this._fireEvent("downloadapplied", this._ondownloadapplied);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
break;
|
||||
case "downloaded":
|
||||
this._manifest = msg.manifest;
|
||||
this._fireEvent("downloadsuccess", this._ondownloadsuccess);
|
||||
break;
|
||||
case "applied":
|
||||
this._fireEvent("downloadapplied", this._ondownloadapplied);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
},
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user