-
Notifications
You must be signed in to change notification settings - Fork 1.2k
chore: Replace transfer arrays with sets in ipfs-message-port-* #3481
Conversation
0c89691
to
be27edc
Compare
Thanks @icidasset for tackling the problem. I'll respond to some of your comments inline below:
I would really like this fixed, but I can't shake the feeling that proposed changes
I really think we should at least figure out what causes this issue. I'll provide some specific suggestions on this in the #3480
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@icidasset I'm happy to take changes that switch from arrays to sets, however we need to figure out proper fix for #3480 as dropping such array buffers do not really fix the problem they'll just push it further down the stack.
be27edc
to
72e0fb6
Compare
72e0fb6
to
d405cf1
Compare
@Gozala Do we still want this tiny PR that sends a |
@icidasset thanks for starting this effort, I have taken on your work to create #3573 which removes transferable arrays everywhere and just makes them sets. I would push changes here, but github won't allow because PR is from your fork. So I'll close this in favor of the other one. |
Fixes Arraybuffer at index 0 is already detached #3480As described in the issue, I wasn't sure how to tackle this, but I decided to go the "remove already detached buffers" route. This seems to work, I tested this with my app (see issue for more info). Thoughts?
Instead of passing of an Array to
postMessage
, we can just pass the Set iterable.The only downside of this seems to be that Typescript doesn't like this 🤔
Typescript expects an Array, not an iterable like it should.
I just discovered there's a thing calledSharedArrayBuffer
, maybe we should use that instead? 🤔https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/SharedArrayBuffer