XHR and clearing event listeners

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

XHR and clearing event listeners

Olli Pettay

Hi,

I wonder why the current XMLHttpRequest draft has the following:
"If something goes wrong (infinite loop, network errors) the state must
be set to loaded and all members (excluding readyState) of the object
must be set to their initial value. Also, if async is set to false, a
NETWORK_ERR exception must be raised. In addition, all registered event
listeners must be removed."
What is the reason to remove all event listeners?


-Olli

Reply | Threaded
Open this post in threaded view
|

Re: XHR and clearing event listeners

Anne van Kesteren-2

On Tue, 06 Mar 2007 20:02:31 +0100, Olli Pettay <[hidden email]>  
wrote:
> I wonder why the current XMLHttpRequest draft has the following:
> "If something goes wrong (infinite loop, network errors) the state must  
> be set to loaded and all members (excluding readyState) of the object  
> must be set to their initial value. Also, if async is set to false, a  
> NETWORK_ERR exception must be raised. In addition, all registered event  
> listeners must be removed."
> What is the reason to remove all event listeners?

If I remember correctly that's compatible with what Internet Explorer is  
doing currently. However, I'm now thinking that Internet Explorer might  
actually keep the event listener registered but just not allow it to be  
reused (which is a bug). Much like they do with invoking open() at the  
wrong time...


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

Reply | Threaded
Open this post in threaded view
|

Re: XHR and clearing event listeners

Anne van Kesteren-2

On Fri, 09 Mar 2007 16:44:19 +0100, Anne van Kesteren <[hidden email]>  
wrote:

>> I wonder why the current XMLHttpRequest draft has the following:
>> "If something goes wrong (infinite loop, network errors) the state must  
>> be set to loaded and all members (excluding readyState) of the object  
>> must be set to their initial value. Also, if async is set to false, a  
>> NETWORK_ERR exception must be raised. In addition, all registered event  
>> listeners must be removed."
>> What is the reason to remove all event listeners?
>
> If I remember correctly that's compatible with what Internet Explorer is  
> doing currently. However, I'm now thinking that Internet Explorer might  
> actually keep the event listener registered but just not allow it to be  
> reused (which is a bug). Much like they do with invoking open() at the  
> wrong time...

See http://tc.labs.opera.com/apis/XMLHttpRequest/send/004.htm for  
instance. I might be doing something wrong though...


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