Re: calling abort method on XMLHttpRequest instance fires onreadystatechange with readyState 4

Lucky <[email protected]>
Newsgroups gmane.comp.mozilla.devel.xml
Message-ID <[email protected]>
Martijn wrote:
> I think you're right.
> The xmlhttprequest is a Microsoft thing, so Mozilla should do exactly
> like Microsoft in this case (also because it makes sense).
> 
> It seems to me that the lxr url you gave is indeed the place in the
> code where Mozilla is going wrong.
> Looking at bonsai:
> http://bonsai.mozilla.org/cvsblame.cgi?file=mozilla/extensions/xmlextras/base/src/nsXMLHttpRequest.cpp&rev=1.147#684
> 
> That code was added with bug 258768.
> When reading https://bugzilla.mozilla.org/show_bug.cgi?id=258768#c4 it
> seems that was a foreseen side-effect of the patch.
> 
> Probably you should file a bug on it, I think.
> 
> Regards,
> Martijn
> 
> On 4/1/06, Martin Honnen <[email protected]> wrote:
>> Martin Honnen wrote:
>>
>>
>>> Other implementations (Opera 8.5, IE 6 with Microsoft.XMLHTTP) simply
>>> abort and set readyState to 0, not firing any onreadystatechange
>>> handler, certainly not one with readyState 4.
>> The documentation of MSXML's IXMLHttpRequest abort method
>> <http://msdn.microsoft.com/library/default.asp?url=/library/en-us/xmlsdk/html/7b1cfc92-5078-404a-85a2-a907fe1184a2.asp>
>> also says:
>>    "The request will be returned to the UNINITIALIZED state"
>> and
>> <http://msdn.microsoft.com/library/default.asp?url=/library/en-us/xmlsdk/html/0e6a34e4-f90c-489d-acff-cb44242fafc6.asp>
>> defines UNINITIALIZED as 0.
>>
>> Why does Mozilla do a 4 to 0 transition with readyState, why does it not
>> directly go to readyState 0?
>>
>> --
>>
>>         Martin Honnen
>>         http://JavaScript.FAQTs.com/
>> _______________________________________________
>> dev-tech-xml mailing list
>> [email protected]
>> https://lists.mozilla.org/listinfo/dev-tech-xml
>>
I think in this case, mozilla is doing the same thing as microsoft, but 
so much that it is actually mirroring a bug that msxml has, for it does 
go to 4 after abort(), and then to 0, only the documentation states 
differently.

common coding practices is to remove the onreadystatechange by setting 
it to an empty function after abort, for using MSXML you cannot simply 
null out the onreadystatechange

http.onreadystatechange = function() {}
http.abort()
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.