Created attachment 468042 [details] The error in action and the offending code Using `serviceWorker.postMessage()` in combination with a `ReadableStream` results in: `DataCloneError: The object cannot be cloned.` For more context, refer to this issue: https://github.com/mswjs/msw/issues/1757 This does work in Chrome and Firefox.
Should probably mention it also previously worked in earlier Safari versions
Its reproducible via: const stream = new ReadableStream({ start (controller) { controller.close() }, }) structuredClone(stream, { transfer: [stream] })
<rdar://problem/116407031>
(In reply to Pascal Schilp from comment #1) > Should probably mention it also previously worked in earlier Safari versions I do not think there was support for transferring a stream in earlier Safari versions. We might have tightened our checks, but I do not think this qualifies as a regression.
There's definitely _something_ that has regressed, because the same version of the MSW library I'm using worked on previous versions of Safari, and stopped working on Safari 17
(In reply to Pascal Schilp from comment #5) > There's definitely _something_ that has regressed, because the same version > of the MSW library I'm using worked on previous versions of Safari, and > stopped working on Safari 17 If you still have a Safari 16 at hand, can you chase what exactly changed? Is there some feature detection in MSW for instance? Otherwise, do you have a repro case where this works in Safari 16 but not Safari 17?
It was the same version of the MSW library I was using before and after, it hasnt changed, because we're using a prerelease version that hasnt been updated in several months. I was able to debug it down to this call here: https://user-images.githubusercontent.com/17054057/272213177-8d6688a1-b719-4f64-a81c-0ab9ac45808f.png You can find more information in this github issue: https://github.com/mswjs/msw/issues/1757
Huh... Feel like im going crazy a little bit now, I'm 100% sure I tested our MSW integration on Safari (and all other browsers) to verify it was working everywhere. But now I can also reproduce the same issue I'm seeing on Safari 17 in lower versions of Safari via browserstack. Thats really weird, because im very sure we tested it. Im not sure what happened here. In any case, regression or not, definitely still a bug (-> does work on other browsers, and as far as I can understand specification-speak, it seems like ReadableStreams should be supported here), and it would be good to get this fixed so people can use MSW on Safari.
OK, I'll close it in favour of bug 215485, which is about implementing transferable streams. FWIW, it should be somehow possible to shim transferable streams with a MessagePort transfer. *** This bug has been marked as a duplicate of bug 215485 ***