void DocAccessibleParent::Destroy() { NS_ASSERTION(mChildDocs.IsEmpty(), "why weren't the child docs destroyed already?"); MOZ_ASSERT(!mShutdown); mShutdown = true; uint32_t childDocCount = mChildDocs.Length(); for (uint32_t i = childDocCount - 1; i < childDocCount; i--) mChildDocs[i]->Destroy(); for (auto iter = mAccessibles.Iter(); !iter.Done(); iter.Next()) { MOZ_ASSERT(iter.Get()->mProxy != this); ProxyDestroyed(iter.Get()->mProxy); iter.Remove(); } DocManager::NotifyOfRemoteDocShutdown(this); ProxyDestroyed(this); if (mParentDoc) mParentDoc->RemoveChildDoc(this); else if (IsTopLevel()) GetAccService()->RemoteDocShutdown(this); }
void ProxyAccessible::Shutdown() { MOZ_DIAGNOSTIC_ASSERT(!IsDoc()); NS_ASSERTION(!mOuterDoc, "Why do we still have a child doc?"); xpcAccessibleDocument* xpcDoc = GetAccService()->GetCachedXPCDocument(Document()); if (xpcDoc) { xpcDoc->NotifyOfShutdown(this); } // 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(); 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(); } mChildren.Clear(); ProxyDestroyed(this); mDoc->RemoveAccessible(this); }
void DocAccessibleParent::Destroy() { NS_ASSERTION(mChildDocs.IsEmpty(), "why weren't the child docs destroyed already?"); MOZ_ASSERT(!mShutdown); mShutdown = true; uint32_t childDocCount = mChildDocs.Length(); for (uint32_t i = childDocCount - 1; i < childDocCount; i--) mChildDocs[i]->Destroy(); mAccessibles.EnumerateEntries(ShutdownAccessibles, nullptr); ProxyDestroyed(this); mParentDoc ? mParentDoc->RemoveChildDoc(this) : GetAccService()->RemoteDocShutdown(this); }
void ProxyAccessible::Shutdown() { NS_ASSERTION(!mOuterDoc, "Why do we still have a child doc?"); // 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(); for (uint32_t idx = 0; idx < childCount; idx++) mChildren[idx]->Shutdown(); } else { if (mChildren.Length() != 1) MOZ_CRASH("outer doc doesn't own adoc!"); static_cast<DocAccessibleParent*>(mChildren[0])->Unbind(); } mChildren.Clear(); ProxyDestroyed(this); mDoc->RemoveAccessible(this); }
PLDHashOperator DocAccessibleParent::ShutdownAccessibles(ProxyEntry* entry, void*) { ProxyDestroyed(entry->mProxy); return PL_DHASH_REMOVE; }
void DocAccessibleParent::Destroy() { // If we are already shutdown that is because our containing tab parent is // shutting down in which case we don't need to do anything. if (mShutdown) { return; } mShutdown = true; MOZ_DIAGNOSTIC_ASSERT(LiveDocs().Contains(mActorID)); uint32_t childDocCount = mChildDocs.Length(); for (uint32_t i = 0; i < childDocCount; i++) { for (uint32_t j = i + 1; j < childDocCount; j++) { MOZ_DIAGNOSTIC_ASSERT(mChildDocs[i] != mChildDocs[j]); } } // XXX This indirection through the hash map of live documents shouldn't be // needed, but be paranoid for now. int32_t actorID = mActorID; for (uint32_t i = childDocCount - 1; i < childDocCount; i--) { DocAccessibleParent* thisDoc = LiveDocs().Get(actorID); MOZ_ASSERT(thisDoc); if (!thisDoc) { return; } thisDoc->ChildDocAt(i)->Destroy(); } for (auto iter = mAccessibles.Iter(); !iter.Done(); iter.Next()) { MOZ_ASSERT(iter.Get()->mProxy != this); ProxyDestroyed(iter.Get()->mProxy); iter.Remove(); } DocAccessibleParent* thisDoc = LiveDocs().Get(actorID); MOZ_ASSERT(thisDoc); if (!thisDoc) { return; } // The code above should have already completely cleared these, but to be // extra safe make sure they are cleared here. thisDoc->mAccessibles.Clear(); thisDoc->mChildDocs.Clear(); DocManager::NotifyOfRemoteDocShutdown(thisDoc); thisDoc = LiveDocs().Get(actorID); MOZ_ASSERT(thisDoc); if (!thisDoc) { return; } ProxyDestroyed(thisDoc); thisDoc = LiveDocs().Get(actorID); MOZ_ASSERT(thisDoc); if (!thisDoc) { return; } if (DocAccessibleParent* parentDoc = thisDoc->ParentDoc()) parentDoc->RemoveChildDoc(thisDoc); else if (IsTopLevel()) GetAccService()->RemoteDocShutdown(this); }