diff options
author | Leo Kettmeir <crowlkats@toaxl.com> | 2021-12-20 11:36:46 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-12-20 11:36:46 +0100 |
commit | ef95d7b1e973ca544af3f96876c3c224bca6ab32 (patch) | |
tree | 94d5dff3483d64154283358aede397adb14f28c2 /ext/websocket/02_websocketstream.js | |
parent | 0888ba7a8db33ee01f57679308e7e8c4eea108e9 (diff) |
fix(ext/websocket): WebSocketStream don't error with "sending after closing" when closing (#13134)
Diffstat (limited to 'ext/websocket/02_websocketstream.js')
-rw-r--r-- | ext/websocket/02_websocketstream.js | 25 |
1 files changed, 2 insertions, 23 deletions
diff --git a/ext/websocket/02_websocketstream.js b/ext/websocket/02_websocketstream.js index dba22d557..8b032d1c2 100644 --- a/ext/websocket/02_websocketstream.js +++ b/ext/websocket/02_websocketstream.js @@ -60,7 +60,6 @@ const _url = Symbol("[[url]]"); const _connection = Symbol("[[connection]]"); const _closed = Symbol("[[closed]]"); - const _closing = Symbol("[[closing]]"); const _earlyClose = Symbol("[[earlyClose]]"); class WebSocketStream { [_rid]; @@ -260,26 +259,8 @@ } case "closed": case "close": { - if (this[_closing]) { - this[_closed].resolve(value); - core.tryClose(this[_rid]); - } else { - PromisePrototypeThen( - core.opAsync("op_ws_close", { - rid: this[_rid], - ...value, - }), - () => { - this[_closed].resolve(value); - core.tryClose(this[_rid]); - }, - (err) => { - this[_closed].reject(err); - controller.error(err); - core.tryClose(this[_rid]); - }, - ); - } + this[_closed].resolve(value); + core.tryClose(this[_rid]); break; } case "error": { @@ -330,7 +311,6 @@ } [_earlyClose] = false; - [_closing] = false; [_closed] = new Deferred(); get closed() { webidl.assertBranded(this, WebSocketStream); @@ -373,7 +353,6 @@ if (this[_connection].state === "pending") { this[_earlyClose] = true; } else if (this[_closed].state === "pending") { - this[_closing] = true; PromisePrototypeCatch( core.opAsync("op_ws_close", { rid: this[_rid], |