bug 1279984 - avoid invalid proxy OuterDocAccessibles r=davidb

Before binding a child document to an outer doc proxy we need to make sure its
Outer doc proxies are only allowed to have one child which is the document they
own.  So before we bind a proxied document to a proxied outer doc we need to
make sure the outer doc either doesn't have children or has a document we can
unbind.
This commit is contained in:
Trevor Saunders 2016-06-21 09:30:08 -04:00
Родитель 7ae9030d88
Коммит 0843a2a966
1 изменённых файлов: 8 добавлений и 0 удалений

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

@ -370,6 +370,14 @@ DocAccessibleParent::AddChildDoc(DocAccessibleParent* aChildDoc,
ProxyAccessible* outerDoc = e->mProxy;
MOZ_ASSERT(outerDoc);
// OuterDocAccessibles are expected to only have a document as a child.
// However for compatibility we tolerate replacing one document with another
// here.
if (outerDoc->ChildrenCount() > 1 ||
(outerDoc->ChildrenCount() == 1 && !outerDoc->ChildAt(0)->IsDoc())) {
return false;
}
aChildDoc->mParent = outerDoc;
outerDoc->SetChildDoc(aChildDoc);
mChildDocs.AppendElement(aChildDoc);