Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(44)

Side by Side Diff: third_party/WebKit/Source/core/fetch/ResourceLoader.cpp

Issue 1398523004: Revalidate using the same Resource, attempt #3 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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 }
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/fetch/ResourceFetcher.cpp ('k') | third_party/WebKit/Source/core/fetch/ScriptResource.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698