Bug 1068635 - [Loop] Not remembering + allow access to the contact list, 2nd time Loop is started -> Crash!. r=baku, sicking

This commit is contained in:
Fernando Jiménez 2014-10-17 15:47:35 +02:00
parent 8e298bf701
commit f59b7b0589
2 changed files with 23 additions and 4 deletions

View File

@ -437,7 +437,8 @@ nsPermissionManager::Init()
// will end up as now()) is fine.
uint64_t modificationTime = 0;
AddInternal(principal, perm.type, perm.capability, 0, perm.expireType,
perm.expireTime, modificationTime, eNotify, eNoDBOperation);
perm.expireTime, modificationTime, eNotify, eNoDBOperation,
true /* ignoreSessionPermissions */);
}
// Stop here; we don't need the DB in the child process
@ -717,7 +718,8 @@ nsPermissionManager::AddInternal(nsIPrincipal* aPrincipal,
int64_t aExpireTime,
int64_t aModificationTime,
NotifyOperationType aNotifyOperation,
DBOperationType aDBOperation)
DBOperationType aDBOperation,
const bool aIgnoreSessionPermissions)
{
nsAutoCString host;
nsresult rv = GetHostForPrincipal(aPrincipal, host);
@ -739,6 +741,12 @@ nsPermissionManager::AddInternal(nsIPrincipal* aPrincipal,
ContentParent::GetAll(cplist);
for (uint32_t i = 0; i < cplist.Length(); ++i) {
ContentParent* cp = cplist[i];
// On platforms where we use a preallocated template process we don't
// want to notify this process about session specific permissions so
// new tabs or apps created on it won't inherit the session permissions.
if (cp->IsPreallocated() &&
aExpireType == nsIPermissionManager::EXPIRE_SESSION)
continue;
if (cp->NeedsPermissionsUpdate())
unused << cp->SendAddPermission(permission);
}
@ -824,6 +832,16 @@ nsPermissionManager::AddInternal(nsIPrincipal* aPrincipal,
id = aID;
}
// When we do the initial addition of the permissions we don't want to
// inherit session specific permissions from other tabs or apps
// so we ignore them and set the permission to PROMPT_ACTION if it was
// previously allowed or denied by the user.
if (aIgnoreSessionPermissions &&
aExpireType == nsIPermissionManager::EXPIRE_SESSION) {
aPermission = nsIPermissionManager::PROMPT_ACTION;
aExpireType = nsIPermissionManager::EXPIRE_NEVER;
}
entry->GetPermissions().AppendElement(PermissionEntry(id, typeIndex, aPermission,
aExpireType, aExpireTime,
aModificationTime));

View File

@ -155,7 +155,7 @@ public:
if (mPermissions[i].mType == aType)
return mPermissions[i];
// unknown permission... return relevant data
// unknown permission... return relevant data
return PermissionEntry(-1, aType, nsIPermissionManager::UNKNOWN_ACTION,
nsIPermissionManager::EXPIRE_NEVER, 0, 0);
}
@ -205,7 +205,8 @@ public:
int64_t aExpireTime,
int64_t aModificationTime,
NotifyOperationType aNotifyOperation,
DBOperationType aDBOperation);
DBOperationType aDBOperation,
const bool aIgnoreSessionPermissions = false);
/**
* Initialize the "webapp-uninstall" observing.