Use alternative technique for triggering an abort, preventing an exception from being thrown in Firefox. Fixes #5923.

This commit is contained in:
John Resig 2010-01-24 22:13:52 -05:00
parent c639405c4d
commit 76236a1506

View file

@ -392,7 +392,7 @@ jQuery.extend({
// Wait for a response to come back // Wait for a response to come back
var onreadystatechange = xhr.onreadystatechange = function( isTimeout ) { var onreadystatechange = xhr.onreadystatechange = function( isTimeout ) {
// The request was aborted // The request was aborted
if ( !xhr || xhr.readyState === 0 ) { if ( !xhr || xhr.readyState === 0 || isTimeout === "abort" ) {
// Opera doesn't call onreadystatechange before this point // Opera doesn't call onreadystatechange before this point
// so we simulate the call // so we simulate the call
if ( !requestDone ) { if ( !requestDone ) {
@ -458,12 +458,9 @@ jQuery.extend({
xhr.abort = function() { xhr.abort = function() {
if ( xhr ) { if ( xhr ) {
oldAbort.call( xhr ); oldAbort.call( xhr );
if ( xhr ) {
xhr.readyState = 0;
}
} }
onreadystatechange(); onreadystatechange( "abort" );
}; };
} catch(e) { } } catch(e) { }