Issue #2171 - Skip over shadow nodes that don't have an owning node.

Resolves #2171
This commit is contained in:
Moonchild 2023-03-23 00:29:13 +01:00 committed by roytam1
commit f09d2bba0f

View file

@ -279,6 +279,13 @@ ShadowRoot::InsertSheet(StyleSheet* aSheet,
}
nsINode* sheetOwningNode = SheetAt(i)->GetOwnerNode();
if (!sheetOwningNode) {
// Keep moving; all sheets with a sheetOwner come after all
// sheets without an owning Node
continue;
}
if (nsContentUtils::PositionIsBefore(aLinkingContent, sheetOwningNode)) {
InsertSheetAt(i, *aSheet);
mProtoBinding->InsertStyleSheetAt(i, aSheet);