bug 1184217 - make CheckDocTree check the entire document tree not just the subtree r=davidb

This commit is contained in:
Trevor Saunders 2015-08-18 11:45:37 -04:00
Родитель 2d0ba23745
Коммит 971e419e21
2 изменённых файлов: 44 добавлений и 19 удалений

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

@ -439,22 +439,6 @@ DocAccessibleParent::Destroy()
GetAccService()->RemoteDocShutdown(this);
}
bool
DocAccessibleParent::CheckDocTree() const
{
size_t childDocs = mChildDocs.Length();
for (size_t i = 0; i < childDocs; i++) {
if (!mChildDocs[i] || mChildDocs[i]->mParentDoc != this)
return false;
if (!mChildDocs[i]->CheckDocTree()) {
return false;
}
}
return true;
}
xpcAccessibleGeneric*
DocAccessibleParent::GetXPCAccessible(ProxyAccessible* aProxy)
{
@ -464,6 +448,42 @@ DocAccessibleParent::GetXPCAccessible(ProxyAccessible* aProxy)
return doc->GetXPCAccessible(aProxy);
}
bool
DocAccessibleParent::CheckDocTreeInternal() const
{
size_t childDocs = mChildDocs.Length();
for (size_t i = 0; i < childDocs; i++) {
if (!mChildDocs[i] || mChildDocs[i]->mParentDoc != this)
return false;
if (!mChildDocs[i]->CheckDocTreeInternal()) {
return false;
}
}
return true;
}
const DocAccessibleParent*
DocAccessibleParent::CheckTopDoc() const
{
const DocAccessibleParent* doc = this;
while (doc->ParentDoc()) {
doc = doc->ParentDoc();
}
MOZ_DIAGNOSTIC_ASSERT(doc->mTopLevel);
MOZ_DIAGNOSTIC_ASSERT(DocManager::TopLevelRemoteDocs()->Contains(doc));
return doc;
}
bool
DocAccessibleParent::CheckDocTree() const
{
return CheckTopDoc()->CheckDocTreeInternal();
}
#if defined(XP_WIN)
/**
* @param aCOMProxy COM Proxy to the document in the content process.

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

@ -87,9 +87,12 @@ public:
void Destroy();
virtual void ActorDestroy(ActorDestroyReason aWhy) override
{
if (mShutdown) {
return;
}
MOZ_DIAGNOSTIC_ASSERT(CheckDocTree());
if (!mShutdown)
Destroy();
Destroy();
}
/*
@ -177,8 +180,10 @@ private:
uint32_t AddSubtree(ProxyAccessible* aParent,
const nsTArray<AccessibleData>& aNewTree, uint32_t aIdx,
uint32_t aIdxInParent);
MOZ_MUST_USE bool CheckDocTree() const;
xpcAccessibleGeneric* GetXPCAccessible(ProxyAccessible* aProxy);
MOZ_MUST_USE bool CheckDocTree() const;
MOZ_MUST_USE bool CheckDocTreeInternal() const;
const DocAccessibleParent* CheckTopDoc() const;
nsTArray<DocAccessibleParent*> mChildDocs;
DocAccessibleParent* mParentDoc;