From 6fc19ec059655091e68f95f04c3f873575f81839 Mon Sep 17 00:00:00 2001 From: Tim Ledbetter Date: Wed, 26 Feb 2025 18:30:19 +0000 Subject: [PATCH] LibWeb: Don't close websocket if already closed in `make_disappear()` AO --- Libraries/LibWeb/WebSockets/WebSocket.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Libraries/LibWeb/WebSockets/WebSocket.cpp b/Libraries/LibWeb/WebSockets/WebSocket.cpp index 92335ca9c3e..35258f9bb3c 100644 --- a/Libraries/LibWeb/WebSockets/WebSocket.cpp +++ b/Libraries/LibWeb/WebSockets/WebSocket.cpp @@ -411,6 +411,10 @@ void WebSocket::make_disappear() // -> Otherwise // - Do nothing. // NOTE: All of these are handled by the WebSocket Protocol when calling close() + auto ready_state = this->ready_state(); + if (ready_state == Requests::WebSocket::ReadyState::Closing || ready_state == Requests::WebSocket::ReadyState::Closed) + return; + m_websocket->close(1001); }