Bug 1497940 - Fix an assertion in XULDocument::AddSubtreeToDocument. r=smaug

We notify the document when appending to a connected shadow root, that assertion
doesn't really hold.
This commit is contained in:
Emilio Cobos Álvarez 2018-10-29 14:26:09 +01:00
Родитель febd07150a
Коммит bb5e809692
1 изменённых файлов: 12 добавлений и 1 удалений

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

@ -607,7 +607,18 @@ XULDocument::AddElementToDocumentPost(Element* aElement)
nsresult
XULDocument::AddSubtreeToDocument(nsIContent* aContent)
{
NS_ASSERTION(aContent->GetUncomposedDoc() == this, "Element not in doc!");
MOZ_ASSERT(aContent->GetComposedDoc() == this, "Element not in doc!");
// If the content is not in the document, it must be in a shadow tree.
//
// The shadow root itself takes care of maintaining the ID tables and such,
// and there's no use case for localization links in shadow trees, or at
// least they don't work in regular HTML documents either as of today so...
if (MOZ_UNLIKELY(!aContent->IsInUncomposedDoc())) {
MOZ_ASSERT(aContent->IsInShadowTree());
return NS_OK;
}
// From here on we only care about elements.
Element* aElement = Element::FromNode(aContent);
if (!aElement) {