Add support for TypedArrays in IPC. #6572
Merged
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.
Fixes #2104.
When using Buffer shims in your application, such as https://www.npmjs.com/package/buffer, the IPC via remote currently handles TypedArrays (eg. UInt8Array) as objects and fails to transport the values as function params or return values.
This PR will add support for transporting TypedArrays between the renderer and main process. TypedArrays get converted to regular Arrays on the sending side (remote) and to Node.js Buffers on the receiving side (rpc-server).
Read the spec but wasn't sure if I should add a test and where to put it, so there's no test for this change. If you want to test this, I'd be happy to add one if you can advice where to put it.