Re: [XHR2] XMLHttpRequest and progress events

On Sun, 29 Jul 2007 03:04:14 +0200, Maciej Stachowiak <mjs@apple.com>  
wrote:
>> I've been looking into integrating progress events into XMLHttpRequest.  
>> In general it is pretty trivial to do for the request non-uploading  
>> scenario. loadstart is dispatched right after the first  
>> readystatechange event is dispatched in the send() algorithm and  
>> progress is dispatched while downloading. (abort, error and load are  
>> pretty obvious). I decided to only dispatch them for synchronous  
>> requests. load, as exception, is also dispatched in the synchronous  
>> case. (For abort and error the synchronous case throws an exception and  
>> loadstart and progress are not useful after the request has already  
>> completed.)
>>
>> The main problem is probably the XMLHttpRequestUpload object  
>> (XMLHttpRequest.upload) which we decided to use for data going to the  
>> server. Can someone explain to me how the user agent knows how much  
>> content it already has uploaded?
>
> It would need the network layer to tell it.

Any suggestions on how to describe this in the specification?


>> Should we dispatch a loadstart event on that object as well even though  
>> it will be at the same moment it is dispatched on the XMLHttpRequest  
>> object? When to dispatch the progress events and abort, error, etc?
>
> Don't know the answers to these, but I think it would be helpful to get  
> a complete set of events for an upload, in other words, the same set  
> you'd get for the corresponding download.

I suppose that makes sense. I suppose abort would be dispatched when  
abort() is invoked and data is still being uploaded or when the user  
aborts the upload while data is being uploaded. error would be dispatched  
because of some network error and load would be dispatched whenever the  
"network layer" (however we're going to translate that into specification  
terminology) says it's done.


-- 
Anne van Kesteren
<http://annevankesteren.nl/>
<http://www.opera.com/>

Received on Thursday, 2 August 2007 13:20:46 UTC