mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 13:21:05 +00:00
Bug 1326084 - Unbind accessible child doc before replacing with new one. r=trevor
We need to update mChildDocs on child document removal. This also cleans up some code related to setting a new child doc when one is already set -- we now assert that this cannot happen.
This commit is contained in:
parent
ce9afcdc80
commit
6a3359a108
@ -451,6 +451,11 @@ DocAccessibleParent::AddChildDoc(DocAccessibleParent* aChildDoc,
|
||||
return IPC_FAIL(this, "binding to proxy that can't be a outerDoc!");
|
||||
}
|
||||
|
||||
if (outerDoc->ChildrenCount() == 1) {
|
||||
MOZ_ASSERT(outerDoc->ChildAt(0)->AsDoc());
|
||||
outerDoc->ChildAt(0)->AsDoc()->Unbind();
|
||||
}
|
||||
|
||||
aChildDoc->SetParent(outerDoc);
|
||||
outerDoc->SetChildDoc(aChildDoc);
|
||||
mChildDocs.AppendElement(aChildDoc->mActorID);
|
||||
|
@ -54,15 +54,9 @@ template <class Derived>
|
||||
void
|
||||
ProxyAccessibleBase<Derived>::SetChildDoc(DocAccessibleParent* aChildDoc)
|
||||
{
|
||||
// DocAccessibleParent::AddChildDoc tolerates replacing one document with
|
||||
// another. We must reflect that here.
|
||||
MOZ_ASSERT(aChildDoc);
|
||||
MOZ_ASSERT(mChildren.Length() <= 1);
|
||||
if (mChildren.IsEmpty()) {
|
||||
mChildren.AppendElement(aChildDoc);
|
||||
} else {
|
||||
mChildren.ReplaceElementAt(0, aChildDoc);
|
||||
}
|
||||
MOZ_ASSERT(mChildren.Length() == 0);
|
||||
mChildren.AppendElement(aChildDoc);
|
||||
mOuterDoc = true;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user