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

fix(runtime): early binding to dispatchEvent in workers #10904

Merged
merged 1 commit into from Jun 9, 2021

Conversation

kitsonk
Copy link
Contributor

@kitsonk kitsonk commented Jun 9, 2021

I was working with workers and realised that if your overwrite dispatchEvent in the global scope, messages do not get sent to event listeners of "message" any longer. This is because the runtime binds to the global dispatchEvent every time it tries to dispatch a message.

I checked that in browsers, if you override dispatchEvent in a worker, messages still get sent to the event listeners, and so I have amended the runtime to bind early to the global dispatchEvent and this ensures the behaviour works as expected.

@kitsonk kitsonk requested a review from bartlomieju June 9, 2021 00:45
@kitsonk
Copy link
Contributor Author

kitsonk commented Jun 9, 2021

I haven't checked if this is covered by the WPT, so I added an integration test. Ref #10903.

Copy link
Member

@bartlomieju bartlomieju left a comment

Choose a reason for hiding this comment

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

LGTM, nice catch

@kitsonk kitsonk merged commit e779ea9 into denoland:main Jun 9, 2021
@kitsonk kitsonk deleted the fix_worker_dispatchevent branch June 9, 2021 12:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants