whatwg / xhr

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

Spec requires firing at least two "progress" events; browsers do not. #318

Open domenic opened 3 years ago

domenic commented 3 years ago

Example: https://boom-bath.glitch.me/xhr-small-chunks.html

The spec requires firing one as part of processResponse, and one as part of "handle response end-of-file". However, browsers only fire a single one.

As far as I can tell, they avoid firing the one in "handle response end-of-file" if the number of bytes hasn't changed. /cc @ricea in case he can make more sense of Chromium's implementation than I can.

domenic commented 3 years ago

Implementing a change in jsdom to omit the progress event revealed another non-interop, which is for zero-length response bodies: there only Firefox fires a progress event: https://wpt.fyi/results/xhr/send-no-response-event-order.htm?label=master&label=experimental&product=chrome&product=firefox&product=safari&aligned&q=send-no-response-event