NEW248170
Listeners to MessagePort Postmessage() receive ArrayBuffer rather than SharedArrayBuffer
https://bugs.webkit.org/show_bug.cgi?id=248170
Summary Listeners to MessagePort Postmessage() receive ArrayBuffer rather than Shared...
Dan S
Reported 2022-11-21 03:22:22 PST
1. Create a WebWorker that listens for messages using self.onmessage() 2. post the WebWorker a message port from the main thread 3. When the WebWorker receives a message port, listen to messages sent to it with port.OnMessage() 4. from the main thread, post a SharedArrayBuffer on the MessagePort. 5. Upon receiving the posted SharedArrayBuffer, the WebWorker will actually see an ArrayBuffer.. In my application I actually have multiple workers and allow communication between them using SharedArraybuffers that are posted on startup. This all works fine in Chrome, but unfortunately fails because of unwanted SharedArrayBuffer -> ArrayBuffer conversion in Safari.
Attachments
Dan S
Comment 1 2022-11-21 03:32:32 PST
Just realised, I didn't mention that the message port posted from the main thread to the web worker was one of the ports created as part of a new MessageChannel. The main thread then sends SharedArraybuffers using it's port from the MessageChannel and the WebWorker is listening on the port it has been sent.
Radar WebKit Bug Importer
Comment 2 2022-11-28 03:23:20 PST
Note You need to log in before you can comment on or make changes to this bug.