- try { // Firefox throws an exception when accessing statusText for faulty cross-domain requests
-
- statusText = xhr.statusText;
-
- } catch( e ) {
-
- statusText = ""; // We normalize with Webkit giving an empty statusText
-
- }
-
- // Filter status for non standard behaviours
- // (so many they seem to be the actual "standard")
- status =
- // Opera returns 0 when it should be 304
- // Webkit returns 0 for failing cross-domain no matter the real status
- status === 0 ?
- (
- ! s.crossDomain || statusText ? // Webkit, Firefox: filter out faulty cross-domain requests
+ // Construct response list
+ if ( xml && xml.documentElement /* #4958 */ ) {
+ responses.xml = xml;
+ }
+ 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
+ status =
+ // Most browsers return 0 when it should be 200 for local files
+ // Opera returns 0 when it should be 304
+ // Webkit returns 0 for failing cross-domain no matter the real status
+ !status ?
+ // All: for local files, 0 is a success
+ ( location.protocol === "file:" ? 200 : (
+ // Webkit, Firefox: filter out faulty cross-domain requests
+ !s.crossDomain || statusText ?
+ (
+ // Opera: filter out real aborts #6060
+ responseHeaders ?
+ 304 :
+ 0
+ ) :
+ // We assume 302 but could be anything cross-domain related
+ 302
+ ) ) :