Remove old try...catch for old FF

This commit is contained in:
Oleg 2013-11-08 22:32:35 +01:00
parent c6de821070
commit ff951314e3

View File

@ -90,59 +90,49 @@ if ( xhrSupported ) {
callback = function( _, isAbort ) { callback = function( _, isAbort ) {
var status, statusText, responses; var status, statusText, responses;
// Firefox throws exceptions when accessing properties // Was never called and is aborted or complete
// of an xhr when a network error occurred if ( callback && ( isAbort || xhr.readyState === 4 ) ) {
// http://helpful.knobs-dials.com/index.php/Component_returned_failure_code:_0x80040111_(NS_ERROR_NOT_AVAILABLE) // Clean up
try { delete xhrCallbacks[ id ];
callback = undefined;
xhr.onreadystatechange = jQuery.noop;
// Was never called and is aborted or complete // Abort manually if needed
if ( callback && ( isAbort || xhr.readyState === 4 ) ) { if ( isAbort ) {
// Clean up if ( xhr.readyState !== 4 ) {
delete xhrCallbacks[ id ]; xhr.abort();
callback = undefined; }
xhr.onreadystatechange = jQuery.noop; } else {
responses = {};
// Abort manually if needed status = xhr.status;
if ( isAbort ) {
if ( xhr.readyState !== 4 ) { // Support: IE<10
xhr.abort(); // Accessing binary-data responseText throws an exception
} // (#11426)
} else { if ( typeof xhr.responseText === "string" ) {
responses = {}; responses.text = xhr.responseText;
status = xhr.status; }
// Support: IE<10 // Firefox throws an exception when accessing
// Accessing binary-data responseText throws an exception // statusText for faulty cross-domain requests
// (#11426) try {
if ( typeof xhr.responseText === "string" ) { statusText = xhr.statusText;
responses.text = xhr.responseText; } catch( e ) {
} // We normalize with Webkit giving an empty statusText
statusText = "";
// Firefox throws an exception when accessing }
// statusText for faulty cross-domain requests
try { // Filter status for non standard behaviors
statusText = xhr.statusText;
} catch( e ) { // If the request is local and we have data: assume a success
// We normalize with Webkit giving an empty statusText // (success with no data won't get notified, that's the best we
statusText = ""; // can do given current implementations)
} if ( !status && options.isLocal && !options.crossDomain ) {
status = responses.text ? 200 : 404;
// Filter status for non standard behaviors // IE - #1450: sometimes returns 1223 when it should be 204
} else if ( status === 1223 ) {
// If the request is local and we have data: assume a success status = 204;
// (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 );
} }
} }