From d6b9bd306cd9831251abe5629873a46fb3041e86 Mon Sep 17 00:00:00 2001 From: Luke Wilde Date: Tue, 15 Jul 2025 12:38:24 +0100 Subject: [PATCH] LibWeb: Don't read from MessagePort transport if it's not entangled If the MessagePort is not entangled, then m_transport is null, meaning it's not valid to read from the transport. This fixes the cross-piping streams WPT crash test crashing in the upcoming commit. --- Libraries/LibWeb/HTML/MessagePort.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Libraries/LibWeb/HTML/MessagePort.cpp b/Libraries/LibWeb/HTML/MessagePort.cpp index 9824a8dfcf7..cce0cc7e0ed 100644 --- a/Libraries/LibWeb/HTML/MessagePort.cpp +++ b/Libraries/LibWeb/HTML/MessagePort.cpp @@ -302,6 +302,9 @@ void MessagePort::read_from_transport() { VERIFY(m_enabled); + if (!is_entangled()) + return; + auto schedule_shutdown = m_transport->read_as_many_messages_as_possible_without_blocking([this](auto&& raw_message) { FixedMemoryStream stream { raw_message.bytes.span(), FixedMemoryStream::Mode::ReadOnly }; IPC::Decoder decoder { stream, raw_message.fds };