From 226836c5acf4500c91e938e0b639232ed5b36c4c 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 6f4348f11d2ddb..a7bc2b0d20c2e2 100644 --- a/lib/internal/worker/io.js +++ b/lib/internal/worker/io.js @@ -491,7 +491,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": [