Bug 1091601 - Settings closes down when changing permissions for THA applications r=fabrice

Application kind is used in isExplicitInPermissionsTable for checking
the permissions in the permission table. When calling the function from
PermissionSettings, the app kind wasn't passed so the permission check
failed. This lead to Settings closing down when trying to change the
permissions in "App permissions", due to the assert in receiveMessage
(dom/permission/PermissionSettings.jsm).

---
 dom/permission/PermissionSettings.jsm | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)
This commit is contained in:
Fredrik Lanker 2014-10-30 15:02:51 -07:00
parent 9c52f2fd7d
commit 3b6fcf7645

View File

@ -35,7 +35,7 @@ this.PermissionSettingsModule = {
},
_isChangeAllowed: function(aPrincipal, aPermName, aAction) {
_isChangeAllowed: function(aPrincipal, aPermName, aAction, aAppKind) {
// Bug 812289:
// Change is allowed from a child process when all of the following
// conditions stand true:
@ -50,7 +50,7 @@ this.PermissionSettingsModule = {
// on permissionManager also but we currently don't.
let perm =
Services.perms.testExactPermissionFromPrincipal(aPrincipal,aPermName);
let isExplicit = isExplicitInPermissionsTable(aPermName, aPrincipal.appStatus);
let isExplicit = isExplicitInPermissionsTable(aPermName, aPrincipal.appStatus, aAppKind);
return (aAction === "unknown" &&
aPrincipal.appStatus === Ci.nsIPrincipal.APP_STATUS_NOT_INSTALLED) ||
@ -68,8 +68,8 @@ this.PermissionSettingsModule = {
_internalAddPermission: function _internalAddPermission(aData, aAllowAllChanges, aCallbacks) {
let uri = Services.io.newURI(aData.origin, null, null);
let appID = appsService.getAppLocalIdByManifestURL(aData.manifestURL);
let principal = Services.scriptSecurityManager.getAppCodebasePrincipal(uri, appID, aData.browserFlag);
let app = appsService.getAppByManifestURL(aData.manifestURL);
let principal = Services.scriptSecurityManager.getAppCodebasePrincipal(uri, app.localId, aData.browserFlag);
let action;
switch (aData.value)
@ -92,12 +92,12 @@ this.PermissionSettingsModule = {
}
if (aAllowAllChanges ||
this._isChangeAllowed(principal, aData.type, aData.value)) {
debug("add: " + aData.origin + " " + appID + " " + action);
this._isChangeAllowed(principal, aData.type, aData.value, app.kind)) {
debug("add: " + aData.origin + " " + app.localId + " " + action);
Services.perms.addFromPrincipal(principal, aData.type, action);
return true;
} else {
debug("add Failure: " + aData.origin + " " + appID + " " + action);
debug("add Failure: " + aData.origin + " " + app.localId + " " + action);
return false; // This isn't currently used, see comment on setPermission
}
},