Landed a fix for timeouts not being aborted properly. Fixes jQuery bug #3874.
This commit is contained in:
parent
db10da345e
commit
00b70c7527
13
src/ajax.js
13
src/ajax.js
|
@ -380,6 +380,9 @@ jQuery.extend({
|
|||
// Fire the complete handlers
|
||||
complete();
|
||||
|
||||
if ( isTimeout )
|
||||
xhr.abort();
|
||||
|
||||
// Stop memory leaks
|
||||
if ( s.async )
|
||||
xhr = null;
|
||||
|
@ -394,14 +397,8 @@ jQuery.extend({
|
|||
if ( s.timeout > 0 )
|
||||
setTimeout(function(){
|
||||
// Check to see if the request is still happening
|
||||
if ( xhr ) {
|
||||
if( !requestDone )
|
||||
onreadystatechange( "timeout" );
|
||||
|
||||
// Cancel the request
|
||||
if ( xhr )
|
||||
xhr.abort();
|
||||
}
|
||||
if ( xhr && !requestDone )
|
||||
onreadystatechange( "timeout" );
|
||||
}, s.timeout);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue