File tree Expand file tree Collapse file tree 2 files changed +23
-0
lines changed
Expand file tree Collapse file tree 2 files changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -644,6 +644,12 @@ jQuery.extend({
644644 if ( fireGlobals ) {
645645 globalEventContext . trigger ( "ajaxSend" , [ jqXHR , s ] ) ;
646646 }
647+
648+ // If request was aborted inside ajaxSend, stop there
649+ if ( state === 2 ) {
650+ return jqXHR ;
651+ }
652+
647653 // Timeout
648654 if ( s . async && s . timeout > 0 ) {
649655 timeoutTimer = setTimeout ( function ( ) {
Original file line number Diff line number Diff line change @@ -435,6 +435,23 @@ module( "ajax", {
435435 } ;
436436 } ) ;
437437
438+ ajaxTest ( "#15160 - jQuery.ajax() - request manually aborted in ajaxSend" , 3 , {
439+ setup : function ( ) {
440+ jQuery ( document ) . on ( "ajaxSend" , function ( e , jqXHR ) {
441+ jqXHR . abort ( ) ;
442+ } ) ;
443+
444+ jQuery ( document ) . on ( "ajaxError ajaxComplete" , function ( e , jqXHR ) {
445+ equal ( jqXHR . statusText , "abort" , "jqXHR.statusText equals abort on global ajaxComplete and ajaxError events" ) ;
446+ } ) ;
447+ } ,
448+ url : url ( "data/name.html" ) ,
449+ error : true ,
450+ complete : function ( ) {
451+ ok ( true , "complete" ) ;
452+ }
453+ } ) ;
454+
438455 ajaxTest ( "jQuery.ajax() - context modification" , 1 , {
439456 url : url ( "data/name.html" ) ,
440457 context : { } ,
You can’t perform that action at this time.
0 commit comments