Re: XMLHttpRequest and timing of upload events
On Mon, Apr 20, 2015 at 2:00 PM, Hallvord Reiar Michaelsen Steen hst...@mozilla.com wrote: On Tue, May 20, 2014 at 2:55 PM, Anne van Kesteren ann...@annevk.nl wrote: Because redirects are atomic, we cannot dispatch loadend events and such on the XMLHttpRequestUpload class. Does this change mean we can no longer send 'loadend' on the upload object? How is a script supposed to know when the upload phase is finished, then? Isn't this a functionality we should try to keep - or am I just misunderstanding what you meant here..? I meant that we cannot dispatch it between redirects, only for the final request, and then we do it (just) once, when the response headers are in. -- https://annevankesteren.nl/
Re: XMLHttpRequest and timing of upload events
Hi Anne, sorry to be late at responding - just going through some E-mail I didn't have time to understand and respond to before.. On Tue, May 20, 2014 at 2:55 PM, Anne van Kesteren ann...@annevk.nl wrote: Because redirects are atomic, we cannot dispatch loadend events and such on the XMLHttpRequestUpload class. Does this change mean we can no longer send 'loadend' on the upload object? How is a script supposed to know when the upload phase is finished, then? Isn't this a functionality we should try to keep - or am I just misunderstanding what you meant here..? -Hallvord
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/