File tree 2 files changed +23
-0
lines changed 2 files changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -627,6 +627,12 @@ jQuery.extend({
627
627
if ( fireGlobals ) {
628
628
globalEventContext . trigger ( "ajaxSend" , [ jqXHR , s ] ) ;
629
629
}
630
+
631
+ // If request was aborted inside ajaxSend, stop there
632
+ if ( state === 2 ) {
633
+ return jqXHR ;
634
+ }
635
+
630
636
// Timeout
631
637
if ( s . async && s . timeout > 0 ) {
632
638
timeoutTimer = setTimeout ( function ( ) {
Original file line number Diff line number Diff line change @@ -440,6 +440,23 @@ module( "ajax", {
440
440
} ;
441
441
} ) ;
442
442
443
+ ajaxTest ( "#15160 - jQuery.ajax() - request manually aborted in ajaxSend" , 3 , {
444
+ setup : function ( ) {
445
+ jQuery ( document ) . on ( "ajaxSend" , function ( e , jqXHR ) {
446
+ jqXHR . abort ( ) ;
447
+ } ) ;
448
+
449
+ jQuery ( document ) . on ( "ajaxError ajaxComplete" , function ( e , jqXHR ) {
450
+ equal ( jqXHR . statusText , "abort" , "jqXHR.statusText equals abort on global ajaxComplete and ajaxError events" ) ;
451
+ } ) ;
452
+ } ,
453
+ url : url ( "data/name.html" ) ,
454
+ error : true ,
455
+ complete : function ( ) {
456
+ ok ( true , "complete" ) ;
457
+ }
458
+ } ) ;
459
+
443
460
ajaxTest ( "jQuery.ajax() - context modification" , 1 , {
444
461
url : url ( "data/name.html" ) ,
445
462
context : { } ,
You can’t perform that action at this time.
0 commit comments