[Webkit-unassigned] [Bug 282529] New: FileSystemFileHandle can't be cloned

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Mon Nov 4 02:31:15 PST 2024


https://bugs.webkit.org/show_bug.cgi?id=282529

            Bug ID: 282529
           Summary: FileSystemFileHandle can't be cloned
           Product: WebKit
           Version: Safari 18
          Hardware: Mac (Apple Silicon)
               URL: https://young-animated-science.glitch.me
                OS: macOS 15
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: Website Storage
          Assignee: webkit-unassigned at lists.webkit.org
          Reporter: me at fbn.social
                CC: sihui_liu at apple.com

Created attachment 473122

  --> https://bugs.webkit.org/attachment.cgi?id=473122&action=review

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.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20241104/549a2bb7/attachment.htm>


More information about the webkit-unassigned mailing list