Bug 1250453 - Remove DOMApplicationRegistry._isLaunchable property. r=myk

This commit is contained in:
Marco Castelluccio 2016-03-14 16:28:25 +00:00
Родитель 87d630bebf
Коммит aa9629f603
1 изменённых файлов: 9 добавлений и 42 удалений

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

@ -2547,8 +2547,7 @@ this.DOMApplicationRegistry = {
// Disallow reinstalls from the same manifest url for now. // Disallow reinstalls from the same manifest url for now.
for (let id in this.webapps) { 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"); sendError("REINSTALL_FORBIDDEN");
return false; return false;
} }
@ -2679,7 +2678,7 @@ this.DOMApplicationRegistry = {
// Disallow reinstalls from the same manifest URL for now. // Disallow reinstalls from the same manifest URL for now.
let id = this._appIdForManifestURL(app.manifestURL); let id = this._appIdForManifestURL(app.manifestURL);
if (id !== null && this._isLaunchable(this.webapps[id])) { if (id !== null) {
sendError("REINSTALL_FORBIDDEN"); sendError("REINSTALL_FORBIDDEN");
return false; return false;
} }
@ -3141,13 +3140,7 @@ this.DOMApplicationRegistry = {
if (!aData.isPackage) { if (!aData.isPackage) {
this.updateAppHandlers(null, app.manifest, app); this.updateAppHandlers(null, app.manifest, app);
if (aInstallSuccessCallback) { if (aInstallSuccessCallback) {
try { yield aInstallSuccessCallback(app, app.manifest);
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.
}
} }
} }
@ -3237,13 +3230,7 @@ this.DOMApplicationRegistry = {
aNewApp.manifestURL, aManifest); aNewApp.manifestURL, aManifest);
if (aInstallSuccessCallback) { if (aInstallSuccessCallback) {
try { yield aInstallSuccessCallback(aNewApp, aManifest, zipFile.path);
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", { MessageBroadcaster.broadcastMessage("Webapps:UpdateState", {
@ -4018,7 +4005,7 @@ this.DOMApplicationRegistry = {
debug("Setting origin to " + uri.prePath + debug("Setting origin to " + uri.prePath +
" for " + aOldApp.manifestURL); " for " + aOldApp.manifestURL);
let newId = uri.prePath.substring(6); // "app://".length let newId = uri.prePath.substring(6); // "app://".length
if (newId in this.webapps && this._isLaunchable(this.webapps[newId])) { if (newId in this.webapps) {
throw "DUPLICATE_ORIGIN"; throw "DUPLICATE_ORIGIN";
} }
aOldApp.origin = uri.prePath; aOldApp.origin = uri.prePath;
@ -4297,8 +4284,7 @@ this.DOMApplicationRegistry = {
for (let id in this.webapps) { for (let id in this.webapps) {
if (this.webapps[id].origin == aData.origin && 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]); let app = AppsUtils.cloneAppObject(this.webapps[id]);
aData.apps.push(app); aData.apps.push(app);
tmp.push({ id: id }); tmp.push({ id: id });
@ -4323,8 +4309,7 @@ this.DOMApplicationRegistry = {
let tmp = []; let tmp = [];
for (let appId in this.webapps) { 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]); aData.app = AppsUtils.cloneAppObject(this.webapps[appId]);
tmp.push({ id: appId }); tmp.push({ id: appId });
break; break;
@ -4345,8 +4330,7 @@ this.DOMApplicationRegistry = {
let tmp = []; let tmp = [];
for (let id in this.webapps) { 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])); aData.apps.push(AppsUtils.cloneAppObject(this.webapps[id]));
tmp.push({ id: id }); tmp.push({ id: id });
} }
@ -4361,20 +4345,7 @@ this.DOMApplicationRegistry = {
getNotInstalled: function(aData, aMm) { getNotInstalled: function(aData, aMm) {
aData.apps = []; aData.apps = [];
let tmp = []; aMm.sendAsyncMessage("Webapps:GetNotInstalled:Return:OK", this.formatMessage(aData));
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) { getIcon: function(aData, aMm) {
@ -4803,10 +4774,6 @@ this.DOMApplicationRegistry = {
} }
}, },
_isLaunchable: function(aApp) {
return true;
},
_notifyCategoryAndObservers: function(subject, topic, data, msg) { _notifyCategoryAndObservers: function(subject, topic, data, msg) {
const serviceMarker = "service,"; const serviceMarker = "service,";