From 76a97d88635de5ad9a86ecb9c52413e32e0244c4 Mon Sep 17 00:00:00 2001 From: Aliaksandr Kalenik Date: Thu, 7 Sep 2023 01:12:52 +0200 Subject: [PATCH] LibWeb: Update Document::completely_finish_loading() to use navigables --- Userland/Libraries/LibWeb/DOM/Document.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Userland/Libraries/LibWeb/DOM/Document.cpp b/Userland/Libraries/LibWeb/DOM/Document.cpp index 303ac4fd4d..0b68ba0e0d 100644 --- a/Userland/Libraries/LibWeb/DOM/Document.cpp +++ b/Userland/Libraries/LibWeb/DOM/Document.cpp @@ -1932,6 +1932,9 @@ bool Document::is_completely_loaded() const // https://html.spec.whatwg.org/multipage/browsing-the-web.html#completely-finish-loading void Document::completely_finish_loading() { + if (!navigable()) + return; + // 1. Assert: document's browsing context is non-null. VERIFY(browsing_context()); @@ -1943,7 +1946,10 @@ void Document::completely_finish_loading() m_active_refresh_timer->start(); // 3. Let container be document's browsing context's container. - auto container = JS::make_handle(browsing_context()->container()); + if (!navigable()->container()) + return; + + auto container = JS::make_handle(navigable()->container()); // 4. If container is an iframe element, then queue an element task on the DOM manipulation task source given container to run the iframe load event steps given container. if (container && is(*container)) {