bug 1340579 - look up this DocAccessibleParent in live docs instead of using this in DocAccessibleParent::Destroy() r=eeejay

This commit is contained in:
Trevor Saunders 2017-02-23 13:31:06 -05:00
Родитель 5fdd92746a
Коммит 617ef9aa4c
1 изменённых файлов: 28 добавлений и 8 удалений

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

@ -477,8 +477,16 @@ DocAccessibleParent::Destroy()
}
}
for (uint32_t i = childDocCount - 1; i < childDocCount; i--)
ChildDocAt(i)->Destroy();
int32_t actorID = IProtocol::Id();
for (uint32_t i = childDocCount - 1; i < childDocCount; i--) {
DocAccessibleParent* thisDoc = LiveDocs().Get(actorID);
MOZ_ASSERT(thisDoc);
if (!thisDoc) {
break;
}
thisDoc->ChildDocAt(i)->Destroy();
}
for (auto iter = mAccessibles.Iter(); !iter.Done(); iter.Next()) {
MOZ_ASSERT(iter.Get()->mProxy != this);
@ -488,13 +496,25 @@ DocAccessibleParent::Destroy()
// The code above should have already completely cleared these, but to be
// extra safe make sure they are cleared here.
mAccessibles.Clear();
mChildDocs.Clear();
DocAccessibleParent* thisDoc = LiveDocs().Get(actorID);
MOZ_ASSERT(thisDoc);
if (!thisDoc) {
return;
}
DocManager::NotifyOfRemoteDocShutdown(this);
ProxyDestroyed(this);
if (DocAccessibleParent* parentDoc = ParentDoc())
parentDoc->RemoveChildDoc(this);
thisDoc->mAccessibles.Clear();
thisDoc->mChildDocs.Clear();
DocManager::NotifyOfRemoteDocShutdown(thisDoc);
ProxyDestroyed(thisDoc);
thisDoc = LiveDocs().Get(actorID);
MOZ_ASSERT(thisDoc);
if (!thisDoc) {
return;
}
if (DocAccessibleParent* parentDoc = thisDoc->ParentDoc())
parentDoc->RemoveChildDoc(thisDoc);
else if (IsTopLevel())
GetAccService()->RemoteDocShutdown(this);
}