Commit 00b70c75 authored by John Resig's avatar John Resig

Landed a fix for timeouts not being aborted properly. Fixes jQuery bug #3874.

parent db10da34
...@@ -380,6 +380,9 @@ jQuery.extend({ ...@@ -380,6 +380,9 @@ jQuery.extend({
// Fire the complete handlers // Fire the complete handlers
complete(); complete();
if ( isTimeout )
xhr.abort();
// Stop memory leaks // Stop memory leaks
if ( s.async ) if ( s.async )
xhr = null; xhr = null;
...@@ -394,14 +397,8 @@ jQuery.extend({ ...@@ -394,14 +397,8 @@ jQuery.extend({
if ( s.timeout > 0 ) if ( s.timeout > 0 )
setTimeout(function(){ setTimeout(function(){
// Check to see if the request is still happening // Check to see if the request is still happening
if ( xhr ) { if ( xhr && !requestDone )
if( !requestDone ) onreadystatechange( "timeout" );
onreadystatechange( "timeout" );
// Cancel the request
if ( xhr )
xhr.abort();
}
}, s.timeout); }, s.timeout);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment