From 96fc2fb77abf93eb69ed7fbe0194613a8c4c3013 Mon Sep 17 00:00:00 2001 From: Trevor Saunders Date: Tue, 7 Feb 2017 15:56:55 -0500 Subject: [PATCH] bug 1326084 - rework ProxyAccessible handling of outer docs --- accessible/ipc/ProxyAccessibleBase.cpp | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/accessible/ipc/ProxyAccessibleBase.cpp b/accessible/ipc/ProxyAccessibleBase.cpp index 8f1a2b7eda2e..64a667f9666d 100644 --- a/accessible/ipc/ProxyAccessibleBase.cpp +++ b/accessible/ipc/ProxyAccessibleBase.cpp @@ -25,7 +25,6 @@ void ProxyAccessibleBase::Shutdown() { MOZ_DIAGNOSTIC_ASSERT(!IsDoc()); - NS_ASSERTION(!mOuterDoc, "Why do we still have a child doc?"); xpcAccessibleDocument* xpcDoc = GetAccService()->GetCachedXPCDocument(Document()); if (xpcDoc) { @@ -34,15 +33,16 @@ ProxyAccessibleBase::Shutdown() // XXX Ideally this wouldn't be necessary, but it seems OuterDoc accessibles // can be destroyed before the doc they own. + uint32_t childCount = mChildren.Length(); if (!mOuterDoc) { - uint32_t childCount = mChildren.Length(); for (uint32_t idx = 0; idx < childCount; idx++) mChildren[idx]->Shutdown(); } else { - if (mChildren.Length() != 1) - MOZ_CRASH("outer doc doesn't own adoc!"); - - mChildren[0]->AsDoc()->Unbind(); + if (childCount > 1) { + MOZ_CRASH("outer doc has too many documents!"); + } else if (childCount == 1) { + mChildren[0]->AsDoc()->Unbind(); + } } mChildren.Clear(); @@ -76,9 +76,7 @@ ProxyAccessibleBase::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