Issue #1592 - Part 1a: Prevent crashing if a slot element was selected via DOM Inspector

This commit is contained in:
FranklinDM 2023-03-18 12:44:56 +08:00 committed by roytam1
commit 0232bcdfa4

View file

@ -3839,8 +3839,13 @@ RestyleManager::ComputeAndProcessStyleChange(nsStyleContext* aNewContext,
MOZ_ASSERT(mReframingStyleContexts, "should have rsc");
MOZ_ASSERT(aNewContext->StyleDisplay()->mDisplay == StyleDisplay::Contents);
nsIFrame* frame = GetNearestAncestorFrame(aElement);
MOZ_ASSERT(frame, "display:contents node in map although it's a "
"display:none descendant?");
// Return early if we don't have a frame.
if (!frame) {
NS_ASSERTION(frame,
"display:contents node in map although it's a "
"display:none descendant?");
return;
}
TreeMatchContext treeMatchContext(true,
nsRuleWalker::eRelevantLinkUnvisited,
frame->PresContext()->Document());