Sfoglia il codice sorgente

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.
Andreas Kling 3 anni fa
parent
commit
6ac3bf2982

+ 4 - 0
Userland/Libraries/LibWeb/HTML/BrowsingContextContainer.cpp

@@ -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);