From 6ac3bf2982f355e42251851654b8f67ee42a8eb1 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Sun, 20 Mar 2022 18:41:03 +0100 Subject: [PATCH] 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. --- Userland/Libraries/LibWeb/HTML/BrowsingContextContainer.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Userland/Libraries/LibWeb/HTML/BrowsingContextContainer.cpp b/Userland/Libraries/LibWeb/HTML/BrowsingContextContainer.cpp index 5de8ae9ead..680499777d 100644 --- a/Userland/Libraries/LibWeb/HTML/BrowsingContextContainer.cpp +++ b/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);