bug 1326084 - rework ProxyAccessible handling of outer docs

This commit is contained in:
Trevor Saunders 2017-02-07 15:56:55 -05:00
Родитель 3466173cca
Коммит 96fc2fb77a
1 изменённых файлов: 7 добавлений и 9 удалений

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

@ -25,7 +25,6 @@ void
ProxyAccessibleBase<Derived>::Shutdown()
{
MOZ_DIAGNOSTIC_ASSERT(!IsDoc());
NS_ASSERTION(!mOuterDoc, "Why do we still have a child doc?");
xpcAccessibleDocument* xpcDoc =
GetAccService()->GetCachedXPCDocument(Document());
if (xpcDoc) {
@ -34,16 +33,17 @@ ProxyAccessibleBase<Derived>::Shutdown()
// XXX Ideally this wouldn't be necessary, but it seems OuterDoc accessibles
// can be destroyed before the doc they own.
if (!mOuterDoc) {
uint32_t childCount = mChildren.Length();
if (!mOuterDoc) {
for (uint32_t idx = 0; idx < childCount; idx++)
mChildren[idx]->Shutdown();
} else {
if (mChildren.Length() != 1)
MOZ_CRASH("outer doc doesn't own adoc!");
if (childCount > 1) {
MOZ_CRASH("outer doc has too many documents!");
} else if (childCount == 1) {
mChildren[0]->AsDoc()->Unbind();
}
}
mChildren.Clear();
ProxyDestroyed(static_cast<Derived*>(this));
@ -76,9 +76,7 @@ ProxyAccessibleBase<Derived>::ClearChildDoc(DocAccessibleParent* aChildDoc)
// in SetChildDoc(). This could result in two subsequent calls to
// ClearChildDoc() even though mChildren.Length() == 1.
MOZ_ASSERT(mChildren.Length() <= 1);
if (mChildren.RemoveElement(aChildDoc)) {
mOuterDoc = false;
}
mChildren.RemoveElement(aChildDoc);
}
template <class Derived>