Fixes #2994. Not finding a transport now fires the error callbacks and doesn't make ajax return false. Had to revise how jsonp and script prefilters & transports work (better separation of concerns). Also took the opportunity to revise jXHR getRequestHeader and abort methods and enabled early transport garbage collection when the request completes.
This commit is contained in:
parent
d9cb69873c
commit
8ab23aec2c
4 changed files with 129 additions and 128 deletions
|
@ -1865,25 +1865,19 @@ test("jQuery ajax - failing cross-domain", function() {
|
|||
|
||||
var i = 2;
|
||||
|
||||
if ( jQuery.ajax({
|
||||
jQuery.ajax({
|
||||
url: 'http://somewebsitethatdoesnotexist-67864863574657654.com',
|
||||
success: function(){ ok( false , "success" ); },
|
||||
error: function(xhr,_,e){ ok( true , "file not found: " + xhr.status + " => " + e ); },
|
||||
complete: function() { if ( ! --i ) start(); }
|
||||
}) === false ) {
|
||||
ok( true , "no transport" );
|
||||
if ( ! --i ) start();
|
||||
}
|
||||
});
|
||||
|
||||
if ( jQuery.ajax({
|
||||
jQuery.ajax({
|
||||
url: 'http://www.google.com',
|
||||
success: function(){ ok( false , "success" ); },
|
||||
error: function(xhr,_,e){ ok( true , "access denied: " + xhr.status + " => " + e ); },
|
||||
complete: function() { if ( ! --i ) start(); }
|
||||
}) === false ) {
|
||||
ok( true , "no transport" );
|
||||
if ( ! --i ) start();
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
|
@ -1937,7 +1931,7 @@ test( "jQuery.ajax - statusCode" , function() {
|
|||
404: function() {
|
||||
ok( ! isSuccess , name );
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
jQuery.each( {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue