From 76236a15062aa82a4841748e9071eb3c9535ef62 Mon Sep 17 00:00:00 2001 From: John Resig Date: Sun, 24 Jan 2010 22:13:52 -0500 Subject: [PATCH] Use alternative technique for triggering an abort, preventing an exception from being thrown in Firefox. Fixes #5923. --- src/ajax.js | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/ajax.js b/src/ajax.js index d92d26d..754de09 100644 --- a/src/ajax.js +++ b/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.7.10.4