From a1c57ed79a355fae8601a3f40a10f30831122f8f Mon Sep 17 00:00:00 2001 From: Timothy Flynn Date: Wed, 31 Jul 2024 12:03:40 -0400 Subject: [PATCH] WebContent: Do not create JS consoles for fragment-parsing documents There's no need to go through this setup. --- Userland/Services/WebContent/PageClient.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Userland/Services/WebContent/PageClient.cpp b/Userland/Services/WebContent/PageClient.cpp index 0c87fb3c26d..d961ac1221d 100644 --- a/Userland/Services/WebContent/PageClient.cpp +++ b/Userland/Services/WebContent/PageClient.cpp @@ -342,8 +342,8 @@ void PageClient::page_did_create_new_document(Web::DOM::Document& document) void PageClient::page_did_change_active_document_in_top_level_browsing_context(Web::DOM::Document& document) { - VERIFY(m_console_clients.contains(document)); - m_top_level_document_console_client = *m_console_clients.get(document).value(); + if (auto console_client = m_console_clients.get(document); console_client.has_value()) + m_top_level_document_console_client = *console_client.value(); } void PageClient::page_did_destroy_document(Web::DOM::Document& document) @@ -663,6 +663,9 @@ ErrorOr PageClient::connect_to_webdriver(ByteString const& webdriver_ipc_p void PageClient::initialize_js_console(Web::DOM::Document& document) { + if (document.is_temporary_document_for_fragment_parsing()) + return; + auto& realm = document.realm(); auto console_object = realm.intrinsics().console_object(); auto console_client = heap().allocate_without_realm(console_object->console(), document.realm(), *this);