Bug 1221542, bug 1221543 - crash in mozilla::a11y::DocAccessible::SeizeChild/PutChildrenBack, r=davidb

This commit is contained in:
Alexander Surkov 2015-11-09 14:47:38 -05:00
parent da296ba925
commit 88114b1385

View File

@ -2072,7 +2072,10 @@ DocAccessible::SeizeChild(Accessible* aNewParent, Accessible* aChild,
int32_t aIdxInParent)
{
Accessible* oldParent = aChild->Parent();
NS_PRECONDITION(oldParent, "No parent?");
if (!oldParent) {
NS_ERROR("No parent? The tree is broken!");
return false;
}
int32_t oldIdxInParent = aChild->IndexInParent();
@ -2160,6 +2163,10 @@ DocAccessible::PutChildrenBack(nsTArray<RefPtr<Accessible> >* aChildren,
// If the child is in the tree then remove it from the owner.
if (child->IsInDocument()) {
Accessible* owner = child->Parent();
if (!owner) {
NS_ERROR("Cannot put the child back. No parent, a broken tree.");
continue;
}
RefPtr<AccReorderEvent> reorderEvent = new AccReorderEvent(owner);
RefPtr<AccMutationEvent> hideEvent =
new AccHideEvent(child, child->GetContent(), false);