Repository navigation
Conversation
Move the toStringTag of CustomEvent, ErrorEvent, MessageEvent, ProgressEvent, PromiseRejectionEvent and Worker from an own instance field to a non-writable, non-enumerable property of the prototype, and add the missing tag to BroadcastChannel, CloseEvent, EventSource and Navigator, as required by Web IDL. Refs denoland#37107 Generated-by: Grok Bot (AI coding assistant)
Author
|
@bartlomieju gentle ping — |
NetOpWibby
pushed a commit
to theende/ende
that referenced
this pull request
Nov 7, 2026
Move the toStringTag of CustomEvent, ErrorEvent, MessageEvent, ProgressEvent, PromiseRejectionEvent and Worker from an own instance field to a non-writable, non-enumerable property of the prototype, and add the missing tag to BroadcastChannel, CloseEvent, EventSource and Navigator, as required by Web IDL. Ende change: drop the TODOs that referred to the removed instance fields. This fixes part of denoland/deno#37107: the canvas, image, WebGPU, WorkerNavigator and Storage interfaces still have no tag. (cherry picked from commit eff3c8bdde8bf6a5afe2d0c07d53d7e16b7e9be9) Upstream: denoland/deno#37125
This branch has not been deployed
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.
Refs #37107
Web IDL puts
Symbol.toStringTagon the interface prototype (non-writable, non-enumerable, configurable). This handles the JS-implemented interfaces from the issue:CustomEvent,ErrorEvent,MessageEvent,ProgressEvent,PromiseRejectionEventandWorkerdeclared the tag as a class field, so every instance got an own writable/enumerable property and subclasses couldn't override it with a getter. These now define it on the prototype, the same way fix(web): support Event subclasses with readonly toStringTag #35920 did forEvent.BroadcastChannel,CloseEvent,EventSourceandNavigatorhad no tag at all, so they now get one.Not covered here: the Rust-backed interfaces (
ImageBitmap,OffscreenCanvas,ImageBitmapRenderingContext,Storage,NavigatorUAData) and WebGPU. Those live in different places and seem better as follow-ups, so this PR only references the issue and doesn't close it.Added
interfacePrototypesHaveToStringTagtotests/unit/event_test.ts. It checks the descriptor on each prototype, that instances no longer have an own tag, and that a subclass getter wins.tests/unit/event_test.ts,event_target_test.ts,broadcast_channel_test.tsandglobals_test.tspass locally.dprint checkon the changed files is clean.AI disclosure: this PR was written with help from an AI coding assistant. I tested it with the issue's repro and the unit tests above. I've also reviewed the changes myself.