mirror of
https://github.com/jquery/jquery.git
synced 2024-11-23 02:54:22 +00:00
Remove old try...catch for old FF
This commit is contained in:
parent
c6de821070
commit
ff951314e3
@ -90,59 +90,49 @@ if ( xhrSupported ) {
|
||||
callback = function( _, isAbort ) {
|
||||
var status, statusText, responses;
|
||||
|
||||
// Firefox throws exceptions when accessing properties
|
||||
// of an xhr when a network error occurred
|
||||
// http://helpful.knobs-dials.com/index.php/Component_returned_failure_code:_0x80040111_(NS_ERROR_NOT_AVAILABLE)
|
||||
try {
|
||||
// Was never called and is aborted or complete
|
||||
if ( callback && ( isAbort || xhr.readyState === 4 ) ) {
|
||||
// Clean up
|
||||
delete xhrCallbacks[ id ];
|
||||
callback = undefined;
|
||||
xhr.onreadystatechange = jQuery.noop;
|
||||
|
||||
// Was never called and is aborted or complete
|
||||
if ( callback && ( isAbort || xhr.readyState === 4 ) ) {
|
||||
// Clean up
|
||||
delete xhrCallbacks[ id ];
|
||||
callback = undefined;
|
||||
xhr.onreadystatechange = jQuery.noop;
|
||||
|
||||
// Abort manually if needed
|
||||
if ( isAbort ) {
|
||||
if ( xhr.readyState !== 4 ) {
|
||||
xhr.abort();
|
||||
}
|
||||
} else {
|
||||
responses = {};
|
||||
status = xhr.status;
|
||||
|
||||
// Support: IE<10
|
||||
// Accessing binary-data responseText throws an exception
|
||||
// (#11426)
|
||||
if ( typeof xhr.responseText === "string" ) {
|
||||
responses.text = xhr.responseText;
|
||||
}
|
||||
|
||||
// Firefox throws an exception when accessing
|
||||
// statusText for faulty cross-domain requests
|
||||
try {
|
||||
statusText = xhr.statusText;
|
||||
} catch( e ) {
|
||||
// We normalize with Webkit giving an empty statusText
|
||||
statusText = "";
|
||||
}
|
||||
|
||||
// Filter status for non standard behaviors
|
||||
|
||||
// If the request is local and we have data: assume a success
|
||||
// (success with no data won't get notified, that's the best we
|
||||
// can do given current implementations)
|
||||
if ( !status && options.isLocal && !options.crossDomain ) {
|
||||
status = responses.text ? 200 : 404;
|
||||
// IE - #1450: sometimes returns 1223 when it should be 204
|
||||
} else if ( status === 1223 ) {
|
||||
status = 204;
|
||||
}
|
||||
// Abort manually if needed
|
||||
if ( isAbort ) {
|
||||
if ( xhr.readyState !== 4 ) {
|
||||
xhr.abort();
|
||||
}
|
||||
} else {
|
||||
responses = {};
|
||||
status = xhr.status;
|
||||
|
||||
// Support: IE<10
|
||||
// Accessing binary-data responseText throws an exception
|
||||
// (#11426)
|
||||
if ( typeof xhr.responseText === "string" ) {
|
||||
responses.text = xhr.responseText;
|
||||
}
|
||||
|
||||
// Firefox throws an exception when accessing
|
||||
// statusText for faulty cross-domain requests
|
||||
try {
|
||||
statusText = xhr.statusText;
|
||||
} catch( e ) {
|
||||
// We normalize with Webkit giving an empty statusText
|
||||
statusText = "";
|
||||
}
|
||||
|
||||
// Filter status for non standard behaviors
|
||||
|
||||
// If the request is local and we have data: assume a success
|
||||
// (success with no data won't get notified, that's the best we
|
||||
// can do given current implementations)
|
||||
if ( !status && options.isLocal && !options.crossDomain ) {
|
||||
status = responses.text ? 200 : 404;
|
||||
// IE - #1450: sometimes returns 1223 when it should be 204
|
||||
} else if ( status === 1223 ) {
|
||||
status = 204;
|
||||
}
|
||||
}
|
||||
} catch( firefoxAccessException ) {
|
||||
if ( !isAbort ) {
|
||||
complete( -1, firefoxAccessException );
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user