OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006, 2007, 2010, 2011 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007, 2010, 2011 Apple Inc. All rights reserved. |
3 * (C) 2007 Graham Dennis (graham.dennis@gmail.com) | 3 * (C) 2007 Graham Dennis (graham.dennis@gmail.com) |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * | 8 * |
9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
340 ASSERT(m_loader); | 340 ASSERT(m_loader); |
341 WrappedResourceRequest wrappedRequest(m_request); | 341 WrappedResourceRequest wrappedRequest(m_request); |
342 m_loader->loadAsynchronously(wrappedRequest, this); | 342 m_loader->loadAsynchronously(wrappedRequest, this); |
343 return; | 343 return; |
344 } | 344 } |
345 } else { | 345 } else { |
346 // If the response successfully validated a cached resource, perform | 346 // If the response successfully validated a cached resource, perform |
347 // the access control with respect to it. Need to do this right here | 347 // the access control with respect to it. Need to do this right here |
348 // before the resource switches clients over to that validated resou
rce. | 348 // before the resource switches clients over to that validated resou
rce. |
349 Resource* resource = m_resource; | 349 Resource* resource = m_resource; |
350 if (!resource->isCacheValidator() || resourceResponse.httpStatusCode
() != 304) | 350 if (resource->isCacheValidator() && resourceResponse.httpStatusCode(
) == 304) |
| 351 resource = m_resource->resourceToRevalidate(); |
| 352 else |
351 m_resource->setResponse(resourceResponse); | 353 m_resource->setResponse(resourceResponse); |
352 if (!m_fetcher->canAccessResource(resource, m_options.securityOrigin
.get(), response.url(), ResourceFetcher::ShouldLogAccessControlErrors)) { | 354 if (!m_fetcher->canAccessResource(resource, m_options.securityOrigin
.get(), response.url(), ResourceFetcher::ShouldLogAccessControlErrors)) { |
353 m_fetcher->didReceiveResponse(m_resource, resourceResponse); | 355 m_fetcher->didReceiveResponse(m_resource, resourceResponse); |
354 cancel(ResourceError::cancelledDueToAccessCheckError(KURL(respon
se.url()))); | 356 cancel(ResourceError::cancelledDueToAccessCheckError(KURL(respon
se.url()))); |
355 return; | 357 return; |
356 } | 358 } |
357 } | 359 } |
358 } | 360 } |
359 | 361 |
360 m_resource->responseReceived(resourceResponse, handle.release()); | 362 m_resource->responseReceived(resourceResponse, handle.release()); |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
516 didFinishLoading(0, monotonicallyIncreasingTime(), encodedDataLength); | 518 didFinishLoading(0, monotonicallyIncreasingTime(), encodedDataLength); |
517 } | 519 } |
518 | 520 |
519 ResourceRequest& ResourceLoader::applyOptions(ResourceRequest& request) const | 521 ResourceRequest& ResourceLoader::applyOptions(ResourceRequest& request) const |
520 { | 522 { |
521 request.setAllowStoredCredentials(m_options.allowCredentials == AllowStoredC
redentials); | 523 request.setAllowStoredCredentials(m_options.allowCredentials == AllowStoredC
redentials); |
522 return request; | 524 return request; |
523 } | 525 } |
524 | 526 |
525 } | 527 } |
OLD | NEW |