w3c / FileAPI

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

Rewrite FileReader definitions. #118

Closed mkruisselbrink closed 5 years ago

mkruisselbrink commented 5 years ago

Make algorithms more imperative to make it clearer what is going on. No intended behavioral changes, but making it clearer that the behavior from #79 is the expected behavior.


Preview | Diff

mkruisselbrink commented 5 years ago

This isn't supposed to change behavior, but I should still write tests to actually verify the behavior, as there are things in this area (like #79) that aren't currently tested, and where browsers do diverge.

mkruisselbrink commented 5 years ago

Thanks for the review. Yeah, I tried to mostly just mimic what fetch (and sometimes XHR) are doing.

Corresponding tests are in https://github.com/web-platform-tests/wpt/pull/7494 (and unfortunately not a single browser currently passes those tests... Firefox is close (it is synchronously firing the loadstart event rather than posting a task, and it set result too soon for readAsBinaryString). Chromium/Edge have various other issues, but we already have a bug for at least some of those, and I don't see any problems with fixing those. Safari seems to mostly currently match Chromium in behavior.