Bug 797574 - PermissionsInstaller.jsm broken for package apps [r=gwagner]

This commit is contained in:
Fabrice Desré 2012-10-10 14:29:07 -07:00
parent 9328aeb770
commit 75431f5cd4
2 changed files with 25 additions and 6 deletions

View File

@ -414,7 +414,6 @@ let PermissionsInstaller = {
* @returns void
**/
_setPermission: function setPermission(aPerm, aValue, aApp) {
dump("XxXxX setting " + aPerm + " to " + aValue + "\n");
if (aPerm != "storage") {
PermSettings.set(aPerm, aValue, aApp.manifestURL, aApp.origin, false);
return;

View File

@ -708,14 +708,19 @@ let DOMApplicationRegistry = {
} catch(e) { }
// Get the manifest, and set properties.
this.getManifestFor(app.origin, function(aData) {
this.getManifestFor(app.origin, (function(aData) {
app.readyToApplyDownload = false;
this.broadcastMessage("Webapps:PackageEvent",
{ type: "applied",
manifestURL: aApp.manifestURL,
app: app,
manifest: aData });
});
// Update the permissions for this app.
PermissionsInstaller.installPermissions({ manifest: aData,
origin: app.origin,
manifestURL: aApp.manifestURL },
true);
}).bind(this));
},
startOfflineCacheDownload: function startOfflineCacheDownload(aManifest, aApp,
@ -811,6 +816,12 @@ let DOMApplicationRegistry = {
// Preload the appcache if needed.
this.startOfflineCacheDownload(manifest, app);
// Update the permissions for this app.
PermissionsInstaller.installPermissions({ manifest: aManifest,
origin: app.origin,
manifestURL: aData.manifestURL },
true);
}
// First, we download the manifest.
@ -951,9 +962,13 @@ let DOMApplicationRegistry = {
this.webapps[id] = appObject;
PermissionsInstaller.installPermissions(aData.app, isReinstall, (function() {
this.uninstall(aData, aData.mm);
}).bind(this));
// For package apps, the permissions are not in the mini-manifest, so
// don't update the permissions yet.
if (!aData.isPackage) {
PermissionsInstaller.installPermissions(aData.app, isReinstall, (function() {
this.uninstall(aData, aData.mm);
}).bind(this));
}
["installState", "downloadAvailable",
"downloading", "downloadSize", "readyToApplyDownload"].forEach(function(aProp) {
@ -1001,6 +1016,11 @@ let DOMApplicationRegistry = {
app.downloading = false;
app.downloadavailable = false;
DOMApplicationRegistry._saveApps(function() {
// Update the permissions for this app.
PermissionsInstaller.installPermissions({ manifest: aManifest,
origin: appObject.origin,
manifestURL: appObject.manifestURL },
true);
debug("About to fire Webapps:PackageEvent");
DOMApplicationRegistry.broadcastMessage("Webapps:PackageEvent",
{ type: "installed",