Bug 199216 adding domain.com to whitelist doesn't allow popups from *.domain.com to appear

patch by mvl@exedo.nl r=dwitte sr=jag
This commit is contained in:
timeless%mozdev.org 2003-03-26 00:46:32 +00:00
Родитель a98f4c0628
Коммит 17be30a1b5
1 изменённых файлов: 23 добавлений и 14 удалений

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

@ -340,25 +340,34 @@ nsPermissionManager::TestPermission(nsIURI *aURI,
// find host name within list
PRInt32 hostCount = mPermissionList.Count();
for (PRInt32 i = 0; i < hostCount; ++i) {
hostStruct = NS_STATIC_CAST(permission_HostStruct*, mPermissionList.ElementAt(i));
NS_ASSERTION(hostStruct, "corrupt permission list");
PRUint32 offset = 0;
if (hostStruct->host.Equals(hostPort)) {
// search for type in the permission list for this host
PRInt32 typeCount = hostStruct->permissionList.Count();
for (PRInt32 typeIndex = 0; typeIndex < typeCount; ++typeIndex) {
typeStruct = NS_STATIC_CAST(permission_TypeStruct*, hostStruct->permissionList.ElementAt(typeIndex));
NS_ASSERTION(typeStruct, "corrupt permission list");
do {
nsDependentCSubstring hostTail(hostPort, offset, hostPort.Length() - offset);
for (PRInt32 i = 0; i < hostCount; ++i) {
hostStruct = NS_STATIC_CAST(permission_HostStruct*, mPermissionList.ElementAt(i));
NS_ASSERTION(hostStruct, "corrupt permission list");
if (typeStruct->type == aType) {
// type found. Obtain the corresponding permission
*aPermission = typeStruct->permission;
return NS_OK;
if (hostStruct->host.Equals(hostTail)) {
// search for type in the permission list for this host
PRInt32 typeCount = hostStruct->permissionList.Count();
for (PRInt32 typeIndex = 0; typeIndex < typeCount; ++typeIndex) {
typeStruct = NS_STATIC_CAST(permission_TypeStruct*, hostStruct->permissionList.ElementAt(typeIndex));
NS_ASSERTION(typeStruct, "corrupt permission list");
if (typeStruct->type == aType) {
// type found. Obtain the corresponding permission
*aPermission = typeStruct->permission;
return NS_OK;
}
}
}
}
}
offset = hostPort.FindChar('.', offset) + 1;
// XXX Only walk up the domaintree for popups for now
// XXX clean this up. bug 199216.
} while ((offset > 0) && (aType == nsIPermissionManager::POPUP_TYPE));
return NS_OK;
}