Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 Copyright (C) 1998 Lars Knoll (knoll@mpi-hd.mpg.de) | 2 Copyright (C) 1998 Lars Knoll (knoll@mpi-hd.mpg.de) |
| 3 Copyright (C) 2001 Dirk Mueller (mueller@kde.org) | 3 Copyright (C) 2001 Dirk Mueller (mueller@kde.org) |
| 4 Copyright (C) 2002 Waldo Bastian (bastian@kde.org) | 4 Copyright (C) 2002 Waldo Bastian (bastian@kde.org) |
| 5 Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved. | 5 Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved. |
| 6 Copyright (C) 2009 Torch Mobile Inc. http://www.torchmobile.com/ | 6 Copyright (C) 2009 Torch Mobile Inc. http://www.torchmobile.com/ |
| 7 | 7 |
| 8 This library is free software; you can redistribute it and/or | 8 This library is free software; you can redistribute it and/or |
| 9 modify it under the terms of the GNU Library General Public | 9 modify it under the terms of the GNU Library General Public |
| 10 License as published by the Free Software Foundation; either | 10 License as published by the Free Software Foundation; either |
| (...skipping 762 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 773 | 773 |
| 774 ResourcePtr<Resource> ResourceFetcher::revalidateResource(const FetchRequest& re quest, Resource* resource) | 774 ResourcePtr<Resource> ResourceFetcher::revalidateResource(const FetchRequest& re quest, Resource* resource) |
| 775 { | 775 { |
| 776 ASSERT(resource); | 776 ASSERT(resource); |
| 777 ASSERT(resource->inCache()); | 777 ASSERT(resource->inCache()); |
| 778 ASSERT(resource->isLoaded()); | 778 ASSERT(resource->isLoaded()); |
| 779 ASSERT(resource->canUseCacheValidator()); | 779 ASSERT(resource->canUseCacheValidator()); |
| 780 ASSERT(!resource->resourceToRevalidate()); | 780 ASSERT(!resource->resourceToRevalidate()); |
| 781 | 781 |
| 782 ResourceRequest revalidatingRequest(resource->resourceRequest()); | 782 ResourceRequest revalidatingRequest(resource->resourceRequest()); |
| 783 revalidatingRequest.clearHTTPReferrer(); | |
|
Nate Chapin
2014/03/17 16:22:26
This works, though I wonder...is there anything ot
sof
2014/03/17 17:04:39
If the resource is eligible for reuse, then presum
| |
| 783 addAdditionalRequestHeaders(revalidatingRequest, resource->type()); | 784 addAdditionalRequestHeaders(revalidatingRequest, resource->type()); |
| 784 | 785 |
| 785 const AtomicString& lastModified = resource->response().httpHeaderField("Las t-Modified"); | 786 const AtomicString& lastModified = resource->response().httpHeaderField("Las t-Modified"); |
| 786 const AtomicString& eTag = resource->response().httpHeaderField("ETag"); | 787 const AtomicString& eTag = resource->response().httpHeaderField("ETag"); |
| 787 if (!lastModified.isEmpty() || !eTag.isEmpty()) { | 788 if (!lastModified.isEmpty() || !eTag.isEmpty()) { |
| 788 ASSERT(context().cachePolicy(document()) != CachePolicyReload); | 789 ASSERT(context().cachePolicy(document()) != CachePolicyReload); |
| 789 if (context().cachePolicy(document()) == CachePolicyRevalidate) | 790 if (context().cachePolicy(document()) == CachePolicyRevalidate) |
| 790 revalidatingRequest.setHTTPHeaderField("Cache-Control", "max-age=0") ; | 791 revalidatingRequest.setHTTPHeaderField("Cache-Control", "max-age=0") ; |
| 791 if (!lastModified.isEmpty()) | 792 if (!lastModified.isEmpty()) |
| 792 revalidatingRequest.setHTTPHeaderField("If-Modified-Since", lastModi fied); | 793 revalidatingRequest.setHTTPHeaderField("If-Modified-Since", lastModi fied); |
| (...skipping 606 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1399 case Revalidate: | 1400 case Revalidate: |
| 1400 ++m_revalidateCount; | 1401 ++m_revalidateCount; |
| 1401 return; | 1402 return; |
| 1402 case Use: | 1403 case Use: |
| 1403 ++m_useCount; | 1404 ++m_useCount; |
| 1404 return; | 1405 return; |
| 1405 } | 1406 } |
| 1406 } | 1407 } |
| 1407 | 1408 |
| 1408 } | 1409 } |
| OLD | NEW |