Skip to content

Commit

Permalink
Landed a fix for timeouts not being aborted properly. Fixes jQuery bug
Browse files Browse the repository at this point in the history
  • Loading branch information
jeresig committed Jan 21, 2009
1 parent db10da3 commit 00b70c7
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions src/ajax.js
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,9 @@ jQuery.extend({
// Fire the complete handlers
complete();

if ( isTimeout )
xhr.abort();

// Stop memory leaks
if ( s.async )
xhr = null;
Expand All @@ -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);
}

Expand Down

0 comments on commit 00b70c7

Please sign in to comment.