Intent to Prototype: FileSystemHandle::remove() method

91 views
Skip to first unread message

Austin Sullivan

unread,
Sep 9, 2022, 7:15:28 PM9/9/22
to blink-dev, Ayu Ishii, Daseul Lee, Joshua Bell

Contact emails

asu...@chromium.org


Explainer

https://github.com/whatwg/fs/pull/9


Summary

Currently, it is not possible to remove a file or directory given its handle. You must obtain the handle of the parent directory and call FileSystemDirectoryHandle::removeEntry().


Introducing a new method, FileSystemHandle::remove(),  enables the common use case where you obtain a file handle from showSaveFilePicker(), but then decide you don't want to save after all, and delete the file.


NOTE: The code for this already landed behind a flag; we're filing this I2P retroactively.



Blink component

Blink>Storage>FileSystem


TAG review

https://github.com/w3ctag/design-reviews/issues/773 


TAG review status

Pending


Risks



Interoperability and Compatibility



Gecko: Positive (https://github.com/WICG/file-system-access/pull/283#issuecomment-1036085470)

WebKit: No signal

Web developers: Positive (https://github.com/WICG/file-system-access/issues/214). Also https://crbug.com/1114923

Other signals:


Ergonomics


This will improve the ergonomics of the API.


Currently, if a file handle is obtained via the showSaveFilePicker() API, the site has no way to remove the file if the user changes their mind and wants the file deleted, leaving the file system in an awkward state. The remove() method fills this gap.



Security


Files and directories will only be removable if the user has explicitly granted read/write access to the handle.


This method will take an exclusive read/write lock to the file. It's possible that the file is locked by another site (e.g. if the site has an open FileSystemWritableFileStream to the file). In this case, the remove() operation will fail with a locking error. The site is aware that the file is locked, but it does not know how or by whom. This is not a concern.



Debuggability

N/A



Will this feature be supported on all six Blink platforms (Windows, Mac, Linux, Chrome OS, Android, and Android WebView)?


No. The File System Access API is not yet supported on Android (tracking bug)


Is this feature fully tested by web-platform-tests?

Yes (link)


Flag name

FileSystemAccessAPIExperimental


Requires code in //chrome?

False


Tracking bug

https://crbug.com/1114923



Link to entry on the Chrome Platform Status

https://chromestatus.com/feature/6318478849998848


This intent message was generated by Chrome Platform Status.


Austin Sullivan

unread,
Sep 9, 2022, 7:37:24 PM9/9/22
to blink-dev, Ayu Ishii, Daseul Lee, Joshua Bell, Ajay Rahatekar, Ben Morss

Ajay Rahatekar

unread,
Sep 15, 2022, 3:02:38 PM9/15/22
to blink-dev

+Ajay Rahatekar
Reply all
Reply to author
Forward
0 new messages