RE: [xmlhttprequest2] timeout and JSON

Jonas Sicking wrote:
> Anne van Kesteren wrote:
> > On Fri, 05 Sep 2008 02:36:58 +0200, Jonas Sicking 
> > <jonas@sicking.cc> wrote:
> >> 1. A timeout property like the one on microsofts XDR. I 
> >> haven't looked into the specifics of XDRs property, but 
> >> I would think that an 'abort' event should fire as well 
> >> as readystate transitioning to something if the timeout 
> >> is reached.
> > 
> > What's wrong with using setTimeout?
> 
> Doesn't work with synchronous requests. Or at least sort of. 
> It's somewhat undefined if timers and UI events should fire 
> during synchronous XHR loads, but it seems like a lot of
> people expect at least timers not to. So for this I'm 
> assuming that that is the case.
> 
> (If anyone is interested, FF2 did not fire timers, FF3 does)
> 
> Timeouts are especially import during synchronous requests 
> since they block the UI, so you don't want to do that for too 
> long periods of time.

I agree with Jonas that this is an important addition to XHR,
in particular for sync requests as setTimeout usually can't
be used. (IIRC I suggested timeouts quite some time ago for
the XHR2 activity.)
Talking about Microsoft, there is already API for XHR timeout 
in IE8, see
http://msdn.microsoft.com/en-us/library/cc304105(VS.85).aspx

Would it be possible to standardize a default timeout as well,
to improve legacy content that are currently risking to hang
"forever" in sync requests, or would that be taking too high a 
risk with backwards compatibility?

It might be good to define how conformant implementations
should behave wrt to timeouts and other events during a 
synchronous request. And it would be interesting to hear some
discussion about ui updating/redrawing as that could f ex 
enable things like "ajax spinner" gifs being animated during a 
sync request.

Best regards
Mike Wilson

Received on Wednesday, 10 September 2008 10:52:02 UTC