Don't crash when setting a previously deleted cookie permission.

bug 300301, r=dwitte, sr=darin, a=mconnor.
This commit is contained in:
mvl%exedo.nl 2005-07-17 10:10:31 +00:00
Родитель e615e21d5e
Коммит 660a01e085
1 изменённых файлов: 7 добавлений и 0 удалений

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

@ -288,6 +288,13 @@ nsPermissionManager::AddInternal(const nsAFlatCString &aHost,
PRUint32 oldPermission = entry->GetPermission(aTypeIndex); PRUint32 oldPermission = entry->GetPermission(aTypeIndex);
entry->SetPermission(aTypeIndex, aPermission); entry->SetPermission(aTypeIndex, aPermission);
// If no more types are present, remove the entry
// Can happen if this add() is resetting the permission to default.
if (entry->PermissionsAreEmpty()) {
mHostTable.RawRemoveEntry(entry);
--mHostCount;
}
// check whether we are deleting, adding, or changing a permission, // check whether we are deleting, adding, or changing a permission,
// so we can notify observers. this would be neater to do in Add(), // so we can notify observers. this would be neater to do in Add(),
// but we need to do it here because we only know what type of notification // but we need to do it here because we only know what type of notification