w3c / FileAPI

File API
https://w3c.github.io/FileAPI/
Other
105 stars 44 forks source link

Rewrite a lot of the internals of Blobs to make reading more explicit. #154

Open mkruisselbrink opened 4 years ago

mkruisselbrink commented 4 years ago

This redefines how blobs work by adding internal slots and hooks to support Blob objects backed by various sources of data. By doing so this tries to make more explicit how various edge cases behave, as well as making it clear that blobs are immutable.

This fixes #75, fixes #99, and fixes #47. It also lays the ground work to address w3c/webappsec-clear-site-data#49. This also fixes #71.

For normative changes, the following tasks have been completed:

Implementation commitment:


Preview | Diff

mkruisselbrink commented 4 years ago

This at least matches how chrome implements blobs backed by files, and how slicing and/or combining those blobs with other blobs works. I haven't verified yet if all browsers actually fully agree on this though.

There also is still plenty of room for improvement here, and of course follow-up work to have HTML actually call out to the new "create a file backed File object" to create files in drag&drop and upload algorithms.

@annevk do you have time to review this? not urgent, since I won't have much time in the near future to follow up anyway, but definitely would welcome your input about both the high-level idea of how this tries to define how things work, as well as details.

annevk commented 4 years ago

It would help a lot to have an enumeration of the edge cases this attempts to cover as well as some kind of overview of the design to solve them.