From 8b787020a2b17788505426e2a1bd55e33b7e8226 Mon Sep 17 00:00:00 2001 From: Timothy Flynn Date: Thu, 22 May 2025 12:32:30 -0400 Subject: [PATCH] LibWeb: Delay the document load event while re-fetching images We are required to delay the load event while any fetch is ongoing. We currently have a very hacky re-fetch for images to go through the shared resource request infrastructure. We must delay the load event during this re-fetch. This becomes an issue in an upcoming commit to import the acid2 test. --- Libraries/LibWeb/HTML/HTMLObjectElement.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Libraries/LibWeb/HTML/HTMLObjectElement.cpp b/Libraries/LibWeb/HTML/HTMLObjectElement.cpp index ba731fdde99..5d4d275da19 100644 --- a/Libraries/LibWeb/HTML/HTMLObjectElement.cpp +++ b/Libraries/LibWeb/HTML/HTMLObjectElement.cpp @@ -535,13 +535,17 @@ void HTMLObjectElement::load_image() return; } + m_document_load_event_delayer_for_resource_load.empend(document()); + m_resource_request = HTML::SharedResourceRequest::get_or_create(realm(), document().page(), *url); m_resource_request->add_callbacks( [this] { run_object_representation_completed_steps(Representation::Image); + m_document_load_event_delayer_for_resource_load.take_last(); }, [this] { run_object_representation_fallback_steps(); + m_document_load_event_delayer_for_resource_load.take_last(); }); if (m_resource_request->needs_fetching()) {