Bug 681905 - Crash [@ nsDocAccessible::ProcessContentInserted], r=davidb

This commit is contained in:
Alexander Surkov 2011-09-01 16:12:51 +09:00
parent 454171e4fa
commit a148241548
2 changed files with 11 additions and 10 deletions

View File

@ -681,10 +681,15 @@ NotificationController::TextEnumerator(nsCOMPtrHashKey<nsIContent>* aEntry,
tag.get(), id.get(), index);
#endif
// Make sure the text node is in accessible document still.
nsAccessible* container = document->GetAccessibleOrContainer(containerNode);
nsTArray<nsCOMPtr<nsIContent> > insertedContents;
insertedContents.AppendElement(textNode);
document->ProcessContentInserted(container, &insertedContents);
NS_ASSERTION(container,
"Text node having rendered text hasn't accessible document!");
if (container) {
nsTArray<nsCOMPtr<nsIContent> > insertedContents;
insertedContents.AppendElement(textNode);
document->ProcessContentInserted(container, &insertedContents);
}
}
return PL_DHASH_NEXT;

View File

@ -1417,11 +1417,9 @@ nsDocAccessible::RecreateAccessible(nsIContent* aContent)
// coalescence with normal hide and show events. Note, in this case they
// should be coalesced with normal show/hide events.
// Check if the node is in DOM still.
nsIContent* parentContent = aContent->GetParent();
if (parentContent && parentContent->IsInDoc()) {
nsAccessible* container = GetAccessibleOrContainer(parentContent);
// Check if the node is in accessible document.
nsAccessible* container = GetContainerAccessible(aContent);
if (container) {
// Remove and reinsert.
UpdateTree(container, aContent, false);
container->UpdateChildren();
@ -1440,8 +1438,6 @@ nsDocAccessible::ProcessInvalidationList()
nsAccessible* accessible = GetAccessible(content);
if (!accessible) {
nsAccessible* container = GetContainerAccessible(content);
NS_ASSERTION(container,
"Got a referenced element that is not in document!");
if (container) {
container->UpdateChildren();
accessible = GetAccessible(content);