Bug 1078797 - Wait for running state before emitting install. r=ochameau

This commit is contained in:
J. Ryan Stinnett 2014-10-07 12:06:00 +02:00
Родитель 10c1efd57b
Коммит 2af2be4c4c
1 изменённых файлов: 6 добавлений и 3 удалений

Просмотреть файл

@ -665,7 +665,6 @@ AppActorFront.prototype = {
},
_clientListener: function (type, message) {
let { manifestURL } = message;
// Reset the app object to get a fresh copy when we (re)install the app.
@ -677,9 +676,11 @@ AppActorFront.prototype = {
switch(type) {
case "appOpen":
app.running = true;
this._notifyListeners("appOpen", app);
break;
case "appClose":
app.running = false;
this._notifyListeners("appClose", app);
break;
case "appInstall":
// The call to _getApp is going to create App object
@ -694,7 +695,10 @@ AppActorFront.prototype = {
.then(res => {
if (res.apps.indexOf(manifestURL) !== -1) {
app.running = true;
this._notifyListeners("appInstall", app);
this._notifyListeners("appOpen", app);
} else {
this._notifyListeners("appInstall", app);
}
});
break;
@ -705,12 +709,11 @@ AppActorFront.prototype = {
this._notifyListeners("appClose", app);
}
this._apps.delete(manifestURL);
this._notifyListeners("appUninstall", app);
break;
default:
return;
}
this._notifyListeners(type, app);
});
},