From d876f32e5d1eb88fe6ab130291b655629cab139d Mon Sep 17 00:00:00 2001 From: Aliaksandr Kalenik Date: Wed, 17 Apr 2024 12:26:25 +0200 Subject: [PATCH] LibWeb: Skip creating a navigable for not connected to document Navigation should not run for element until it is inserted into a document. Spec deoes not seem to explicitely say that, but that matches other browsers behavior. Fixes hanging after reloading in Acid3 test. --- ...t-navigating-object-without-a-document.txt | 1 + ...-navigating-object-without-a-document.html | 19 +++++++++++++++++++ .../LibWeb/HTML/HTMLObjectElement.cpp | 2 +- 3 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 Tests/LibWeb/Text/expected/navigation/attempt-navigating-object-without-a-document.txt create mode 100644 Tests/LibWeb/Text/input/navigation/attempt-navigating-object-without-a-document.html diff --git a/Tests/LibWeb/Text/expected/navigation/attempt-navigating-object-without-a-document.txt b/Tests/LibWeb/Text/expected/navigation/attempt-navigating-object-without-a-document.txt new file mode 100644 index 00000000000..5df6241a8b5 --- /dev/null +++ b/Tests/LibWeb/Text/expected/navigation/attempt-navigating-object-without-a-document.txt @@ -0,0 +1 @@ + PASS diff --git a/Tests/LibWeb/Text/input/navigation/attempt-navigating-object-without-a-document.html b/Tests/LibWeb/Text/input/navigation/attempt-navigating-object-without-a-document.html new file mode 100644 index 00000000000..0a3d5fb0c8f --- /dev/null +++ b/Tests/LibWeb/Text/input/navigation/attempt-navigating-object-without-a-document.html @@ -0,0 +1,19 @@ + + + + diff --git a/Userland/Libraries/LibWeb/HTML/HTMLObjectElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLObjectElement.cpp index 61658c9d396..c20f01822a0 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLObjectElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLObjectElement.cpp @@ -258,7 +258,7 @@ void HTMLObjectElement::run_object_representation_handler_steps(Optionalis_xml() || !mime_type->is_image())) { // If the object element's content navigable is null, then create a new child navigable for the element. - if (!m_content_navigable) { + if (!m_content_navigable && in_a_document_tree()) { MUST(create_new_child_navigable()); set_content_navigable_initialized(); }