From cc806cdf2121878ae4c10b1fd0c4c03b14ba33c7 Mon Sep 17 00:00:00 2001 From: Leo Kettmeir Date: Thu, 12 Jan 2023 13:43:36 +0100 Subject: fix: check if BroadcastChannel is open before sending (#17366) Fixes #16978 --- ext/broadcast_channel/01_broadcast_channel.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'ext') diff --git a/ext/broadcast_channel/01_broadcast_channel.js b/ext/broadcast_channel/01_broadcast_channel.js index cf3b17ac5..59c6b7cef 100644 --- a/ext/broadcast_channel/01_broadcast_channel.js +++ b/ext/broadcast_channel/01_broadcast_channel.js @@ -122,7 +122,11 @@ dispatch(this, this[_name], new Uint8Array(data)); // Send to listeners in other VMs. - defer(() => core.opAsync("op_broadcast_send", rid, this[_name], data)); + defer(() => { + if (!this[_closed]) { + core.opAsync("op_broadcast_send", rid, this[_name], data); + } + }); } close() { -- cgit v1.2.3