SharedArrayBuffers do not get cloned on some messaging APIs
https://bugs.webkit.org/show_bug.cgi?id=238442
Summary SharedArrayBuffers do not get cloned on some messaging APIs
roberto.vidal
Reported 2022-03-28 03:31:51 PDT
Created attachment 455893 [details] reproduction with visible console and Safari version Example repro: https://github.com/jrvidal/message-port-repro/tree/master/clone Working deployment: https://sab-clone.herokuapp.com/ When sending a message containing a `SharedArrayBuffer`, the receiving end sometimes receives a regular, deep copied `ArrayBuffer` instead of a proper clone pointing to the same bytes. In the example provided, it can be consistently reproduced when posting a message through a `MessagePort` or a `BroadcastChannel`.
Attachments
reproduction with visible console and Safari version (379.82 KB, image/png)
2022-03-28 03:31 PDT, roberto.vidal
no flags
Radar WebKit Bug Importer
Comment 1 2022-03-28 06:39:49 PDT
Ahmad Saleem
Comment 2 2022-09-13 15:58:21 PDT
All browsers result: *** Safari 16 on macOS 12.6 *** from worker - SharedArrayBuffer (length 10) from broadcast - ArrayBuffer (length 10) from port - ArrayBuffer (length 10) *** Safari Technology Preview 153 *** from worker - SharedArrayBuffer (length 10) from broadcast - ArrayBuffer (length 10) from port - ArrayBuffer (length 10) *** Chrome Canary 107 *** from worker - SharedArrayBuffer (length 10) from broadcast - null from port - SharedArrayBuffer (length 10) *** Firefox Nightly 106 *** Did not get anything in Console _______ Just wanted to share updated status. Thanks!
Sam Verschueren
Comment 3 2023-03-17 03:16:40 PDT
I've just tested this again in Safari Technology Preview and this seems to be fixed. from worker - SharedArrayBuffer (length 10) from broadcast - SharedArrayBuffer (length 10) from port - SharedArrayBuffer (length 10) However, it's weird that Safari sends the SAB over a broadcast channel while Chrome receives `null`. So maybe that's still a bug.
Yusuke Suzuki
Comment 4 2023-03-17 09:35:32 PDT
(In reply to Sam Verschueren from comment #3) > I've just tested this again in Safari Technology Preview and this seems to > be fixed. > > from worker - SharedArrayBuffer (length 10) > from broadcast - SharedArrayBuffer (length 10) > from port - SharedArrayBuffer (length 10) > > However, it's weird that Safari sends the SAB over a broadcast channel while > Chrome receives `null`. So maybe that's still a bug. Isn't it a Chrome bug? CC @Chris.
Sam Verschueren
Comment 5 2023-03-17 09:38:23 PDT
Yes this might be on Chrome actually. In Firefox it’s also a SharedArrayBuffer. Not sure what the spec says about it, but my assumption is that it should be a SAB instead of null.
Note You need to log in before you can comment on or make changes to this bug.