whatwg / xhr

XMLHttpRequest Standard
https://xhr.spec.whatwg.org/
Other
314 stars 131 forks source link

Editorial: adopt Fetch's new approach to callbacks #311

Closed annevk closed 3 years ago

annevk commented 3 years ago

See https://github.com/whatwg/fetch/pull/1165 for context.

@domenic so it seems XHR does all the awkward ways of reading a response body without helper. Lots of technical debt came with the introduction of streams to fetch. I didn't try to touch that here and instead focused purely on adopting the new callback approach, which does seem a lot cleaner in terms of what things get to run concurrently and such, but that does seem like an obvious thing to try to tackle next.


Preview | Diff

annevk commented 3 years ago

I don't think we need that setup in HTML, do we? What in HTML needs to block the main thread? In HTML we'd just put all subsequent steps in the callback. (Assuming HTML is doing it correctly in parallel now, which I somewhat doubt.)

annevk commented 3 years ago

Thanks for all the great review feedback by the way!

domenic commented 3 years ago

Hmm, yeah, after Ctrl+Fing all instances of "Fetch request" in HTML, they all seem like they'd work fine. I thought we had more instances where we did fetches from in-parallel, but I guess not. (The only real one is during navigation which we just discussed in IRC.)