Bug 348007 Firefox will crash if use index = -1 to get top level

accessible
r= aaronleventhal
This commit is contained in:
ginn.chen%sun.com 2006-08-11 06:04:10 +00:00
Родитель b1d2afd6b9
Коммит a9e1bcbff9
2 изменённых файлов: 7 добавлений и 0 удалений

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

@ -850,6 +850,11 @@ getChildCountCB(AtkObject *aAtkObj)
AtkObject *
refChildCB(AtkObject *aAtkObj, gint aChildIndex)
{
// aChildIndex should not be less than zero
if (aChildIndex < 0) {
return nsnull;
}
// XXX Fix this so it is not O(n^2) to walk through the children!
// Either we can cache the last accessed child so that we can just GetNextSibling()
// or we should cache an array of children in each nsAccessible

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

@ -626,6 +626,8 @@ NS_IMETHODIMP nsAppRootAccessible::GetChildAt(PRInt32 aChildNum,
NS_ENSURE_SUCCESS(rv, rv);
if (aChildNum >= NS_STATIC_CAST(PRInt32, count))
return NS_ERROR_INVALID_ARG;
if (aChildNum < 0)
return NS_ERROR_INVALID_ARG;
nsCOMPtr<nsIWeakReference> childWeakRef;
rv = mChildren->QueryElementAt(aChildNum, NS_GET_IID(nsIWeakReference),