From 143fbfe435686e56176b0ea5b2dab8cf1083932a Mon Sep 17 00:00:00 2001 From: Khafra Date: Fri, 20 Sep 2024 00:21:38 -0400 Subject: [PATCH] Revert "fix: fire close on failed WebSocket connection (#3566)" This reverts commit 290e0e1eb87da413da5363d5eec4b0efc83609f7. --- lib/web/websocket/websocket.js | 8 -------- test/websocket/issue-3546.js | 2 +- 2 files changed, 1 insertion(+), 9 deletions(-) diff --git a/lib/web/websocket/websocket.js b/lib/web/websocket/websocket.js index 6263443dde7..7e465f56e99 100644 --- a/lib/web/websocket/websocket.js +++ b/lib/web/websocket/websocket.js @@ -537,14 +537,6 @@ class WebSocket extends EventTarget { message: reason }) } - - if (!this.#parser && !this.#handler.receivedClose) { - fireEvent('close', this, (type, init) => new CloseEvent(type, init), { - wasClean: false, - code: 1006, - reason - }) - } } #onMessage (type, data) { diff --git a/test/websocket/issue-3546.js b/test/websocket/issue-3546.js index 59a7bd0f093..5d328902538 100644 --- a/test/websocket/issue-3546.js +++ b/test/websocket/issue-3546.js @@ -5,7 +5,7 @@ const { WebSocket } = require('../..') const { tspl } = require('@matteo.collina/tspl') test('first error than close event is fired on failed connection', async (t) => { - const { completed, strictEqual } = tspl(t, { plan: 4 }) + const { completed, strictEqual } = tspl(t, { plan: 2 }) const ws = new WebSocket('ws://localhost:1') let orderOfEvents = 0