worker: define Symbol.toStringTag on messaging prototypes - #65531
Open
santusht06 wants to merge 1 commit into
Open
worker: define Symbol.toStringTag on messaging prototypes#65531santusht06 wants to merge 1 commit into
santusht06 wants to merge 1 commit into
Conversation
Ensure compliance with the HTML and WebIDL specifications by defining Symbol.toStringTag on MessageChannel.prototype, MessagePort.prototype, and BroadcastChannel.prototype. Fixes: nodejs#65527 Signed-off-by: Santusht kotai <115890693+santusht06@users.noreply.github.com>
santusht06
force-pushed
the
fix-message-channel-string-tag
branch
from
August 25, 2026 12:11
28dc74e to
7e54b9a
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Per the HTML and WebIDL specifications, interface prototypes must define
@@toStringTag(Symbol.toStringTag) with the interface name as a configurable, non-writable, non-enumerable property.In Node.js,
MessageChannel,MessagePort, andBroadcastChannelprototypes lacked explicitSymbol.toStringTagdefinitions. This resulted in incorrect string representations:Object.prototype.toString.call(new MessageChannel())returned[object Object]Object.prototype.toString.call(new MessageChannel().port1)returned[object EventTarget](inherited fromEventTarget.prototype)Object.prototype.toString.call(new BroadcastChannel('foo'))returned[object EventTarget]Changes
[SymbolToStringTag]onMessagePort.prototypewith{ configurable: true, value: 'MessagePort' }.[SymbolToStringTag]onMessageChannel.prototypewith{ configurable: true, value: 'MessageChannel' }.[SymbolToStringTag]onBroadcastChannel.prototypewith{ configurable: true, value: 'BroadcastChannel' }.test/parallel/test-worker-messaging-string-tag.jsto test prototype property descriptors andtoStringtags for instances and globals.test/parallel/test-worker-message-port-inspect-during-init-hook.jsandtest/parallel/test-eventtarget-memoryleakwarning.jsto reflect that inspect / warning output now formats asMessagePortinstead ofMessagePort [EventTarget].Fixes: #65527