RESOLVED DUPLICATE of bug 256712 282529
FileSystemFileHandle can't be cloned
https://bugs.webkit.org/show_bug.cgi?id=282529
Summary FileSystemFileHandle can't be cloned
Fabian
Reported 2024-11-04 02:31:15 PST
Created attachment 473122 [details] Screenshot showing the behaviour in Safari, Firefox and Chrome. When trying to clone a `FileSystemFileHandle` with `structuredClone` Safari will throw the following error: ``` [Error] DataCloneError: The object can not be cloned. structuredClone Modulcode — young-animated-science.glitch.me:46 Modulcode (young-animated-science.glitch.me:50) ``` See a demo of this behaviour on https://young-animated-science.glitch.me. This works fine in Firefox 131 and Chrome 130. According to the spec https://fs.spec.whatwg.org/#api-filesystemfilehandle `FileSystemFileHandle` is `Serializable` and should therefore work with `structuredClone`. ## Use Case Since Safari only supports writing to OPFS from a Worker I tried to send the file handle as part of the `postMessage`, which failed with the same error since `postMessage` uses the structured clone algorithm to send data to a Worker.
Attachments
Screenshot showing the behaviour in Safari, Firefox and Chrome. (617.08 KB, image/png)
2024-11-04 02:31 PST, Fabian
no flags
Karl Dubost
Comment 1 2024-11-10 22:01:58 PST
Thanks for the report. That looks like a duplicate of Bug 256712 *** This bug has been marked as a duplicate of bug 256712 ***
Note You need to log in before you can comment on or make changes to this bug.