whatwg / fs

File System Standard
https://fs.spec.whatwg.org/
Other
236 stars 19 forks source link

Add a serializable "permission root locator" to a FileSystemHandle #131

Open a-sully opened 1 year ago

a-sully commented 1 year ago

Until now, access checks were tied to a "file system entry". As of #96, a "file system entry" corresponds to an actual file or directory on disk. We need to support access checks on FileSystemHandles which don't correspond to an entry (e.g. the entry has been removed), so the access checks must be tied to something else.

This PR gives each FileSystemHandle a "permission root locator". A newly created child FileSystemHandle will inherit this attribute from its parent (as opposed to its access algorithms), such that if subDir was created from rootDir, subDir.requestPermission() is equivalent to rootDir.requestPermission(). This "permission root locator" is serialized, such that storing a handle in IDB now retains information about where the handle originated from

The new "query access" and one "request access" algorithms are expected to be overridden in https://wicg.github.io/file-system-access/#permissions to handle non-BucketFileSystem use cases.

Fixes #101


Preview | Diff

a-sully commented 1 year ago

cc @mkruisselbrink but he's OOO for a bit so sending over to @annevk for review. Thanks!