Repository navigation
fix: initialise MessageEvent instances in place - #6080
Open
blueDaydreaming725 wants to merge 1 commit into
Open
blueDaydreaming725 wants to merge 1 commit into
blueDaydreaming725 wants to merge 1 commit into
Conversation
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.
This relates to...
The legacy MessageEvent initializer: https://html.spec.whatwg.org/multipage/comms.html#dom-messageevent-initmessageevent
Rationale
event.initMessageEvent('new-type', ..., data)currently constructs and returns a different event. Callers using its declaredvoidreturn contract keep the original event, whose type and data never change.Changes
Reuse the existing Web IDL converters to convert arguments in positional order, then use Node's native
initEvent()and update the current MessageEvent's fields. Return undefined. During dispatch, convert the arguments but leave the event unchanged. Copy ports through the existing sequence converter rather than freezing the caller's array.Features
N/A
Bug Fixes
Initialisation now updates the same event. Omitted fields reset to their defaults, and conversion failures leave the event unchanged.
Breaking Changes and Deprecations
Code relying on the previous, non-standard return of a new MessageEvent must use the original instance instead. The declaration already specifies a void return.
Status
Full JavaScript/WPT suites and other Node versions were not run. Base Event initialisation is delegated to Node's existing implementation; this does not change its handling of event flags.
Implemented, tested and reviewed with OpenAI Codex assistance.