Backed out changeset e70a7c752764 (bug 1250453) for m-oth bustage

This commit is contained in:
Carsten "Tomcat" Book 2016-03-10 14:46:14 +01:00
parent 1b96a2dd0b
commit bc5a4c5753

View File

@ -2547,7 +2547,8 @@ this.DOMApplicationRegistry = {
// Disallow reinstalls from the same manifest url for now.
for (let id in this.webapps) {
if (this.webapps[id].manifestURL == app.manifestURL) {
if (this.webapps[id].manifestURL == app.manifestURL &&
this._isLaunchable(this.webapps[id])) {
sendError("REINSTALL_FORBIDDEN");
return false;
}
@ -2678,7 +2679,7 @@ this.DOMApplicationRegistry = {
// Disallow reinstalls from the same manifest URL for now.
let id = this._appIdForManifestURL(app.manifestURL);
if (id !== null) {
if (id !== null && this._isLaunchable(this.webapps[id])) {
sendError("REINSTALL_FORBIDDEN");
return false;
}
@ -3140,7 +3141,13 @@ this.DOMApplicationRegistry = {
if (!aData.isPackage) {
this.updateAppHandlers(null, app.manifest, app);
if (aInstallSuccessCallback) {
yield aInstallSuccessCallback(app, app.manifest);
try {
yield aInstallSuccessCallback(app, app.manifest);
} catch (e) {
// Ignore exceptions during the local installation of
// an app. If it fails, the app will anyway be considered
// as not installed because isLaunchable will return false.
}
}
}
@ -3230,7 +3237,13 @@ this.DOMApplicationRegistry = {
aNewApp.manifestURL, aManifest);
if (aInstallSuccessCallback) {
yield aInstallSuccessCallback(aNewApp, aManifest, zipFile.path);
try {
yield aInstallSuccessCallback(aNewApp, aManifest, zipFile.path);
} catch (e) {
// Ignore exceptions during the local installation of
// an app. If it fails, the app will anyway be considered
// as not installed because isLaunchable will return false.
}
}
MessageBroadcaster.broadcastMessage("Webapps:UpdateState", {
@ -4005,7 +4018,7 @@ this.DOMApplicationRegistry = {
debug("Setting origin to " + uri.prePath +
" for " + aOldApp.manifestURL);
let newId = uri.prePath.substring(6); // "app://".length
if (newId in this.webapps) {
if (newId in this.webapps && this._isLaunchable(this.webapps[newId])) {
throw "DUPLICATE_ORIGIN";
}
aOldApp.origin = uri.prePath;
@ -4284,7 +4297,8 @@ this.DOMApplicationRegistry = {
for (let id in this.webapps) {
if (this.webapps[id].origin == aData.origin &&
this.webapps[id].localId == aData.appId) {
this.webapps[id].localId == aData.appId &&
this._isLaunchable(this.webapps[id])) {
let app = AppsUtils.cloneAppObject(this.webapps[id]);
aData.apps.push(app);
tmp.push({ id: id });
@ -4309,7 +4323,8 @@ this.DOMApplicationRegistry = {
let tmp = [];
for (let appId in this.webapps) {
if (this.webapps[appId].manifestURL == aData.manifestURL) {
if (this.webapps[appId].manifestURL == aData.manifestURL &&
this._isLaunchable(this.webapps[appId])) {
aData.app = AppsUtils.cloneAppObject(this.webapps[appId]);
tmp.push({ id: appId });
break;
@ -4330,7 +4345,8 @@ this.DOMApplicationRegistry = {
let tmp = [];
for (let id in this.webapps) {
if (this.webapps[id].installOrigin == aData.origin) {
if (this.webapps[id].installOrigin == aData.origin &&
this._isLaunchable(this.webapps[id])) {
aData.apps.push(AppsUtils.cloneAppObject(this.webapps[id]));
tmp.push({ id: id });
}
@ -4345,7 +4361,20 @@ this.DOMApplicationRegistry = {
getNotInstalled: function(aData, aMm) {
aData.apps = [];
aMm.sendAsyncMessage("Webapps:GetNotInstalled:Return:OK", this.formatMessage(aData));
let tmp = [];
for (let id in this.webapps) {
if (!this._isLaunchable(this.webapps[id])) {
aData.apps.push(AppsUtils.cloneAppObject(this.webapps[id]));
tmp.push({ id: id });
}
}
this._readManifests(tmp).then((aResult) => {
for (let i = 0; i < aResult.length; i++)
aData.apps[i].manifest = aResult[i].manifest;
aMm.sendAsyncMessage("Webapps:GetNotInstalled:Return:OK", this.formatMessage(aData));
});
},
getIcon: function(aData, aMm) {
@ -4774,6 +4803,10 @@ this.DOMApplicationRegistry = {
}
},
_isLaunchable: function(aApp) {
return true;
},
_notifyCategoryAndObservers: function(subject, topic, data, msg) {
const serviceMarker = "service,";