From 4a140b740c21d98b099016d353f0d789bf26c6b3 Mon Sep 17 00:00:00 2001 From: Aliaksandr Kalenik Date: Sun, 7 Sep 2025 22:45:14 +0200 Subject: [PATCH] LibWeb: Early return if document doesn't have navigable in container ...navigable shared attribute processing steps. After e095bf3a5f6 https://wpt.live/html/rendering/pixel-length-attributes.html ends up in this function with null navigable, which leads to crash while executing steps. Adding early return in case iframe's document doesn't have a navigable is enough to make the test pass again. This commit doesn't import the WPT test, because it's already imported and we have it disabled since it takes too much time on CI. --- Libraries/LibWeb/HTML/NavigableContainer.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Libraries/LibWeb/HTML/NavigableContainer.cpp b/Libraries/LibWeb/HTML/NavigableContainer.cpp index 13a6157aee4..e7f63581af0 100644 --- a/Libraries/LibWeb/HTML/NavigableContainer.cpp +++ b/Libraries/LibWeb/HTML/NavigableContainer.cpp @@ -197,6 +197,9 @@ HTML::WindowProxy* NavigableContainer::content_window() // https://html.spec.whatwg.org/multipage/iframe-embed-object.html#shared-attribute-processing-steps-for-iframe-and-frame-elements Optional NavigableContainer::shared_attribute_processing_steps_for_iframe_and_frame(InitialInsertion initial_insertion) { + if (!navigable()) + return OptionalNone {}; + // AD-HOC: If the element was added and immediately removed, the content navigable will be null. Don't process the // src attribute any further. if (!m_content_navigable)