-
Notifications
You must be signed in to change notification settings - Fork 58
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Files and Directory Entries API with webkit prefixes! #215
Comments
Yep, that's me. Thanks for raising this! As noted in the explainer, the spec attempts to document what's already been implemented and shipping, to help the implementations converge on compatibility with the old, crufty, prefixed Chrome implementation. This seems to have worked - the latest Safari TP added support following the spec guidance and passed nearly all of the tests (which hadn't been upstreamed to WPT at the time). The four main engines (Chrome, Firefox, Edge, Safari) are now shipping (or on track to ship) with prefixes, for compatibility with Chrome. Adding non-prefixed aliases sounds good to me; I don't know how amenable other implementers will be. (The expression "lipstick on a pig" may be relevant.) Influential feedback from TAG may help. |
I'm not sure we should just add nonprefixed variants. I'd rather we first figure out how this integrates with the rest of HTML and then figure out what primitives we have here and what an ideal API would look like. And only then expose that ideal API. If it turns out that's just removing the prefixes, fine, but I don't think we'll know for sure until we do the work. |
I had a read through. Given existing implementations exist, I didn't see anything that made me think it justified the work to change, but...
|
Re: Good point - that needs specifying somewhere. I'll file a bug. In Chrome, at least, Re: promises Since the non-Chrome browsers implemented this API somewhat reluctantly due to market/interop pressure, with entirely reasonable skepticism that the API is an ideal basis for the future, there's also been reluctance to commit to extending it at all, versus possibly introducing a new parallel API design. This manifested, for example, as objections raised at TPAC to adding the non-prefixed Obviously, per the examples, I'm a fan of promises. :) It would be straightforward to e.g. add the following:
... and a way to get an async iterator for entries on |
Consulted with @aliams (thanks!) Our position is that removing the prefix will require the web to make a change; if the web needs to make a change, we would strongly prefer they instead migrate to a better (more ergonomiclly well-designed approach) than this Entries API. Issues with this API:
Basically, this feature was hobbled together from partially-implemented parts of an older API, plus a adding a set of extensions as documented in a Wiki. It's not really fit for the Purpose it is primarily used for (directory upload). Our attempt at a better design is here: https://wicg.github.io/directory-upload/proposal.html Again, if there needs to be a change, we'd prefer not to just unprefix this Entries API. |
Does directory upload cover entirely local-use use cases? Say for a photo editing app that wants to open local files, mutate them and save them back to the local file system. Neither spec seems to cover this use case. The defunct FileSystem API does, but was (still is?) only supported by Chrome: https://www.html5rocks.com/en/tutorials/file/filesystem/ |
The FileSystem API dealt with two parts: (1) the file/directory/filesystem types, and (2) the ability to create a "sandboxed" file system for origin-specific storage. Chrome re-used the former for drag-and-drop of directories providing an "isolated" file system, and other browsers implemented the subset necessary for this. The doc that this issue references is a codification of that common subset. You could imagine multiple sources of such filesystems, such as Chrome provides:
It would be reasonable to assume that same file system API (file/directory entries, path resolution, directory traversal, access to file contents, etc) would be used for all of the above cases, as indeed Chrome does. Despite recurring interest, no browser has yet tackled web-exposing direct native file/local file system access. Should that happen, we'll need to decide if that should re-use the types here or provide alternate types. |
It looks like most of @travisleithead's notes apply to the way that entries appear on the HTMLInputElement rather than the interfaces of the types that are exposed (and might be re-used for other FS-like operations).
^^^ Specific to HTMLInputElement
^^^ Not specific to HTMLInputElement. However, this turns out to be useful; you may want to be able to persist a reference to a file distinct from the file itself. Consider an API which grants some permission for the local file system. The user opens "foo.png" for editing. The web app can persist the reference to the file distinct from the bits, so that when the web page is visited again the filename can be presented in e.g. File > Recently Used and the file re-opened.
^^^ Specific to HTMLInputElement. The rest of the API allows traversal.
^^^ As noted, these could be added to the types, if there was belief that these types were not dead ends.
^^^ HTMLInputElement and DataTransferItem.
^^^ Specific to HTMLInputElement. Empty directories would be present using the traversal.
Yep. It's a cleaner API. Unfortunately, none of the browser vendors (including Microsoft) have yet elected to implement and ship it. :( |
To clarify: all of @travisleithead's feedback is a great reason to not just unprefix A plausible incremental path forward building on what browsers have now:
(Since Edge doesn't support the methods on the interfaces today this should result in a fairly clean interface in Edge. Other browsers would have both the callback APIs and Promise/async iterator APIs for back-compat.) |
@inexorabletash can we please do #215 (comment) first? I'm sure we'll uncover more as we undertake that work. |
@annevk - I have no actual implementation or spec work planned here; all the above is just handwaving in response to questions/concerns. Doing integration with HTML/FileAPI before anything else is fine with me. Not something I'm likely to spend time on in the near future, though. |
It doesn't look we have any actionable outcomes here... looks like general consensus not to do anything here until a deeper integration with HTML is worked on and/or implementer interest changes. It seems unnecessary for us to keep this review open. |
Hello TAG!
I'm requesting a TAG review of:
Proxy reporting as I believe the TAG should touch on shipping a webkit prefixed spec. I believe they are willing to remove the prefix given that everyone agrees to do it.
The text was updated successfully, but these errors were encountered: