aboutsummaryrefslogtreecommitdiff
path: root/src/bun.js/bindings/webcore/JSWebSocket.cpp
diff options
context:
space:
mode:
authorGravatar Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> 2022-08-10 17:40:17 -0700
committerGravatar Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> 2022-08-10 17:40:17 -0700
commitf09e7ac6306726578b5200b7651c2660e093802c (patch)
treeb92d157e8d3f249d30e96f2aaf666e031f38ec6b /src/bun.js/bindings/webcore/JSWebSocket.cpp
parente511b14b2ab08d86dc9c15d41b3c5da2f7d8b751 (diff)
downloadbun-f09e7ac6306726578b5200b7651c2660e093802c.tar.gz
bun-f09e7ac6306726578b5200b7651c2660e093802c.tar.zst
bun-f09e7ac6306726578b5200b7651c2660e093802c.zip
improve reliability of `WebSocket`
- Fix GC not keeping WebSocket alive - Fix ignoring messages sent immediately after upgrade Fixes https://github.com/oven-sh/bun/issues/521
Diffstat (limited to 'src/bun.js/bindings/webcore/JSWebSocket.cpp')
-rw-r--r--src/bun.js/bindings/webcore/JSWebSocket.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/bun.js/bindings/webcore/JSWebSocket.cpp b/src/bun.js/bindings/webcore/JSWebSocket.cpp
index aa351fba3..f140c365d 100644
--- a/src/bun.js/bindings/webcore/JSWebSocket.cpp
+++ b/src/bun.js/bindings/webcore/JSWebSocket.cpp
@@ -633,11 +633,11 @@ bool JSWebSocketOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> hand
{
auto* jsWebSocket = jsCast<JSWebSocket*>(handle.slot()->asCell());
auto& wrapped = jsWebSocket->wrapped();
- // if (!wrapped.isContextStopped() && wrapped.hasPendingActivity()) {
- // if (UNLIKELY(reason))
- // *reason = "ActiveDOMObject with pending activity";
- // return true;
- // }
+ if (wrapped.hasPendingActivity()) {
+ if (UNLIKELY(reason))
+ *reason = "ActiveDOMObject with pending activity";
+ return true;
+ }
if (jsWebSocket->wrapped().isFiringEventListeners()) {
if (UNLIKELY(reason))
*reason = "EventTarget firing event listeners";