bug 1329814 - fix race condition when shutting down a tab r=smaug

When TabChild recieves the Destroy message from its parent the doc accessibles
for that tab are shut down.  However if the Shutdown message sent by
DocAccessible::Shutdown() isn't recieved before the child process handles the
runnable that sends __delete__ to the tab parent actor the parent can send a
message to the already shut down doc accessible child actor.
This commit is contained in:
Trevor Saunders 2017-01-09 18:55:32 -05:00
parent 054061a872
commit 235c3677ff
2 changed files with 10 additions and 1 deletions

View File

@ -416,9 +416,14 @@ DocAccessibleParent::RecvShutdown()
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;
}
NS_ASSERTION(mChildDocs.IsEmpty(),
"why weren't the child docs destroyed already?");
MOZ_ASSERT(!mShutdown);
mShutdown = true;
uint32_t childDocCount = mChildDocs.Length();

View File

@ -359,6 +359,10 @@ TabParent::DestroyInternal()
RemoveWindowListeners();
if (a11y::DocAccessibleParent* tabDoc = GetTopLevelDocAccessible()) {
tabDoc->Destroy();
}
// If this fails, it's most likely due to a content-process crash,
// and auto-cleanup will kick in. Otherwise, the child side will
// destroy itself and send back __delete__().