bug 1120285 - correctly shutdown outer doc accessible proxies r=davidb

This commit is contained in:
Trevor Saunders 2015-01-13 23:42:27 -05:00
parent 60d7115c86
commit e19883e24b
3 changed files with 16 additions and 3 deletions

View File

@ -155,10 +155,12 @@ DocAccessibleParent::ShutdownAccessibles(ProxyEntry* entry, void*)
}
void
DocAccessibleParent::ActorDestroy(ActorDestroyReason aWhy)
DocAccessibleParent::Destroy()
{
MOZ_ASSERT(mChildDocs.IsEmpty(),
"why wheren't the child docs destroyed already?");
MOZ_ASSERT(!mShutdown);
mShutdown = true;
mAccessibles.EnumerateEntries(ShutdownAccessibles, nullptr);
ProxyDestroyed(this);

View File

@ -26,7 +26,7 @@ class DocAccessibleParent : public ProxyAccessible,
{
public:
DocAccessibleParent() :
ProxyAccessible(this), mParentDoc(nullptr)
ProxyAccessible(this), mParentDoc(nullptr), mShutdown(false)
{ MOZ_COUNT_CTOR_INHERITED(DocAccessibleParent, ProxyAccessible); }
~DocAccessibleParent()
{
@ -45,7 +45,12 @@ public:
virtual bool RecvShowEvent(const ShowEventData& aData) MOZ_OVERRIDE;
virtual bool RecvHideEvent(const uint64_t& aRootID) MOZ_OVERRIDE;
virtual void ActorDestroy(ActorDestroyReason aWhy) MOZ_OVERRIDE;
void Destroy();
virtual void ActorDestroy(ActorDestroyReason aWhy) MOZ_OVERRIDE
{
if (!mShutdown)
Destroy();
}
/*
* Return the main processes representation of the parent document (if any)
@ -115,6 +120,7 @@ private:
* proxy object so we can't use a real map.
*/
nsTHashtable<ProxyEntry> mAccessibles;
bool mShutdown;
};
}

View File

@ -23,6 +23,11 @@ ProxyAccessible::Shutdown()
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])->Destroy();
}
mChildren.Clear();