bug 1339472 - keep a map from DocAccessibleParents to the actors themselves r=yzen

This commit is contained in:
Trevor Saunders 2017-02-07 15:50:52 -05:00
parent f85117da36
commit 9f62f9a5c1
2 changed files with 14 additions and 0 deletions

View File

@ -36,6 +36,7 @@ public:
{ MOZ_COUNT_CTOR_INHERITED(DocAccessibleParent, ProxyAccessible); }
~DocAccessibleParent()
{
LiveDocs().Remove(IProtocol::Id());
MOZ_COUNT_DTOR_INHERITED(DocAccessibleParent, ProxyAccessible);
MOZ_ASSERT(mChildDocs.Length() == 0);
MOZ_ASSERT(!ParentDoc());
@ -58,6 +59,11 @@ public:
mShutdown = true;
}
/**
* Add this document to the set of tracked documents.
*/
void AddToMap() { LiveDocs().Put(IProtocol::Id(), this); }
/*
* Called when a message from a document in a child process notifies the main
* process it is firing an event.
@ -222,6 +228,13 @@ private:
nsTHashtable<ProxyEntry> mAccessibles;
bool mTopLevel;
bool mShutdown;
static nsDataHashtable<nsUint64HashKey, DocAccessibleParent*>&
LiveDocs()
{
static nsDataHashtable<nsUint64HashKey, DocAccessibleParent*> sLiveDocs;
return sLiveDocs;
}
};
}

View File

@ -917,6 +917,7 @@ TabParent::RecvPDocAccessibleConstructor(PDocAccessibleParent* aDoc,
{
#ifdef ACCESSIBILITY
auto doc = static_cast<a11y::DocAccessibleParent*>(aDoc);
doc->AddToMap();
// If this tab is already shutting down just mark the new actor as shutdown
// and ignore it. When the tab actor is destroyed it will be too.