mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-08 19:04:45 +00:00
Bug 909573 - getManifestFor should accept a manifest url instead of an origin. r=fabrice
This commit is contained in:
parent
bc3f221ede
commit
bfa66ae5ef
@ -743,7 +743,7 @@ var AlertsHelper = {
|
||||
this._listeners[uid] = listener;
|
||||
|
||||
let app = DOMApplicationRegistry.getAppByManifestURL(listener.manifestURL);
|
||||
DOMApplicationRegistry.getManifestFor(app.origin, function(manifest) {
|
||||
DOMApplicationRegistry.getManifestFor(app.manifestURL, function(manifest) {
|
||||
let helper = new ManifestHelper(manifest, app.origin);
|
||||
let getNotificationURLFor = function(messages) {
|
||||
if (!messages)
|
||||
@ -800,7 +800,7 @@ var AlertsHelper = {
|
||||
// If we have a manifest URL, get the icon and title from the manifest
|
||||
// to prevent spoofing.
|
||||
let app = DOMApplicationRegistry.getAppByManifestURL(manifestUrl);
|
||||
DOMApplicationRegistry.getManifestFor(app.origin, function(aManifest) {
|
||||
DOMApplicationRegistry.getManifestFor(manifestUrl, function(aManifest) {
|
||||
let helper = new ManifestHelper(aManifest, app.origin);
|
||||
send(helper.name, helper.iconURLForSize(128));
|
||||
});
|
||||
@ -893,7 +893,7 @@ var WebappsHelper = {
|
||||
|
||||
switch(topic) {
|
||||
case "webapps-launch":
|
||||
DOMApplicationRegistry.getManifestFor(json.origin, function(aManifest) {
|
||||
DOMApplicationRegistry.getManifestFor(json.manifestURL, function(aManifest) {
|
||||
if (!aManifest)
|
||||
return;
|
||||
|
||||
|
@ -251,7 +251,7 @@ ContentPermissionPrompt.prototype = {
|
||||
|
||||
// When it's an app, get the manifest to add the l10n application name.
|
||||
let app = DOMApplicationRegistry.getAppByLocalId(principal.appId);
|
||||
DOMApplicationRegistry.getManifestFor(app.origin, function getManifest(aManifest) {
|
||||
DOMApplicationRegistry.getManifestFor(app.manifestURL, function getManifest(aManifest) {
|
||||
let helper = new ManifestHelper(aManifest, app.origin);
|
||||
details.appName = helper.name;
|
||||
browser.shell.sendChromeEvent(details);
|
||||
|
@ -1201,7 +1201,7 @@ this.DOMApplicationRegistry = {
|
||||
}
|
||||
|
||||
// We need to get the old manifest to unregister web activities.
|
||||
this.getManifestFor(app.origin, (function(aOldManifest) {
|
||||
this.getManifestFor(aManifestURL, (function(aOldManifest) {
|
||||
debug("Old manifest: " + JSON.stringify(aOldManifest));
|
||||
// Move the application.zip and manifest.webapp files out of TmpD
|
||||
let tmpDir = FileUtils.getDir("TmpD", ["webapps", id], true, true);
|
||||
@ -1240,7 +1240,7 @@ this.DOMApplicationRegistry = {
|
||||
Services.obs.notifyObservers(zipFile, "flush-cache-entry", null);
|
||||
|
||||
// Get the manifest, and set properties.
|
||||
this.getManifestFor(app.origin, (function(aData) {
|
||||
this.getManifestFor(aManifestURL, (function(aData) {
|
||||
debug("New manifest: " + JSON.stringify(aData));
|
||||
app.downloading = false;
|
||||
app.downloadAvailable = false;
|
||||
@ -1993,16 +1993,8 @@ this.DOMApplicationRegistry = {
|
||||
let app = aData.app;
|
||||
app.removable = true;
|
||||
|
||||
let origin = Services.io.newURI(app.origin, null, null);
|
||||
let manifestURL = origin.resolve(app.manifestURL);
|
||||
|
||||
let id = this._appId(app.origin);
|
||||
let localId = this.getAppLocalIdByManifestURL(manifestURL);
|
||||
|
||||
// For packaged apps, we need to get the id from the manifestURL.
|
||||
if (localId && !id) {
|
||||
id = this._appIdForManifestURL(manifestURL);
|
||||
}
|
||||
let id = this._appIdForManifestURL(app.manifestURL);
|
||||
let localId = this.getAppLocalIdByManifestURL(app.manifestURL);
|
||||
|
||||
// Installing an application again is considered as an update.
|
||||
if (id) {
|
||||
@ -2137,14 +2129,6 @@ this.DOMApplicationRegistry = {
|
||||
return id;
|
||||
},
|
||||
|
||||
_appId: function(aURI) {
|
||||
for (let id in this.webapps) {
|
||||
if (this.webapps[id].origin == aURI)
|
||||
return id;
|
||||
}
|
||||
return null;
|
||||
},
|
||||
|
||||
_appIdForManifestURL: function(aURI) {
|
||||
for (let id in this.webapps) {
|
||||
if (this.webapps[id].manifestURL == aURI)
|
||||
@ -2936,11 +2920,11 @@ this.DOMApplicationRegistry = {
|
||||
}).bind(this));
|
||||
},
|
||||
|
||||
getManifestFor: function(aOrigin, aCallback) {
|
||||
getManifestFor: function(aManifestURL, aCallback) {
|
||||
if (!aCallback)
|
||||
return;
|
||||
|
||||
let id = this._appId(aOrigin);
|
||||
let id = this._appIdForManifestURL(aManifestURL);
|
||||
let app = this.webapps[id];
|
||||
if (!id || (app.installState == "pending" && !app.retryingDownload)) {
|
||||
aCallback(null);
|
||||
|
@ -6750,7 +6750,7 @@ var WebappsUI = {
|
||||
break;
|
||||
case "webapps-sync-install":
|
||||
// Create a system notification allowing the user to launch the app
|
||||
DOMApplicationRegistry.getManifestFor(data.origin, (function(aManifest) {
|
||||
DOMApplicationRegistry.getManifestFor(data.manifestURL, (function(aManifest) {
|
||||
if (!aManifest)
|
||||
return;
|
||||
let manifest = new ManifestHelper(aManifest, data.origin);
|
||||
|
Loading…
Reference in New Issue
Block a user