RE: [xmlhttprequest2] timeout and JSON

" I absolutely agree that it would rock if we could use
> the MS implementation."

Thanks Jonas. As always, appreciated.

Answers to your question
> > What happens if there is a timeout in that state?
> >
> > 1) .readystate is set to 0
> >    .status is set to 0
> >    .responseXML is set to null
> >    .responseText is set to ""
> > 2) All properties are left as is.
> > 3) Something else  (Profit?)

Essentially, timeout has the effect that is similar to 1). Infact, design wise is intended to have the same effect although a few superficial differences exist.
What 1) seems to ask for is resetting the object, which is what IE8 does. Readystate is set to 0, there are a few differences in IE's (8 and legacy) support for the existing XHR syntax, and those are reflected in the values of the properties when they are accessed in readystate 0 and corresponding exceptions thrown. Any changes to a future release of IE to bring those inline with the XHR spec would remedy the differences.
These are:
When ontimeout fires:

•       Getting responseText throws an exception:  “The data necessary to complete this operation is not yet available”
•       Getting responseXML throws an exception:  “Unspecified error.”
•       Getting status throws an exception:  “Unspecified error.”

> -----Original Message-----
> From: Jonas Sicking [mailto:jonas@sicking.cc]
> Sent: Thursday, September 11, 2008 3:21 AM
> To: Sunava Dutta
> Cc: Anne van Kesteren; WebApps WG; Gideon Cohn; Zhenbin Xu; IE8 Core
> AJAX SWAT Team
> Subject: Re: [xmlhttprequest2] timeout and JSON
>
> Jonas Sicking wrote:
> > Sunava Dutta wrote:
> >> XDR timeout doesn’t work with sync requests as there is no sync
> >> support in the object.
> >> I'd be thrilled if IE9's timeout property be adopted for XHR. (OK,
> >> thrilled would be an understatement!)
> >> http://msdn.microsoft.com/en-us/library/cc304105(VS.85).aspx
> >>
> >> We fire an ontimeout and named it similar to other defined XHR2
> events
> >> like onload etc to ease potential integration  with XHR2! It works
> for
> >> sync and async calls. Of course, if needed we are amenable to making
> >> tweaks down the road to the property/event behavior if necessary,
> but
> >> ideally it would be picked up 'as is'.
> >
> > How do other properties, like .readystate, .responseXML,
> .responseText,
> > .status interact with timing out? I.e. say that we have an XHR object
> > currently loading in the following state:
> >
> > xhr.readystate = 3
> > xhr.status = 200
> > xhr.responseText = "<result><el>hello worl"
> > xhr.responseXML = #document
> >                     <result>
> >                       <el>
> >                         #text: "hello worl"
> >
> > (sorry, trying to draw a DOM, not very obvious what it is)
> >
> > What happens if there is a timeout in that state?
> >
> > 1) .readystate is set to 0
> >    .status is set to 0
> >    .responseXML is set to null
> >    .responseText is set to ""
> > 2) All properties are left as is.
> > 3) Something else  (Profit?)
> >
> > If the answer is 1, does that happen before or after ontimeout is
> fired?
> > And does that mean that onreadystatechange is called?
> >
> > If the answer is 2, does this mean that no action at all is taken
> other
> > than ontimeout getting called? onreadystatechange is not fired any
> more
> > unless someone explicitly calls .abort() and then .open()?
>
> To make it clear. I absolutely agree that it would rock if we could use
> the MS implementation. However it needs to be specified in more detail
> than the MSDN page includes, such as answers to the questions above.
>
> / Jonas

Received on Friday, 12 September 2008 03:10:59 UTC