Skip to content

Commit

Permalink
Use alternative technique for triggering an abort, preventing an exce…
Browse files Browse the repository at this point in the history
…ption from being thrown in Firefox. Fixes #5923.
  • Loading branch information
jeresig committed Jan 25, 2010
1 parent c639405 commit 76236a1
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions src/ajax.js
Expand Up @@ -392,7 +392,7 @@ jQuery.extend({
// Wait for a response to come back
var onreadystatechange = xhr.onreadystatechange = function( isTimeout ) {
// The request was aborted
if ( !xhr || xhr.readyState === 0 ) {
if ( !xhr || xhr.readyState === 0 || isTimeout === "abort" ) {
// Opera doesn't call onreadystatechange before this point
// so we simulate the call
if ( !requestDone ) {
Expand Down Expand Up @@ -458,12 +458,9 @@ jQuery.extend({
xhr.abort = function() {
if ( xhr ) {
oldAbort.call( xhr );
if ( xhr ) {
xhr.readyState = 0;
}
}

onreadystatechange();
onreadystatechange( "abort" );
};
} catch(e) { }

Expand Down

1 comment on commit 76236a1

@StevenBlack
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

YES! Thank you, John.

Please sign in to comment.