Repository navigation
expose: don't freeze the caller when an argument fails to deserialize - #699
Open
rootkiller6788 wants to merge 2 commits into
Open
rootkiller6788 wants to merge 2 commits into
rootkiller6788 wants to merge 2 commits into
Conversation
The argumentList was deserialized before the try block, so if that threw the exception escaped the message listener: no reply went back and the caller's promise never settled. Move it inside the try so the error is reported like any other failure. While at it, fromWireValue() now says which transfer handler name is missing instead of dying on undefined.deserialize.
Sends the same message shape Comlink.wrap() produces, but with the argument tagged with a transfer handler the endpoint never registered. Without the previous commit this test hangs (the listener throws), with it the endpoint answers with a thrown error.
rootkiller6788
marked this pull request as ready for review
October 7, 2026 04:31
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.
The exposed endpoint throws out of its own message listener when it can't deserialize an argument. Nothing goes back over the wire, so the caller's promise just hangs forever with no error. The easy way to hit this is registering a transfer handler on one side only (page but not worker) and passing a value that uses it.
argumentList was built before the try block, so moving it inside is all it takes to turn that into a normal error reply. I also made fromWireValue say which handler name it's missing instead of the TypeError from undefined.deserialize, which is what you'd otherwise see.
The test in tests/node/main.mjs posts the same message shape wrap() produces, but with a handler name the endpoint never registered, and checks that it answers with a thrown error. Without the fix it times out.