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 | |
353 m_resource->setResponse(resourceResponse); | 351 m_resource->setResponse(resourceResponse); |
354 if (!m_fetcher->canAccessResource(resource, m_options.securityOrigin
.get(), response.url(), ResourceFetcher::ShouldLogAccessControlErrors)) { | 352 if (!m_fetcher->canAccessResource(resource, m_options.securityOrigin
.get(), response.url(), ResourceFetcher::ShouldLogAccessControlErrors)) { |
355 m_fetcher->didReceiveResponse(m_resource, resourceResponse); | 353 m_fetcher->didReceiveResponse(m_resource, resourceResponse); |
356 cancel(ResourceError::cancelledDueToAccessCheckError(KURL(respon
se.url()))); | 354 cancel(ResourceError::cancelledDueToAccessCheckError(KURL(respon
se.url()))); |
357 return; | 355 return; |
358 } | 356 } |
359 } | 357 } |
360 } | 358 } |
361 | 359 |
362 m_resource->responseReceived(resourceResponse, handle.release()); | 360 m_resource->responseReceived(resourceResponse, handle.release()); |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
518 didFinishLoading(0, monotonicallyIncreasingTime(), encodedDataLength); | 516 didFinishLoading(0, monotonicallyIncreasingTime(), encodedDataLength); |
519 } | 517 } |
520 | 518 |
521 ResourceRequest& ResourceLoader::applyOptions(ResourceRequest& request) const | 519 ResourceRequest& ResourceLoader::applyOptions(ResourceRequest& request) const |
522 { | 520 { |
523 request.setAllowStoredCredentials(m_options.allowCredentials == AllowStoredC
redentials); | 521 request.setAllowStoredCredentials(m_options.allowCredentials == AllowStoredC
redentials); |
524 return request; | 522 return request; |
525 } | 523 } |
526 | 524 |
527 } | 525 } |
OLD | NEW |