RESOLVED DUPLICATE of bug 215485 262531
REGRESSION (Safari 17): `postMessage` doesn't work with `ReadableStream`
https://bugs.webkit.org/show_bug.cgi?id=262531
Summary REGRESSION (Safari 17): `postMessage` doesn't work with `ReadableStream`
Pascal Schilp
Reported 2023-10-03 02:31:48 PDT
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.
Attachments
The error in action and the offending code (651.29 KB, image/png)
2023-10-03 02:31 PDT, Pascal Schilp
no flags
Pascal Schilp
Comment 1 2023-10-03 02:37:30 PDT
Should probably mention it also previously worked in earlier Safari versions
Pascal Schilp
Comment 2 2023-10-03 02:49:43 PDT
Its reproducible via: const stream = new ReadableStream({ start (controller) { controller.close() }, }) structuredClone(stream, { transfer: [stream] })
Radar WebKit Bug Importer
Comment 3 2023-10-03 09:58:24 PDT
youenn fablet
Comment 4 2023-10-03 10:56:14 PDT
(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.
Pascal Schilp
Comment 5 2023-10-03 11:05:45 PDT
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
youenn fablet
Comment 6 2023-10-03 11:16:44 PDT
(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?
Pascal Schilp
Comment 7 2023-10-03 11:23:22 PDT
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
Pascal Schilp
Comment 8 2023-10-03 11:33:04 PDT
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.
youenn fablet
Comment 9 2023-10-03 12:25:41 PDT
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 ***
Note You need to log in before you can comment on or make changes to this bug.