Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

worker: handle invalid BroadcastChannel postMessage after close #55206

Merged

Conversation

Nahee-Park
Copy link
Contributor

Align BroadcastChannel behavior with spec by throwing an InvalidStateError when postMessage is called after the channel is closed. This ensures that the BroadcastChannel properly handles closed states and throws the appropriate error for postMessage attempts.

This update addresses expected failures for invalid postMessage after close in WPT.

@nodejs-github-bot
Copy link
Collaborator

Review requested:

  • @nodejs/web-standards

@nodejs-github-bot nodejs-github-bot added needs-ci PRs that need a full CI run. worker Issues and PRs related to Worker support. labels Oct 1, 2024
@Nahee-Park Nahee-Park force-pushed the fix-worker-broadcastchannel branch 2 times, most recently from 15609e9 to 01ff3e2 Compare October 1, 2024 02:37
This update addresses expected failures for invalid postMessage
after close in WPT.
Copy link

codecov bot commented Oct 1, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 88.39%. Comparing base (103b843) to head (f629e53).
Report is 27 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #55206      +/-   ##
==========================================
+ Coverage   88.23%   88.39%   +0.15%     
==========================================
  Files         651      652       +1     
  Lines      183863   186565    +2702     
  Branches    35824    36042     +218     
==========================================
+ Hits       162235   164915    +2680     
+ Misses      14932    14910      -22     
- Partials     6696     6740      +44     
Files with missing lines Coverage Δ
lib/internal/worker/io.js 99.78% <100.00%> (ø)

... and 70 files with indirect coverage changes

@RedYetiDev RedYetiDev added author ready PRs that have at least one approval, no pending requests for changes, and a CI started. request-ci Add this label to start a Jenkins CI on a PR. labels Oct 1, 2024
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Oct 1, 2024
@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot
Copy link
Collaborator

@@ -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.');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

side note: this looks fishy too

@KhafraDev KhafraDev added the commit-queue Add this label to land a pull request using GitHub Actions. label Oct 1, 2024
@nodejs-github-bot nodejs-github-bot removed the commit-queue Add this label to land a pull request using GitHub Actions. label Oct 3, 2024
@nodejs-github-bot nodejs-github-bot merged commit 6b9413e into nodejs:main Oct 3, 2024
61 checks passed
@nodejs-github-bot
Copy link
Collaborator

Landed in 6b9413e

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
author ready PRs that have at least one approval, no pending requests for changes, and a CI started. needs-ci PRs that need a full CI run. worker Issues and PRs related to Worker support.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants