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 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
334 m_request.setSkipServiceWorker(true); | 334 m_request.setSkipServiceWorker(true); |
335 WrappedResourceRequest wrappedRequest(m_request); | 335 WrappedResourceRequest wrappedRequest(m_request); |
336 m_loader->loadAsynchronously(wrappedRequest, this); | 336 m_loader->loadAsynchronously(wrappedRequest, this); |
337 return; | 337 return; |
338 } | 338 } |
339 } else { | 339 } else { |
340 // If the response successfully validated a cached resource, perform | 340 // If the response successfully validated a cached resource, perform |
341 // the access control with respect to it. Need to do this right here | 341 // the access control with respect to it. Need to do this right here |
342 // before the resource switches clients over to that validated resou
rce. | 342 // before the resource switches clients over to that validated resou
rce. |
343 Resource* resource = m_resource; | 343 Resource* resource = m_resource; |
344 if (resource->isCacheValidator() && resourceResponse.httpStatusCode(
) == 304) | 344 if (!resource->isCacheValidator() || resourceResponse.httpStatusCode
() != 304) |
345 resource = m_resource->resourceToRevalidate(); | |
346 else | |
347 m_resource->setResponse(resourceResponse); | 345 m_resource->setResponse(resourceResponse); |
348 if (!m_fetcher->canAccessResource(resource, m_options.securityOrigin
.get(), response.url(), ResourceFetcher::ShouldLogAccessControlErrors)) { | 346 if (!m_fetcher->canAccessResource(resource, m_options.securityOrigin
.get(), response.url(), ResourceFetcher::ShouldLogAccessControlErrors)) { |
349 m_fetcher->didReceiveResponse(m_resource, resourceResponse); | 347 m_fetcher->didReceiveResponse(m_resource, resourceResponse); |
350 cancel(ResourceError::cancelledDueToAccessCheckError(KURL(respon
se.url()))); | 348 cancel(ResourceError::cancelledDueToAccessCheckError(KURL(respon
se.url()))); |
351 return; | 349 return; |
352 } | 350 } |
353 } | 351 } |
354 } | 352 } |
355 | 353 |
356 m_resource->responseReceived(resourceResponse, handle.release()); | 354 m_resource->responseReceived(resourceResponse, handle.release()); |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
512 didFinishLoading(0, monotonicallyIncreasingTime(), encodedDataLength); | 510 didFinishLoading(0, monotonicallyIncreasingTime(), encodedDataLength); |
513 } | 511 } |
514 | 512 |
515 ResourceRequest& ResourceLoader::applyOptions(ResourceRequest& request) const | 513 ResourceRequest& ResourceLoader::applyOptions(ResourceRequest& request) const |
516 { | 514 { |
517 request.setAllowStoredCredentials(m_options.allowCredentials == AllowStoredC
redentials); | 515 request.setAllowStoredCredentials(m_options.allowCredentials == AllowStoredC
redentials); |
518 return request; | 516 return request; |
519 } | 517 } |
520 | 518 |
521 } | 519 } |
OLD | NEW |