Changeset 270882 in webkit


Ignore:
Timestamp:
Dec 16, 2020, 12:27:01 AM (5 years ago)
Author:
youenn@apple.com
Message:

Make sure WebKit WebSocketChannel handle suspend/resume correctly
https://bugs.webkit.org/show_bug.cgi?id=219910

Reviewed by Alex Christensen.

Source/WebCore:

Covered by http/tests/websocket/tests/hybi/closed-when-entering-page-cache.html
and http/tests/websocket/tests/hybi/stop-on-resume-in-error-handler.html with NSURLSession WebSocket code path enabled.

  • Modules/websockets/WebSocket.cpp:

(WebCore::WebSocket::resume):
In case resume is called and there are some events to dispatch, start the timer
even if the channel is not null.

Source/WebKit:

  • WebProcess/Network/WebSocketChannel.cpp:

(WebKit::WebSocketChannel::fail):
Make sure fail triggers close event if page resumes.

Location:
trunk/Source
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r270881 r270882  
     12020-12-16  Youenn Fablet  <youenn@apple.com>
     2
     3        Make sure WebKit WebSocketChannel handle suspend/resume correctly
     4        https://bugs.webkit.org/show_bug.cgi?id=219910
     5
     6        Reviewed by Alex Christensen.
     7
     8        Covered by http/tests/websocket/tests/hybi/closed-when-entering-page-cache.html
     9        and http/tests/websocket/tests/hybi/stop-on-resume-in-error-handler.html with NSURLSession WebSocket code path enabled.
     10
     11        * Modules/websockets/WebSocket.cpp:
     12        (WebCore::WebSocket::resume):
     13        In case resume is called and there are some events to dispatch, start the timer
     14        even if the channel is not null.
     15
    1162020-12-15  Rob Buis  <rbuis@igalia.com>
    217
  • trunk/Source/WebCore/Modules/websockets/WebSocket.cpp

    r269459 r270882  
    531531    if (m_channel)
    532532        m_channel->resume();
    533     else if (!m_pendingEvents.isEmpty() && !m_resumeTimer.isActive()) {
     533
     534    if (!m_pendingEvents.isEmpty() && !m_resumeTimer.isActive()) {
    534535        // Fire the pending events in a timer as we are not allowed to execute arbitrary JS from resume().
    535536        m_resumeTimer.startOneShot(0_s);
  • trunk/Source/WebKit/ChangeLog

    r270880 r270882  
     12020-12-16  Youenn Fablet  <youenn@apple.com>
     2
     3        Make sure WebKit WebSocketChannel handle suspend/resume correctly
     4        https://bugs.webkit.org/show_bug.cgi?id=219910
     5
     6        Reviewed by Alex Christensen.
     7
     8        * WebProcess/Network/WebSocketChannel.cpp:
     9        (WebKit::WebSocketChannel::fail):
     10        Make sure fail triggers close event if page resumes.
     11
    1122020-12-15  Pablo Saavedra  <psaavedra@igalia.com>
    213
  • trunk/Source/WebKit/WebProcess/Network/WebSocketChannel.cpp

    r270573 r270882  
    221221        m_client->didReceiveMessageError();
    222222
    223     if (!m_isClosing)
    224         MessageSender::send(Messages::NetworkSocketChannel::Close { 0, reason });
     223    if (m_isClosing)
     224        return;
     225
     226    MessageSender::send(Messages::NetworkSocketChannel::Close { 0, reason });
     227    didClose(WebCore::WebSocketChannel::CloseEventCodeAbnormalClosure, { });
    225228}
    226229
Note: See TracChangeset for help on using the changeset viewer.