bug 1333514 - fix race between PDocAccessibleConstructor messages and PBrowser::Destroy messages r=billm

This commit is contained in:
Trevor Saunders 2017-01-25 16:44:09 -05:00
Родитель 1c87f99407
Коммит 5e44465e8d
2 изменённых файлов: 20 добавлений и 0 удалений

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

@ -46,6 +46,18 @@ public:
bool IsShutdown() const { return mShutdown; }
/**
* Mark this actor as shutdown without doing any cleanup. This should only
* be called on actors that have just been initialized, so probably only from
* RecvPDocAccessibleConstructor.
*/
void MarkAsShutdown()
{
MOZ_ASSERT(mChildDocs.IsEmpty());
MOZ_ASSERT(mAccessibles.Count() == 0);
mShutdown = true;
}
/*
* Called when a message from a document in a child process notifies the main
* process it is firing an event.

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

@ -917,6 +917,14 @@ TabParent::RecvPDocAccessibleConstructor(PDocAccessibleParent* aDoc,
{
#ifdef ACCESSIBILITY
auto doc = static_cast<a11y::DocAccessibleParent*>(aDoc);
// 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.
if (mIsDestroyed) {
doc->MarkAsShutdown();
return IPC_OK();
}
if (aParentDoc) {
// A document should never directly be the parent of another document.
// There should always be an outer doc accessible child of the outer