Skip to content
Permalink
Browse files

Use alternative technique for triggering an abort, preventing an exce…

…ption from being thrown in Firefox. Fixes #5923.
  • Loading branch information
jeresig committed Jan 25, 2010
1 parent c639405 commit 76236a15062aa82a4841748e9071eb3c9535ef62
Showing with 2 additions and 5 deletions.
  1. +2 −5 src/ajax.js
@@ -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 ) {
@@ -458,12 +458,9 @@ jQuery.extend({
xhr.abort = function() {
if ( xhr ) {
oldAbort.call( xhr );
if ( xhr ) {
xhr.readyState = 0;
}
}

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

1 comment on commit 76236a1

@StevenBlack

This comment has been minimized.

Copy link

@StevenBlack StevenBlack commented on 76236a1 Jan 25, 2010

YES! Thank you, John.

Please sign in to comment.
You can’t perform that action at this time.