[webkit-changes] [WebKit/WebKit] 502bfe: Using WebSocket in a WebWorker can cause the entir...
youennf
noreply at github.com
Fri Feb 21 09:37:00 PST 2025
Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 502bfe7b3124549b8c6cb2d2f6b792aa78fc5e71
https://github.com/WebKit/WebKit/commit/502bfe7b3124549b8c6cb2d2f6b792aa78fc5e71
Author: Youenn Fablet <youenn at apple.com>
Date: 2025-02-21 (Fri, 21 Feb 2025)
Changed paths:
M Source/WebCore/Modules/websockets/ThreadableWebSocketChannel.h
M Source/WebCore/Modules/websockets/ThreadableWebSocketChannelClientWrapper.cpp
M Source/WebCore/Modules/websockets/ThreadableWebSocketChannelClientWrapper.h
M Source/WebCore/Modules/websockets/WorkerThreadableWebSocketChannel.cpp
M Source/WebCore/Modules/websockets/WorkerThreadableWebSocketChannel.h
M Source/WebKit/WebProcess/Network/WebSocketChannel.cpp
M Source/WebKit/WebProcess/Network/WebSocketChannel.h
M Source/WebKitLegacy/WebCoreSupport/WebSocketChannel.cpp
M Source/WebKitLegacy/WebCoreSupport/WebSocketChannel.h
Log Message:
-----------
Using WebSocket in a WebWorker can cause the entire Worker to freeze
rdar://145149784
https://bugs.webkit.org/show_bug.cgi?id=287784
Reviewed by Chris Dumez.
WorkerThreadableWebSocketChannel::send was running the worker run loop while waiting for the result of the main thread send operation.
This is not needed and has side effects as JS can be executed within send.
Since this is no longer needed for a long time, we can stop waiting for the main thread result.
We still need to wait for main thread initialize, and we do so with a binary semaphore.
Remove bufferedAmount infrastructure, since this is handled in WebSocket.
Update the code a bit to align with current secuirty rules.
Covered by existing WebSocket worker tests.
* Source/WebCore/Modules/websockets/ThreadableWebSocketChannel.h:
* Source/WebCore/Modules/websockets/ThreadableWebSocketChannelClientWrapper.cpp:
(WebCore::ThreadableWebSocketChannelClientWrapper::ThreadableWebSocketChannelClientWrapper):
(WebCore::ThreadableWebSocketChannelClientWrapper::didCreateWebSocketChannel):
(WebCore::ThreadableWebSocketChannelClientWrapper::processPendingTasks):
(WebCore::ThreadableWebSocketChannelClientWrapper::clearSyncMethodDone): Deleted.
(WebCore::ThreadableWebSocketChannelClientWrapper::setSyncMethodDone): Deleted.
(WebCore::ThreadableWebSocketChannelClientWrapper::syncMethodDone const): Deleted.
(WebCore::ThreadableWebSocketChannelClientWrapper::sendRequestResult const): Deleted.
(WebCore::ThreadableWebSocketChannelClientWrapper::setSendRequestResult): Deleted.
(WebCore::ThreadableWebSocketChannelClientWrapper::bufferedAmount const): Deleted.
(WebCore::ThreadableWebSocketChannelClientWrapper::setBufferedAmount): Deleted.
* Source/WebCore/Modules/websockets/ThreadableWebSocketChannelClientWrapper.h:
* Source/WebCore/Modules/websockets/WorkerThreadableWebSocketChannel.cpp:
(WebCore::WorkerThreadableWebSocketChannel::~WorkerThreadableWebSocketChannel):
(WebCore::WorkerThreadableWebSocketChannel::connect):
(WebCore::WorkerThreadableWebSocketChannel::send):
(WebCore::WorkerThreadableWebSocketChannel::close):
(WebCore::WorkerThreadableWebSocketChannel::fail):
(WebCore::WorkerThreadableWebSocketChannel::disconnect):
(WebCore::WorkerThreadableWebSocketChannel::suspend):
(WebCore::WorkerThreadableWebSocketChannel::resume):
(WebCore::WorkerThreadableWebSocketChannel::Peer::connect):
(WebCore::WorkerThreadableWebSocketChannel::Peer::send):
(WebCore::WorkerThreadableWebSocketChannel::Bridge::mainThreadInitialize):
(WebCore::WorkerThreadableWebSocketChannel::Bridge::initialize):
(WebCore::WorkerThreadableWebSocketChannel::Bridge::send):
(WebCore::WorkerThreadableWebSocketChannel::bufferedAmount const): Deleted.
(WebCore::WorkerThreadableWebSocketChannel::Peer::bufferedAmount): Deleted.
(WebCore::WorkerThreadableWebSocketChannel::Bridge::bufferedAmount): Deleted.
(WebCore::WorkerThreadableWebSocketChannel::Bridge::setMethodNotCompleted): Deleted.
(WebCore::WorkerThreadableWebSocketChannel::Bridge::waitForMethodCompletion): Deleted.
* Source/WebCore/Modules/websockets/WorkerThreadableWebSocketChannel.h:
* Source/WebKit/WebProcess/Network/WebSocketChannel.cpp:
(WebKit::WebSocketChannel::send):
(WebKit::WebSocketChannel::bufferedAmount const): Deleted.
* Source/WebKit/WebProcess/Network/WebSocketChannel.h:
* Source/WebKitLegacy/WebCoreSupport/WebSocketChannel.cpp:
(WebCore::WebSocketChannel::send):
(WebCore::WebSocketChannel::bufferedAmount const): Deleted.
* Source/WebKitLegacy/WebCoreSupport/WebSocketChannel.h:
Canonical link: https://commits.webkit.org/290802@main
To unsubscribe from these emails, change your notification settings at https://github.com/WebKit/WebKit/settings/notifications
More information about the webkit-changes
mailing list