Fix for #991
This commit is contained in:
parent
1878aa9644
commit
fade976946
|
@ -647,6 +647,13 @@ jQuery.extend({
|
||||||
// The transfer is complete and the data is available, or the request timed out
|
// The transfer is complete and the data is available, or the request timed out
|
||||||
if ( xml && (xml.readyState == 4 || isTimeout == "timeout") ) {
|
if ( xml && (xml.readyState == 4 || isTimeout == "timeout") ) {
|
||||||
requestDone = true;
|
requestDone = true;
|
||||||
|
|
||||||
|
// clear poll interval
|
||||||
|
if (ival) {
|
||||||
|
clearInterval(ival);
|
||||||
|
ival = null;
|
||||||
|
}
|
||||||
|
|
||||||
var status;
|
var status;
|
||||||
try {
|
try {
|
||||||
status = jQuery.httpSuccess( xml ) && isTimeout != "timeout" ?
|
status = jQuery.httpSuccess( xml ) && isTimeout != "timeout" ?
|
||||||
|
@ -692,11 +699,13 @@ jQuery.extend({
|
||||||
s.complete(xml, status);
|
s.complete(xml, status);
|
||||||
|
|
||||||
// Stop memory leaks
|
// Stop memory leaks
|
||||||
xml.onreadystatechange = function(){};
|
if(s.async)
|
||||||
xml = null;
|
xml = null;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
xml.onreadystatechange = onreadystatechange;
|
|
||||||
|
// don't attach the handler to the request, just poll it instead
|
||||||
|
var ival = setInterval(onreadystatechange, 13);
|
||||||
|
|
||||||
// Timeout checker
|
// Timeout checker
|
||||||
if ( s.timeout > 0 )
|
if ( s.timeout > 0 )
|
||||||
|
@ -711,12 +720,9 @@ jQuery.extend({
|
||||||
}
|
}
|
||||||
}, s.timeout);
|
}, s.timeout);
|
||||||
|
|
||||||
// save non-leaking reference
|
|
||||||
var xml2 = xml;
|
|
||||||
|
|
||||||
// Send the data
|
// Send the data
|
||||||
try {
|
try {
|
||||||
xml2.send(s.data);
|
xml.send(s.data);
|
||||||
} catch(e) {
|
} catch(e) {
|
||||||
jQuery.handleError(s, xml, null, e);
|
jQuery.handleError(s, xml, null, e);
|
||||||
}
|
}
|
||||||
|
@ -726,7 +732,7 @@ jQuery.extend({
|
||||||
onreadystatechange();
|
onreadystatechange();
|
||||||
|
|
||||||
// return XMLHttpRequest to allow aborting the request etc.
|
// return XMLHttpRequest to allow aborting the request etc.
|
||||||
return xml2;
|
return xml;
|
||||||
},
|
},
|
||||||
|
|
||||||
handleError: function( s, xml, status, e ) {
|
handleError: function( s, xml, status, e ) {
|
||||||
|
|
Loading…
Reference in a new issue