Bug 834371 - Applying a packaged app update and immediately losing power to the phone - app update is lost r=julienw

This commit is contained in:
Fabrice Desré 2013-01-30 22:50:28 -08:00
Родитель be352aedf9
Коммит 3b7eea0211
1 изменённых файлов: 24 добавлений и 16 удалений

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

@ -110,40 +110,48 @@ this.DOMApplicationRegistry = {
this.webapps = aData;
let appDir = FileUtils.getDir(DIRECTORY_NAME, ["webapps"], false);
for (let id in this.webapps) {
let app = this.webapps[id];
this.webapps[id].id = id;
app.id = id;
// Make sure we have a localId
if (this.webapps[id].localId === undefined) {
this.webapps[id].localId = this._nextLocalId();
if (app.localId === undefined) {
app.localId = this._nextLocalId();
}
if (this.webapps[id].basePath === undefined) {
this.webapps[id].basePath = appDir.path;
if (app.basePath === undefined) {
app.basePath = appDir.path;
}
// Default to removable apps.
if (this.webapps[id].removable === undefined) {
this.webapps[id].removable = true;
if (app.removable === undefined) {
app.removable = true;
}
// Default to a non privileged status.
if (this.webapps[id].appStatus === undefined) {
this.webapps[id].appStatus = Ci.nsIPrincipal.APP_STATUS_INSTALLED;
if (app.appStatus === undefined) {
app.appStatus = Ci.nsIPrincipal.APP_STATUS_INSTALLED;
}
// Default to NO_APP_ID and not in browser.
if (this.webapps[id].installerAppId === undefined) {
this.webapps[id].installerAppId = Ci.nsIScriptSecurityManager.NO_APP_ID;
if (app.installerAppId === undefined) {
app.installerAppId = Ci.nsIScriptSecurityManager.NO_APP_ID;
}
if (this.webapps[id].installerIsBrowser === undefined) {
this.webapps[id].installerIsBrowser = false;
if (app.installerIsBrowser === undefined) {
app.installerIsBrowser = false;
}
// Default installState to "installed".
if (this.webapps[id].installState === undefined) {
this.webapps[id].installState = "installed";
// Default installState to "installed", and reset if we shutdown
// during an update.
if (app.installState === undefined ||
app.installState === "updating") {
app.installState = "installed";
}
// At startup we can't be downloading, and the $TMP directory
// will be empty so we can't just apply a staged update.
app.downloading = false;
app.readyToApplyDownload = false;
};
}
aNext();