Skip to content

Commit 1581aa5

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 f5892cd commit 1581aa5

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
@@ -503,7 +503,7 @@ void WebSocket::contextDestroyed()
503503

504504
void WebSocket::suspend(ReasonForSuspension reason)
505505
{
506-
if (!m_channel)
506+
if (!m_channel || m_state == CLOSING || m_state == CLOSED)
507507
return;
508508

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

0 commit comments

Comments
 (0)