Personally I wish there would be a meaningful line drawn between the two so that users could have a nice shorthand for allowing web pages to "upgrade" into apps which have access to things like WebGL and filesystem access. Such a thing would only have any meaning to power users and privacy oriented people though, and the general trend in browser design has been to spurn such users in favor of reducing friction for everyone else at all costs.
Javascript isn't the new Java. Web browsers are the new Java.
I would be very much in favor of a way to draw a line between "content" on the web and "apps" delivered by the web. I don't know what form that would take. But it will probably never happen because the FAANGs that run the web these days are actively opposed to any way to deliver content over the web that doesn't also let them include apps to track your activities online.
Personally, even though every new API inevitably gets abused, I don't think we should throw the baby out with the bathwater because there are tons of legitimate uses here. (In fact, I'm currently building something as a side project that would benefit greatly from these file system APIs.) My own worry is about complexity creep—specifically, the number of things I'll be expected to know and keep track of as a frontend engineer in another 10 years. But that's probably just me getting older. :)
> foobar.com wants to access your location. [Block] [Allow]
> foobar.com wants to access your camera and microphone. [Block] [Allow]
> foobar.com wants to send push notifications. [Block] [Allow]
Ideally these prompts are presented above the line of death, and clicking “Block” prevents future prompts, so you can’t get spammed.
Of course users click on these prompts without caring. Of course websites may try to unnecessarily block access if you dont agree. Of course websites make their own obviously fake prompts so you click “block” and then they present the obviously fake prompt again just to waste your time.
But users already download and open random files and grant them admin privileges, and websites already spam you. The current notification system works and extending it to WebGPU and file systems is natural.
Are they, though?
If they were, then tracking users via third-party cookies and other resources wouldn't be possible. Nor would it be possible for a web site in my browser to suddenly start taking up all of my CPU/RAM due to a programming error or malicious site such as a crypto-miner. For the relatively little isolation that does happen, sandbox-escape vulnerabilities seem to be getting discovered all the time.
Also, as a technical user, I want more control over what web sites can do with my computer than a non-technical user might.
The more holes you poke in a sandbox, the worse a sandbox it is.
Probably because there's no way to say that it "doesn't put any of the user's data at risk". WebGL has been abused for browser fingerprinting which itself puts user's privacy at risk, but it also has a long history of very nasty vulnerabilities and exploits. It's been fully disabled in my browser for years because of the security issues.
WebGL is one of the biggest fingerprinting vectors on the modern Web platform, and expands browser attack surface significantly. Most webpages should absolutely not have access to privileges like this.
Hasn't many (if not most?) major expansions of capabilities been behind a permissions prompt, making them not available to every web page by default?
> Note: What is referred to as the "local file system" in this spec, does not have to strictly refer to the file system on the local device.
So basically a browser can implement this using a KV-Database or similar, nothing requires the browser to actually allow you to (file picker) "pick" files in your home directory or similar especially given that:
> Note: While user agents will typically implement this by persisting the contents of this origin private file system to disk, it is not intended that the contents are easily user accessible. Similarly there is no expectation that files or directories with names matching the names of children of the origin private file system exist.
Also
> The origin private file system is a storage endpoint whose identifier is "fileSystem", types are « "local" », and quota is null.
So this "file system" might exist in a complete "parallel universe" to your normal file system.
Also given that this is not a new storage type it means that if you browser is setup to e.g. clear local storage from a specific origin if that origin wasn't used for a month this might still apply.
So have fun with you "files" having disappeared after some longer holidays (e.g. on Safari, at least the way Apple planed to implement it a while ago).
So while it looks like a file system access API, it might end up not being on depending on browser implementation details.
Also any access goes through a file picker and you can't ".."-navigate up this avoid many problems with security, adding in no file links no fancy operations etc. means this should not be a problem even even if it allows access to you files.
Through in the end it depends a lot on the choice the browser does when implementing it.
I think you make a good point about Safari's nonsense with browser data. The spec should require implementors to never clear out what they use for "local file system" unless the user explicitly says to, and only for the files selected for deletion. The old APIs like local storage/IndexedDB unfortunately assumed no browser vendor would be as dumb as Safari with their ridiculously short retention policy.
Through there is `persist` on the storage manager, but I'm not sure how much this helps. Theoretically it could work like fsync or F_FULLSYNC, but practically I'm not sure at all.
The implementation creates other problems for DBs though since you can't really do small writes efficiently. One idea I've had would be to implement a virtual paging system, but then you introduce a new layer of abstraction and it's still going to be really slow on NTFS (since it assumes a few large files, not many small ones).
That's possible today using the browser's existing file-handling APIs. As the author points out, there is a hurdle—and possible annoyance—from the user's perspective, which is that rather than pressing Cmd+S (or whathaveyou) and having that silently "just work" (i.e. as it does any any traditional desktop app), the user is kept in the loop during the entire process, from placement (i.e. which directory to save the file to), to having to explicitly grant the ability to overwrite the existing file if one already exists with that name.* Despite the fact that it's possible, however, few application authors have taken advantage of the opportunity. I don't expect this to change much with file access APIs.
The truth of the matter is that the majority of contemporary web app authors like having the opportunity of being the gatekeepers for the user's data—even when the other party 99% of the time is the user themselves.
What's most likely to happen is that similar numbers of web app authors continue not to use these APIs as we see today, partly because the API is too complicated. Where we will see it used will be instances where the net effect to the user is further loss of control over their data.
I'd be in favor of a drastically simplified API that was narrowly created to address the ergonomics issues of the file overwrite problem, and to encourage browser makers to limit further file access API expansion to applications that are themselves accessed with the `file` URI scheme. That is, rather than navigating to hosted web app and granting it permissions for file access, in addition to saving your data to your local disk, you're given a static copy of the web app, too. You're able to open this from disk and it is this copy to which you are allowed to grant file access permissions. If it's true that developers really do care about these file access APIs for the purpose of enabling users to exercise greater control over their data, then they should have no issue making this concession as a show of good faith.
* A simple workaround to this is to not try to overwrite the original, but instead save a new file that sits beside the old one. The application author can help out here by automatically generating a "tag" included in the suggested file name, so when the system filepicker is called up, the user just presses Enter and is never bothered with the overwrite prompt. Many people end up creating their own ad hoc versioning schemes ("final final final") at some point, anyway, so this constraint—which is on the surface considered more onerous than the status quo for typical desktop apps—can actually lead to a workaround that is much nicer to work with than the status quo. (Food for thought: if we reached a stable equilibrium concerning the conventions on this, OS vendors could bake awareness in somewhere just above the filesystem level and kill of "final final final" completely—and expose all sorts of useful services that would not otherwise be possible with the ad hoc schemes.)