I am using Prototype 1.6.0.2.

I came across this the other day while writing javascript for a web
page when the webserver went down.  I was making an asynchronous
request via Ajax.Request and lost communication to the server.  I
received a different outcome in IE than I did in FF.

When a loss of communication occurs, the status code that shows up in
FF is 0.
When a loss of communication occurs, the status code that shows up in
IE is 12029.

The code 12029 in IE is actually a "WinInet Error Code" for
"ERROR_INTERNET_CANNOT_CONNECT" which, I know, is Microsoft's own
way...

My problem is NOT specifically that the error codes are different, but
rather when a loss of communication occurs, the Ajax.Request issues an
"onFailure" in IE, but an "onSuccess" in FF.  Plain and simple:  loss
of communication is not a succesful response.

I looked a little deeper and found where Prototype checks for a
successful response and it uses the success() and getStatus()
functions as such:

  success: function() {
    var status = this.getStatus();
    return !status || (status >= 200 && status < 300);
  },

  getStatus: function() {
    try {
      return this.transport.status || 0;
    } catch (e) { return 0 }
  },

I traced it and found that in FF, an error is caught in getStatus()
and so 0 is returned.  And when !0 is evaluated in success(), its
TRUE!

So, I would like to get feedback on the idea of the following solution
to deal with the inconsistency:

Change getStatus() so that 0 is not returned.  -1 would do the trick.

Thoughts?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Prototype: Core" group.
To post to this group, send email to prototype-core@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/prototype-core?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to