Account Options

  1. Sign in
Google Groups Home
« Groups Home
calling abort method on XMLHttpRequest instance fires onreadystatechange with readyState 4
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  13 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Martin Honnen  
View profile  
 More options Mar 31 2006, 10:21 am
Newsgroups: mozilla.dev.tech.xml
From: Martin Honnen <mahotr...@yahoo.de>
Date: Fri, 31 Mar 2006 17:21:30 +0200
Local: Fri, Mar 31 2006 10:21 am
Subject: calling abort method on XMLHttpRequest instance fires onreadystatechange with readyState 4

I was running some tests on how the different implementations of
XMLHttpRequest in different browsers react on calling the abort method.

This test case
<http://home.arcor.de/martin.honnen/mozillaBugs/XMLHttpRequest/abortCh...>
has a HTML form allowing you to select a readyState when to call abort
on an XMLHttpRequest instance and to run the test by clicking the button.

Mozilla (both Firefox 1.5.0.1 and a Firefox trunk nightly (Mozilla/5.0
(Windows; U; Windows NT 5.1; en-US; rv:1.9a1) Gecko/20060331
Firefox/1.6a1) behave rather strangely, if you call abort when the
readyState is 1, 2, or 3 then as a result of that call the
onreadystatechange event handler is fired with readyState 4, then
readyState is changed to 0.

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.

I can't find any open bugs on XMLHttpRequest and abort.

I am not good at reading C++ but the abort implementation at
<http://lxr.mozilla.org/seamonkey/source/extensions/xmlextras/base/src...>
indeed seems to do

   ChangeState(XML_HTTP_REQUEST_COMPLETED, PR_TRUE, PR_TRUE);

first and only then does

   ChangeState(XML_HTTP_REQUEST_UNINITIALIZED, PR_FALSE);  // IE seems
to do it

what other implementations do.

For a client script assigned to onreadystatechange it is obviously
difficult in Mozilla to distinguish between a normal readyState 4 change
and one that is caused by an abort call.

Should I file a bug on this?

--

        Martin Honnen
        http://JavaScript.FAQTs.com/


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Martin Honnen  
View profile  
 More options Apr 1 2006, 11:00 am
Newsgroups: mozilla.dev.tech.xml
From: Martin Honnen <mahotr...@yahoo.de>
Date: Sat, 01 Apr 2006 18:00:24 +0200
Local: Sat, Apr 1 2006 11:00 am
Subject: Re: calling abort method on XMLHttpRequest instance fires onreadystatechange with readyState 4

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/xmls...>
also says:
   "The request will be returned to the UNINITIALIZED state"
and
<http://msdn.microsoft.com/library/default.asp?url=/library/en-us/xmls...>
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/


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Martijn  
View profile  
 More options Apr 1 2006, 1:36 pm
Newsgroups: mozilla.dev.tech.xml
From: Martijn <martijn.mart...@gmail.com>
Date: Sat, 1 Apr 2006 20:36:03 +0200
Local: Sat, Apr 1 2006 1:36 pm
Subject: Re: calling abort method on XMLHttpRequest instance fires onreadystatechange with readyState 4
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/xmlext...

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 <mahotr...@yahoo.de> wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Lucky  
View profile  
 More options Apr 1 2006, 2:57 pm
Newsgroups: mozilla.dev.tech.xml
From: Lucky <lu...@teamcon.com>
Date: Sat, 01 Apr 2006 14:57:19 -0500
Local: Sat, Apr 1 2006 2:57 pm
Subject: Re: calling abort method on XMLHttpRequest instance fires onreadystatechange with readyState 4

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()


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Martin Honnen  
View profile  
 More options Apr 2 2006, 8:16 am
Newsgroups: mozilla.dev.tech.xml
From: Martin Honnen <mahotr...@yahoo.de>
Date: Sun, 02 Apr 2006 14:16:56 +0200
Local: Sun, Apr 2 2006 8:16 am
Subject: Re: calling abort method on XMLHttpRequest instance fires onreadystatechange with readyState 4

Lucky wrote:
> 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.

Does the test case I posted
<http://home.arcor.de/martin.honnen/mozillaBugs/XMLHttpRequest/abortCh...>
show any change to readyState 4 then 0 when calling abort with
readyState 1, 2, or 3? What IE version is that then?
IE 6 here simply aborts and goes to readyState 0.

--

        Martin Honnen
        http://JavaScript.FAQTs.com/


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Boris Zbarsky  
View profile  
 More options Apr 2 2006, 1:46 pm
Newsgroups: mozilla.dev.tech.xml
From: Boris Zbarsky <bzbar...@mit.edu>
Date: Sun, 02 Apr 2006 12:46:43 -0500
Local: Sun, Apr 2 2006 1:46 pm
Subject: Re: calling abort method on XMLHttpRequest instance fires onreadystatechange with readyState 4

Martijn wrote:
> That code was added with bug 258768.

Actually, no.  Bug 258768 touched the code, but didn't add it.  The code was
added in bug 218236.  See in particular
https://bugzilla.mozilla.org/show_bug.cgi?id=218236#c11 for comparisons to IE
6.0 behavior.  Note the inconsistency in IE behavior depending on the value of
readyState when abort() is called (1 and 2 give different behavior).

We could probably emulate this inconsistent behavior....

Has someone raised this with the web apis WG, since they're currently working on
specifying XMLHttpRequest?

-Boris


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Lucky  
View profile  
 More options Apr 2 2006, 10:43 pm
Newsgroups: mozilla.dev.tech.xml
From: Lucky <lu...@teamcon.com>
Date: Sun, 02 Apr 2006 22:43:11 -0400
Local: Sun, Apr 2 2006 10:43 pm
Subject: Re: calling abort method on XMLHttpRequest instance fires onreadystatechange with readyState 4

No, but that testcase is a bit off, for if you call as you get to a 1
readyState, that could be the intial 1 that really hasn't done anything..
eg: the 1, 1, 2, 3, 4 states order, when onreadystatechange is set
before the open/send calls.

the better test is to call the abort after a quick timeout.

i have experienced the jump to 4 after doing my own abort code for a
timeout, if server is busy.  setting a setTimeout(..., 10000) to then
call the abort(); and then it went to a readyState 4 in msxml..

you could simply move the timeout down to a sec, or less, and call upon
a website that may have a slight latency to achieve another scenario of
abort() being called.

will cook up a testcase to show tomorrow if time allows, a bit under
weather right now.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Anne van Kesteren  
View profile  
 More options Apr 3 2006, 10:06 am
Newsgroups: mozilla.dev.tech.xml
From: "Anne van Kesteren" <ann...@opera.com>
Date: Mon, 03 Apr 2006 16:06:28 +0200
Local: Mon, Apr 3 2006 10:06 am
Subject: Re: calling abort method on XMLHttpRequest instance fires onreadystatechange with readyState 4

On Sun, 02 Apr 2006 19:46:43 +0200, Boris Zbarsky <bzbar...@mit.edu> wrote:
> Has someone raised this with the web apis WG, since they're currently  
> working on specifying XMLHttpRequest?

I did. ISSUE-58. For some reason the current specification specifies what  
Mozilla does, which doesn't make much sense...

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


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Martin Honnen  
View profile  
 More options Apr 3 2006, 1:39 pm
Newsgroups: mozilla.dev.tech.xml
From: Martin Honnen <mahotr...@yahoo.de>
Date: Mon, 03 Apr 2006 19:39:26 +0200
Local: Mon, Apr 3 2006 1:39 pm
Subject: Re: calling abort method on XMLHttpRequest instance fires onreadystatechange with readyState 4

Boris Zbarsky wrote:
> See in particular
> https://bugzilla.mozilla.org/show_bug.cgi?id=218236#c11 for comparisons
> to IE 6.0 behavior.  Note the inconsistency in IE behavior depending on
> the value of readyState when abort() is called (1 and 2 give different
> behavior).

I have played with variations of my test case, this variation
<http://home.arcor.de/martin.honnen/mozillaBugs/XMLHttpRequest/abortCh...>
which only calls abort using setTimeout with a configurable delay indeed
consistently for abort called on
   readyState 1
   program id Microsoft.XMLHTTP, Msxml2.XMLHTTP, Msxml2.XMLHTTP.3.0
   delay 10 milliseconds
shows readystatechange events as
   1 -> 1 -> 4
the abort sets readyState to 0 (and does that twice due to 1 -> 1
transition).

Those program ids above are all bound to MSXML 3 on my system, if I run
the same test with program ids for MSXML 4 or MSXML 5 or MSXML 6 however
the sequence is simply
   1
then abort is called and it sets readyState to 0.

MSXML 3 is what is installed with IE 6, the other MSXML versions are not
necessarily around to be used on the client.

--

        Martin Honnen
        http://JavaScript.FAQTs.com/


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Boris Zbarsky  
View profile  
 More options Apr 3 2006, 2:06 pm
Newsgroups: mozilla.dev.tech.xml
From: Boris Zbarsky <bzbar...@mit.edu>
Date: Mon, 03 Apr 2006 13:06:43 -0500
Local: Mon, Apr 3 2006 2:06 pm
Subject: Re: calling abort method on XMLHttpRequest instance fires onreadystatechange with readyState 4

Martin Honnen wrote:
> Those program ids above are all bound to MSXML 3 on my system, if I run
> the same test with program ids for MSXML 4 or MSXML 5 or MSXML 6 however
> the sequence is simply
>   1
> then abort is called and it sets readyState to 0.

Interesting.  Could you post that to the web apis discussion?

-Boris


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Lucky  
View profile  
 More options Apr 3 2006, 10:09 pm
Newsgroups: mozilla.dev.tech.xml
From: Lucky <lu...@teamcon.com>
Date: Mon, 03 Apr 2006 22:09:56 -0400
Local: Mon, Apr 3 2006 10:09 pm
Subject: Re: calling abort method on XMLHttpRequest instance fires onreadystatechange with readyState 4

this may help show the situation?
can see the comments in script area per version response.

<http://www.teamcon.com/pub/concepts/microsoft/msxml-xmlhttp-abortRead...>


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Lucky  
View profile  
 More options Apr 3 2006, 10:14 pm
Newsgroups: mozilla.dev.tech.xml
From: Lucky <lu...@teamcon.com>
Date: Mon, 03 Apr 2006 22:14:27 -0400
Local: Mon, Apr 3 2006 10:14 pm
Subject: Re: calling abort method on XMLHttpRequest instance fires onreadystatechange with readyState 4

i was running this example local, to not get the "permission denied"
as it will spawn random domain requests, so they will never really
return a response, to simulate network failure, or lack to connect to a
server.

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Martin Honnen  
View profile  
 More options Apr 4 2006, 10:29 am
Newsgroups: mozilla.dev.tech.xml
From: Martin Honnen <mahotr...@yahoo.de>
Date: Tue, 04 Apr 2006 16:29:26 +0200
Local: Tues, Apr 4 2006 10:29 am
Subject: Re: calling abort method on XMLHttpRequest instance fires onreadystatechange with readyState 4

Boris Zbarsky wrote:
> Martin Honnen wrote:

>> Those program ids above are all bound to MSXML 3 on my system, if I
>> run the same test with program ids for MSXML 4 or MSXML 5 or MSXML 6
>> however the sequence is simply
>>   1
>> then abort is called and it sets readyState to 0.

> Interesting.  Could you post that to the web apis discussion?

I am currently not subscribed there. According to the web archive of the
  mailing list Anne van Kesteren has already posted a link to this
newsgroup thread on that list.

--

        Martin Honnen
        http://JavaScript.FAQTs.com/


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »