From 8df7c26c1f5afd17107790b7ccceb491e26ff641 Mon Sep 17 00:00:00 2001 From: devstone <81923229+Nahee-Park@users.noreply.github.com> Date: Thu, 3 Oct 2024 11:37:34 +0900 Subject: [PATCH] worker: throw InvalidStateError in postMessage after close This update addresses expected failures for invalid postMessage after close in WPT. PR-URL: https://github.com/nodejs/node/pull/55206 Reviewed-By: Mattias Buelens Reviewed-By: Matthew Aitken --- lib/internal/worker/io.js | 2 +- test/wpt/status/webmessaging/broadcastchannel.json | 8 -------- 2 files changed, 1 insertion(+), 9 deletions(-) diff --git a/lib/internal/worker/io.js b/lib/internal/worker/io.js index 3263ddb88194fc..80b39c24033147 100644 --- a/lib/internal/worker/io.js +++ b/lib/internal/worker/io.js @@ -402,7 +402,7 @@ class BroadcastChannel extends EventTarget { if (arguments.length === 0) throw new ERR_MISSING_ARGS('message'); if (this[kHandle] === undefined) - throw new DOMException('BroadcastChannel is closed.'); + throw new DOMException('BroadcastChannel is closed.', 'InvalidStateError'); if (this[kHandle].postMessage(message) === undefined) throw new DOMException('Message could not be posted.'); } diff --git a/test/wpt/status/webmessaging/broadcastchannel.json b/test/wpt/status/webmessaging/broadcastchannel.json index b6ee1b6e0db194..340b9955f33fe3 100644 --- a/test/wpt/status/webmessaging/broadcastchannel.json +++ b/test/wpt/status/webmessaging/broadcastchannel.json @@ -10,14 +10,6 @@ ] } }, - "interface.any.js": { - "fail": { - "expected": [ - "postMessage after close should throw", - "postMessage should throw InvalidStateError after close, even with uncloneable data" - ] - } - }, "origin.window.js": { "fail": { "expected": [