-
Notifications
You must be signed in to change notification settings - Fork 1.2k
ipfs-message-port-* should ensure no transferables are duplicated #3402
Comments
It should be fairly straight forward to fix this problem by switching from array of transferables to a set. Spec is bit vague about what transfer list should be https://html.spec.whatwg.org/multipage/web-messaging.html#dom-postmessageoptions-transfer (array or any iterable), but quick check on Firefox and Chrome suggest it works as expected. |
js-ipfs/packages/ipfs-message-port-server/src/server.js Lines 214 to 218 in 530767d
Could it be because we're sending the transfer list twice here? |
I don't believe so.
I don't believe there is an issue with passing js-ipfs/packages/ipfs-message-port-protocol/src/rpc.ts Lines 9 to 11 in 530767d
I do have to admit it does look a bit awkward, but I would consider improving it as a separate endeavor. You could probably easily verify that by changing line 217 to: new Set(value.transfer || []) |
@icidasset since you're looking at it I've assigned it to you 🥺. If you find yourself unable to work on this please drop a message & I'll unassigned. |
I started working on this, but got stuck on a different error. Is it me or does this Uint8Array look weird? It's length is supposedly Here are my changes so far: |
Ok weird, I updated Anyhow, I made a PR to fix the issue at hand: |
That just means that Uint8Array is just view into the larger buffer e.g.: const buffer = new ArrayBuffer(128)
const bytes = new Uint8Array(buffer, 0, 2) |
Here is the few things we need to do before we close this:
|
@Gozala I'll take another look at this. I seem to have missed something which is causing a few occassional errors on Firefox. Will do the Errors:
|
Made a separate issue for the |
Made a PR: #3481 |
Forking #3252 (comment) into separate issue.
Looks like some of our API calls return values that refer to same
ArrayBuffer
, which in turn causes one of the encoder functions https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-protocol/src to add it to the transfer list twice and error onpostMessage
.The text was updated successfully, but these errors were encountered: