Gmail Calendar Documents Reader Web more »
Recently Visited Groups | Help | Sign in
Google Groups Home
Ticket 10030 - is Ajax.Request.success() broken?
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
 
tbeck  
View profile  
 More options Nov 12 2007, 6:47 pm
From: tbeck <tb...@whalespine.org>
Date: Mon, 12 Nov 2007 15:47:38 -0800
Local: Mon, Nov 12 2007 6:47 pm
Subject: Ticket 10030 - is Ajax.Request.success() broken?
Just curious if anyone has a comment on http://dev.rubyonrails.org/ticket/10030

Thanks
Tim


    Reply to author    Forward  
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.
Mislav Marohnić  
View profile  
 More options Nov 12 2007, 8:52 pm
From: "Mislav Marohnić" <mislav.maroh...@gmail.com>
Date: Tue, 13 Nov 2007 02:52:28 +0100
Local: Mon, Nov 12 2007 8:52 pm
Subject: Re: [Prototype-core] Ticket 10030 - is Ajax.Request.success() broken?

Hmm ... Tobie experimented with return statuses, he might give some clue.

No browser is "violating the spec" because there is no spec for XHR, the
document is only a working draft. So, status codes and ready states are not
consistent cross-browsers.

On Nov 13, 2007 12:47 AM, tbeck <tb...@whalespine.org> wrote:


    Reply to author    Forward  
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.
tbeck  
View profile  
 More options Nov 12 2007, 9:29 pm
From: tbeck <tb...@whalespine.org>
Date: Mon, 12 Nov 2007 18:29:37 -0800
Local: Mon, Nov 12 2007 9:29 pm
Subject: Re: Ticket 10030 - is Ajax.Request.success() broken?

On Nov 12, 6:52 pm, "Mislav Marohnić" <mislav.maroh...@gmail.com>
wrote:

> No browser is "violating the spec" because there is no spec for XHR, the
> document is only a working draft. So, status codes and ready states are not
> consistent cross-browsers.

Fair enough.  The real issue is that I'm not sure an undefined or 0
status should result in success() returning true, regardless of how
XHR is supposed to work and what the browsers do.

Tim


    Reply to author    Forward  
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.
Tobie Langel  
View profile  
 More options Nov 13 2007, 4:43 am
From: Tobie Langel <tobie.lan...@gmail.com>
Date: Tue, 13 Nov 2007 09:43:24 -0000
Local: Tues, Nov 13 2007 4:43 am
Subject: Re: Ticket 10030 - is Ajax.Request.success() broken?
Some browsers - I can't remember witch - always return a status of 0
for the file: protocol, others don't return a value at all in that
case, hence this hack.

We're going to be doing more work on Ajax for 1.6.1, but I'm not even
sure there is a real solution ot his issue.

Regards,

Tobie

On Nov 13, 3:29 am, tbeck <tb...@whalespine.org> wrote:


    Reply to author    Forward  
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.
Ken Snyder  
View profile  
 More options Nov 13 2007, 6:27 pm
From: Ken Snyder <kendsny...@gmail.com>
Date: Tue, 13 Nov 2007 16:27:31 -0700
Local: Tues, Nov 13 2007 6:27 pm
Subject: Re: [Prototype-core] Ticket 10030 - is Ajax.Request.success() broken?
Tobie Langel wrote:
> Some browsers - I can't remember witch - always return a status of 0
> for the file: protocol, others don't return a value at all in that
> case, hence this hack.

> We're going to be doing more work on Ajax for 1.6.1, but I'm not even
> sure there is a real solution ot his issue.

> Regards,

> Tobie

I think the trick here is to return a separate status code for files
instead of zero.  I believe it is possible to handle all situations.

Here is the result of my research on status codes:

Calling HTTP(S) ajax url
----
Network error scenarios:
FF2 - throws exception
S3 - transport.status == 0
O9 - transport.status == 0
IE6/7 - transport.status == (one of the following)
  1223 : Client canceled request
  12002: Server timeout
  12029: Dropped connection
  12030: Dropped connection
  12031: Dropped connection
  12152: Connection closed by server

Calling file-based ajax url
----
Success: ALL BROWSERS - transport.status == 0
Failure: ALL BROWSERS - transport.status == 0

Note: for network errors on FF 1.x transport.status == 200 and no
exception is thrown so the developer is left to see that the response is
empty to know of a failure. I don't think there is a workaround.

So how can we know the difference between a network error and a
file-based url call?--Both url and location.protocol give clues.

IMHO it is important that we properly route all these codes: file-based
requests should always fire "onSuccess" (unless we can figure out how to
detect a file-based failure) and any of the network error codes should
throw "onException".  Right now, we get all sorts of kooky callbacks
such as "on0" and "on12029".

For more info and links to my sources, see the discussion from Sept:
http://groups.google.com/group/prototype-core/browse_thread/thread/1e...

- Ken Snyder


    Reply to author    Forward  
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.
Tobie Langel  
View profile  
 More options Nov 14 2007, 2:59 am
From: Tobie Langel <tobie.lan...@gmail.com>
Date: Tue, 13 Nov 2007 23:59:03 -0800
Local: Wed, Nov 14 2007 2:59 am
Subject: Re: Ticket 10030 - is Ajax.Request.success() broken?
Hi Ken,

Thanks for the extended research. That's really helpful!

Could you please clarify what kind of errors FF is throwing ?

Also, could you please kindly advise if Safari 2's behaviour is
consistent with Safari 3 ?

Thanks,

Tobie

On Nov 14, 12:27 am, Ken Snyder <kendsny...@gmail.com> wrote:


    Reply to author    Forward  
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.
Ken Snyder  
View profile  
 More options Nov 14 2007, 11:41 am
From: Ken Snyder <kendsny...@gmail.com>
Date: Wed, 14 Nov 2007 09:41:31 -0700
Local: Wed, Nov 14 2007 11:41 am
Subject: Re: [Prototype-core] Re: Ticket 10030 - is Ajax.Request.success() broken?
Tobie Langel wrote:
> ...

> Could you please clarify what kind of errors FF is throwing ?

In the case of a network error, FF2 throws a NS_ERROR_NOT_AVAILABLE
exception any time you get/set XMLHttpRequest.status: the try-catch
block on Prototype 1.6.0 line 1297 is specifically targeted at FF2.
getStatus: function() {
    try {
        return this.transport.status || 0;
    } catch (e) { return 0 }

},
> Also, could you please kindly advise if Safari 2's behaviour is
> consistent with Safari 3 ?

I don't have S2 to test, but the following article implies that the
XMLHttpRequest Behavior is the same from S1.2 onwards
http://developer.apple.com/internet/webcontent/xmlhttpreq.html

I'll propose a patch based on these items.  I intend to map the
different error code numbers to some custom error codes.  The only thing
I'm not sure is how to definitively tell if a file-based request is
made.  There doesn't appear to be a protocol property of a
XMLHttpRequest object.  I'll have to do some more digging.  My current
guess is to check the url for beginning with "file" or "X:\".  Any thoughts?

As far as defining success or failure with file-based ajax, I'm guessing
that calling a file should return some type of content on success.  It
would be useless to have a file that does nothing and returns no
content.  Am I wrong?

- Ken Snyder


    Reply to author    Forward  
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.
Tobie Langel  
View profile  
 More options Nov 14 2007, 1:03 pm
From: Tobie Langel <tobie.lan...@gmail.com>
Date: Wed, 14 Nov 2007 10:03:55 -0800
Local: Wed, Nov 14 2007 1:03 pm
Subject: Re: Ticket 10030 - is Ajax.Request.success() broken?
Ken,

Thanks for the update.

Regarding the file protocol issue, that's easy:
window.location.protocol is all you need as per SOP.

Just discussed the other points with Andrew.

To summarize:

- file protocol should always return success.
- previously mentioned non-standard status codes for IE should always
return a status code of 0.
- status code of 0 should trigger an onFailure callback (except
obviously for the file protocol).
- status code of 0 should trigger an on0 callback.
- as the specs don't yet specify that an exception should be raised in
case of a network error, we won't implement that for the moment. So a
status code of 0 will not trigger an onException callback.

You're welcomed to submit a patch.

If not I'll look into it asap.

Regards,

Tobie

On Nov 14, 5:41 pm, Ken Snyder <kendsny...@gmail.com> wrote:


    Reply to author    Forward  
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.
Ken Snyder  
View profile  
 More options Nov 14 2007, 1:08 pm
From: Ken Snyder <kendsny...@gmail.com>
Date: Wed, 14 Nov 2007 11:08:52 -0700
Local: Wed, Nov 14 2007 1:08 pm
Subject: Re: [Prototype-core] Re: Ticket 10030 - is Ajax.Request.success() broken?
Tobie Langel wrote:
> ...
> Regarding the file protocol issue, that's easy:
> window.location.protocol is all you need as per SOP.

But what about http pages accessing files?  I was under the impression
that this is the prime testing situation.

Extremely helpful.
One question: We want the file protocol to always trigger onSuccess, but
what status code should it return? 200?  I'm assuming we don't want
files to trigger on0

I'll try to submit a patch this week.

- Ken Snyder


    Reply to author    Forward  
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.
Tobie Langel  
View profile  
 More options Nov 14 2007, 1:22 pm
From: Tobie Langel <tobie.lan...@gmail.com>
Date: Wed, 14 Nov 2007 10:22:27 -0800
Local: Wed, Nov 14 2007 1:22 pm
Subject: Re: Ticket 10030 - is Ajax.Request.success() broken?

> But what about http pages accessing files?  I was under the impression
> that this is the prime testing situation.

That's a violation of SOP. It's just not possible with Ajax. (Else,
imagine how a website could discretely upload most of your hard-
drive's content).

> One question: We want the file protocol to always trigger onSuccess, but
> what status code should it return? 200?  I'm assuming we don't want
> files to trigger on0

The file: protocol doesn't have http headers (these are set by a
webserver) so calling on0 (or on200) in that case just doesn't make
any sense.

Best,

Tobie


    Reply to author    Forward  
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.
Tobie Langel  
View profile  
 More options Nov 14 2007, 1:39 pm
From: Tobie Langel <tobie.lan...@gmail.com>
Date: Wed, 14 Nov 2007 10:39:47 -0800
Local: Wed, Nov 14 2007 1:39 pm
Subject: Re: Ticket 10030 - is Ajax.Request.success() broken?
Ken, sorry if my last comment sounded a bit harsh - really wasn't my
intention.

Thanks again for your work on this, it really, really helped.

Best,

Tobie

On Nov 14, 7:22 pm, Tobie Langel <tobie.lan...@gmail.com> wrote:


    Reply to author    Forward  
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.
Ken Snyder  
View profile  
 More options Nov 14 2007, 4:05 pm
From: Ken Snyder <kendsny...@gmail.com>
Date: Wed, 14 Nov 2007 14:05:03 -0700
Local: Wed, Nov 14 2007 4:05 pm
Subject: Re: [Prototype-core] Re: Ticket 10030 - is Ajax.Request.success() broken?
Tobie Langel wrote:
> Ken, sorry if my last comment sounded a bit harsh - really wasn't my
> intention.

> Thanks again for your work on this, it really, really helped.

Didn't sound harsh to me.  :D

Ah, yes, I forgot the same origin policy.  location.protocol will make
things simple then.  So you're saying files should always fire onSuccess
and not fire any on### callbacks--right?

- Ken


    Reply to author    Forward  
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.
Ken Snyder  
View profile  
 More options Nov 16 2007, 3:32 pm
From: Ken Snyder <kendsny...@gmail.com>
Date: Fri, 16 Nov 2007 13:32:12 -0700
Local: Fri, Nov 16 2007 3:32 pm
Subject: Re: [Prototype-core] Ticket 10030 - is Ajax.Request.success() broken?
Patch submitted:  http://dev.rubyonrails.org/ticket/10191

- Changed Ajax.Request.respondToReadyState() to fire onSuccess for local
files and on0 + onFailure for network errors
- Changed Ajax.Request.getStatus() to map IE error status codes to 0
- Changed Ajax.Request.success() to define success as a status between
200 and 299

Seems to test fine.  Feed back is welcomed.

- Ken Snyder


    Reply to author    Forward  
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 »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2009 Google