Skip to content

Commit 20cc784

Browse files
[BFCache][WebSocket] don't dispatch error if websocket is closed in pagehide
https://bugs.webkit.org/show_bug.cgi?id=303619 Reviewed by Alexey Proskuryakov. When the WebSocket is suspending and it was closed, or it is in the middle of closing, it does not need to be closed separately (and dispatch the error event). There is already WPT test for that case. Now the test passes. * LayoutTests/imported/w3c/web-platform-tests/websockets/back-forward-cache-with-open-websocket-connection-and-close-it-in-pagehide.window-expected.txt: * Source/WebCore/Modules/websockets/WebSocket.cpp: (WebCore::WebSocket::suspend): Canonical link: https://commits.webkit.org/304082@main
1 parent 4bdbd3c commit 20cc784

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Source/WebCore/Modules/websockets/WebSocket.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -549,7 +549,7 @@ void WebSocket::contextDestroyed()
549549

550550
void WebSocket::suspend(ReasonForSuspension reason)
551551
{
552-
if (!m_channel)
552+
if (!m_channel || m_state == CLOSING || m_state == CLOSED)
553553
return;
554554

555555
if (reason == ReasonForSuspension::BackForwardCache) {

0 commit comments

Comments
 (0)