( status, nativeStatusText, responses, headers )
| 7368 | // It is defined here because jslint complains if it is declared |
| 7369 | // at the end of the function (which would be more logical and readable) |
| 7370 | function done( status, nativeStatusText, responses, headers ) { |
| 7371 | |
| 7372 | // Called once |
| 7373 | if ( state === 2 ) { |
| 7374 | return; |
| 7375 | } |
| 7376 | |
| 7377 | // State is "done" now |
| 7378 | state = 2; |
| 7379 | |
| 7380 | // Clear timeout if it exists |
| 7381 | if ( timeoutTimer ) { |
| 7382 | clearTimeout( timeoutTimer ); |
| 7383 | } |
| 7384 | |
| 7385 | // Dereference transport for early garbage collection |
| 7386 | // (no matter how long the jqXHR object will be used) |
| 7387 | transport = undefined; |
| 7388 | |
| 7389 | // Cache response headers |
| 7390 | responseHeadersString = headers || ""; |
| 7391 | |
| 7392 | // Set readyState |
| 7393 | jqXHR.readyState = status > 0 ? 4 : 0; |
| 7394 | |
| 7395 | var isSuccess, |
| 7396 | success, |
| 7397 | error, |
| 7398 | statusText = nativeStatusText, |
| 7399 | response = responses ? ajaxHandleResponses( s, jqXHR, responses ) : undefined, |
| 7400 | lastModified, |
| 7401 | etag; |
| 7402 | |
| 7403 | // If successful, handle type chaining |
| 7404 | if ( status >= 200 && status < 300 || status === 304 ) { |
| 7405 | |
| 7406 | // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode. |
| 7407 | if ( s.ifModified ) { |
| 7408 | |
| 7409 | if ( ( lastModified = jqXHR.getResponseHeader( "Last-Modified" ) ) ) { |
| 7410 | jQuery.lastModified[ ifModifiedKey ] = lastModified; |
| 7411 | } |
| 7412 | if ( ( etag = jqXHR.getResponseHeader( "Etag" ) ) ) { |
| 7413 | jQuery.etag[ ifModifiedKey ] = etag; |
| 7414 | } |
| 7415 | } |
| 7416 | |
| 7417 | // If not modified |
| 7418 | if ( status === 304 ) { |
| 7419 | |
| 7420 | statusText = "notmodified"; |
| 7421 | isSuccess = true; |
| 7422 | |
| 7423 | // If we have data |
| 7424 | } else { |
| 7425 | |
| 7426 | try { |
| 7427 | success = ajaxConvert( s, response ); |
no test coverage detected