Skip to content

Commit

Permalink
One more fix for #1014
Browse files Browse the repository at this point in the history
  • Loading branch information
jfarcand committed Apr 10, 2013
1 parent 50429fd commit 9767d66
Showing 1 changed file with 20 additions and 14 deletions.
34 changes: 20 additions & 14 deletions modules/jquery/src/main/webapp/jquery/jquery.atmosphere.js
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ jQuery.atmosphere = function() {
error: null,
request : null,
partialMessage : "",
errorHandled: false,
id : 0
};

Expand Down Expand Up @@ -1434,27 +1435,28 @@ jQuery.atmosphere = function() {
_response.transport = rq.transport;
}

if (!jQuery.browser.msie) {
ajaxRequest.onerror = function() {
_response.error = true;
try {
_response.status = XMLHttpRequest.status;
} catch(e) {
_response.status = 500;
}
ajaxRequest.onerror = function() {
_response.error = true;
try {
_response.status = XMLHttpRequest.status;
} catch(e) {
_response.status = 500;
}

if (!_response.status) {
_response.status = 500;
}
_clearState();
if (!_response.status) {
_response.status = 500;
}
_clearState();

if (!_response.errorHandled) {
if (rq.reconnect && _requestCount++ < rq.maxReconnectOnClose) {
_reconnect(ajaxRequest, rq, true);
} else {
_onError(0, "maxReconnectOnClose reached");
}
};
}
}
_response.errorHandled = true;
};

ajaxRequest.onreadystatechange = function() {
if (_abordingConnection) {
Expand Down Expand Up @@ -1505,6 +1507,10 @@ jQuery.atmosphere = function() {

var status = ajaxRequest.status > 1000 ? ajaxRequest.status = 0 : ajaxRequest.status;
// Allow recovering from cached content.
clearTimeout(rq.id);

// Prevent onerror callback to be called
_response.errorHandled = true;
if (status < 400 && _requestCount++ < _request.maxReconnectOnClose) {
_reconnect(ajaxRequest, rq, false);
} else {
Expand Down

0 comments on commit 9767d66

Please sign in to comment.