LibWeb: Check for active document in descendant_navigables()

This is not in the spec, but I did see a null pointer dereference here
while browsing the web, and it seems completely harmless for this
function to skip over navigables without an active document.
This commit is contained in:
Andreas Kling 2024-11-01 12:13:46 +01:00
parent aa585c4182
commit 56e1c0e7ee
Notes: github-actions[bot] 2024-11-01 11:28:08 +00:00

View file

@ -3240,7 +3240,11 @@ Vector<JS::Handle<HTML::Navigable>> Document::descendant_navigables()
return TraversalDecision::Continue;
// 2. Extend navigables with navigableContainer's content navigable's active document's inclusive descendant navigables.
navigables.extend(navigable_container.content_navigable()->active_document()->inclusive_descendant_navigables());
auto document = navigable_container.content_navigable()->active_document();
// AD-HOC: If the descendant navigable doesn't have an active document, just skip over it.
if (!document)
return TraversalDecision::Continue;
navigables.extend(document->inclusive_descendant_navigables());
}
return TraversalDecision::Continue;
});