LibWeb: Don't crash in BrowsingContextContainer::content_document()

Instead of choking on the VERIFY(document), let's just return null if
there's no active document for now. This is incorrect, but sidesteps
a frequent crash that happens on content with iframes.

I've left a FIXME about removing the hack once it's no longer needed.
This commit is contained in:
Andreas Kling 2022-03-20 18:41:03 +01:00
commit 6ac3bf2982
Notes: sideshowbarker 2024-07-17 17:02:47 +09:00

View file

@ -55,6 +55,10 @@ const DOM::Document* BrowsingContextContainer::content_document() const
// 3. Let document be context's active document.
auto const* document = context.active_document();
//FIXME: This should not be here, as we're expected to have a document at this point.
if (!document)
return nullptr;
VERIFY(document);
VERIFY(m_document);