XMLHttpRequest and timing of upload events

Because redirects are atomic, we cannot dispatch loadend events and
such on the XMLHttpRequestUpload class.

This effectively means that the moment we know we are not going to
follow a redirect, we know we "completed" uploading (potentially
several times).

>From what I observed in Safari/Chrome it seems a separate task is what
we want. This means e.g. a setTimeout() callback can run between
loadend for upload and state switching to HEADERS_RECEIVED.

Firefox also reports state as OPENED, though the setTimeout() callback
runs much later (maybe due to a lower limit).

http://dump.testsuite.org/xhr/upload-events.html was my test.

Let me know if you have any concerns. This change will mostly be done
in Fetch as that queues the networking tasks these days.


-- 
http://annevankesteren.nl/

Received on Tuesday, 20 May 2014 12:56:09 UTC