From 973626d3b36779d45332689da4d01c09db2c17d7 Mon Sep 17 00:00:00 2001 From: Pavel Savara Date: Tue, 8 Aug 2023 17:36:49 +0200 Subject: [PATCH] [browser] don't propagate JS errors in WS abort (#90148) --- src/mono/wasm/runtime/web-socket.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/mono/wasm/runtime/web-socket.ts b/src/mono/wasm/runtime/web-socket.ts index 7d25310..7469d27 100644 --- a/src/mono/wasm/runtime/web-socket.ts +++ b/src/mono/wasm/runtime/web-socket.ts @@ -201,8 +201,12 @@ export function ws_wasm_abort(ws: WebSocketExtension): void { // cleanup the delegate proxy ws[wasm_ws_on_closed]?.dispose(); - // this is different from Managed implementation - ws.close(1000, "Connection was aborted."); + try { + // this is different from Managed implementation + ws.close(1000, "Connection was aborted."); + } catch (error) { + mono_log_warn("WebSocket error while aborting", error); + } } function reject_promises(ws: WebSocketExtension, error: Error) { -- 2.7.4