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 // find host name within list
PRInt32 hostCount = mPermissionList.Count(); PRInt32 hostCount = mPermissionList.Count();
for (PRInt32 i = 0; i < hostCount; ++i) { PRUint32 offset = 0;
hostStruct = NS_STATIC_CAST(permission_HostStruct*, mPermissionList.ElementAt(i));
NS_ASSERTION(hostStruct, "corrupt permission list");
if (hostStruct->host.Equals(hostPort)) { do {
// search for type in the permission list for this host nsDependentCSubstring hostTail(hostPort, offset, hostPort.Length() - offset);
PRInt32 typeCount = hostStruct->permissionList.Count(); for (PRInt32 i = 0; i < hostCount; ++i) {
for (PRInt32 typeIndex = 0; typeIndex < typeCount; ++typeIndex) { hostStruct = NS_STATIC_CAST(permission_HostStruct*, mPermissionList.ElementAt(i));
typeStruct = NS_STATIC_CAST(permission_TypeStruct*, hostStruct->permissionList.ElementAt(typeIndex)); NS_ASSERTION(hostStruct, "corrupt permission list");
NS_ASSERTION(typeStruct, "corrupt permission list");
if (typeStruct->type == aType) { if (hostStruct->host.Equals(hostTail)) {
// type found. Obtain the corresponding permission // search for type in the permission list for this host
*aPermission = typeStruct->permission; PRInt32 typeCount = hostStruct->permissionList.Count();
return NS_OK; 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; return NS_OK;
} }