зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1212295 - Wait for SystemApp to be ready before sending update-error event. r=fabrice
This commit is contained in:
Родитель
ea75f93420
Коммит
20cbe0e046
|
@ -165,6 +165,8 @@ UpdatePrompt.prototype = {
|
|||
},
|
||||
_pendingUpdateAvailablePackageInfo: null,
|
||||
_isPendingUpdateReady: false,
|
||||
_updateErrorQueue: [ ],
|
||||
_receivedUpdatePromptReady: false,
|
||||
|
||||
// nsISystemUpdateProvider
|
||||
checkForUpdate: function() {
|
||||
|
@ -320,6 +322,19 @@ UpdatePrompt.prototype = {
|
|||
this.waitForIdle();
|
||||
},
|
||||
|
||||
storeUpdateError: function UP_storeUpdateError(aUpdate) {
|
||||
log("Storing update error for later use");
|
||||
this._updateErrorQueue.push(aUpdate);
|
||||
},
|
||||
|
||||
sendStoredUpdateError: function UP_sendStoredUpdateError() {
|
||||
log("Sending stored update error");
|
||||
this._updateErrorQueue.forEach(aUpdate => {
|
||||
this.sendUpdateEvent("update-error", aUpdate);
|
||||
});
|
||||
this._updateErrorQueue = [ ];
|
||||
},
|
||||
|
||||
showUpdateError: function UP_showUpdateError(aUpdate) {
|
||||
log("Update error, state: " + aUpdate.state + ", errorCode: " +
|
||||
aUpdate.errorCode);
|
||||
|
@ -327,7 +342,12 @@ UpdatePrompt.prototype = {
|
|||
this._systemUpdateListener.onError("update-error: " + aUpdate.errorCode + " " + aUpdate.statusText);
|
||||
}
|
||||
|
||||
this.sendUpdateEvent("update-error", aUpdate);
|
||||
if (!this._receivedUpdatePromptReady) {
|
||||
this.storeUpdateError(aUpdate);
|
||||
} else {
|
||||
this.sendUpdateEvent("update-error", aUpdate);
|
||||
}
|
||||
|
||||
this.setUpdateStatus(aUpdate.statusText);
|
||||
},
|
||||
|
||||
|
@ -601,6 +621,10 @@ UpdatePrompt.prototype = {
|
|||
case "update-prompt-apply-result":
|
||||
this.handleApplyPromptResult(detail);
|
||||
break;
|
||||
case "update-prompt-ready":
|
||||
this._receivedUpdatePromptReady = true;
|
||||
this.sendStoredUpdateError();
|
||||
break;
|
||||
}
|
||||
},
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче