Bug 391132 - Crash [@ nsAttrValue::ToString] with input type=image inside label and with display: table-cell r=surkov.alexander a=dsicore

This commit is contained in:
Evan.Yan@Sun.COM 2007-10-14 23:39:57 -07:00
parent fc4481baed
commit 4d050e90bd

View File

@ -1639,6 +1639,14 @@ nsresult nsAccessible::AppendFlatStringFromContentNode(nsIContent *aContent, nsA
nsresult nsAccessible::AppendFlatStringFromSubtree(nsIContent *aContent, nsAString *aFlatString)
{
static nsIContent *startContent = nsnull;
// never run into the same content node, to prevent infinite recursion
if (startContent == aContent) {
return NS_OK;
}
if (!startContent) {
startContent = aContent;
}
nsresult rv = AppendFlatStringFromSubtreeRecurse(aContent, aFlatString);
if (NS_SUCCEEDED(rv) && !aFlatString->IsEmpty()) {
nsAString::const_iterator start, end;
@ -1653,6 +1661,10 @@ nsresult nsAccessible::AppendFlatStringFromSubtree(nsIContent *aContent, nsAStri
aFlatString->Truncate(aFlatString->Length() - spacesToTruncate);
}
if (startContent == aContent) {
// we are leaving the original invoking
startContent = nsnull;
}
return rv;
}