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 905 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
916 // Certain requests (e.g., XHRs) might have manually set headers that requir
e revalidation. | 916 // Certain requests (e.g., XHRs) might have manually set headers that requir
e revalidation. |
917 // FIXME: In theory, this should be a Revalidate case. In practice, the Memo
ryCache revalidation path assumes a whole bunch | 917 // FIXME: In theory, this should be a Revalidate case. In practice, the Memo
ryCache revalidation path assumes a whole bunch |
918 // of things about how revalidation works that manual headers violate, so pu
nt to Reload instead. | 918 // of things about how revalidation works that manual headers violate, so pu
nt to Reload instead. |
919 if (request.isConditional()) | 919 if (request.isConditional()) |
920 return Reload; | 920 return Reload; |
921 | 921 |
922 // Don't reload resources while pasting. | 922 // Don't reload resources while pasting. |
923 if (m_allowStaleResources) | 923 if (m_allowStaleResources) |
924 return Use; | 924 return Use; |
925 | 925 |
| 926 // If fetching a resource with a different 'CORS enabled' flag, reload. |
| 927 if (type != Resource::MainResource && options.corsEnabled != existingResourc
e->options().corsEnabled) |
| 928 return Reload; |
| 929 |
926 // Always use preloads. | 930 // Always use preloads. |
927 if (existingResource->isPreloaded()) | 931 if (existingResource->isPreloaded()) |
928 return Use; | 932 return Use; |
929 | 933 |
930 // CachePolicyHistoryBuffer uses the cache no matter what. | 934 // CachePolicyHistoryBuffer uses the cache no matter what. |
931 CachePolicy cachePolicy = context().cachePolicy(document()); | 935 CachePolicy cachePolicy = context().cachePolicy(document()); |
932 if (cachePolicy == CachePolicyHistoryBuffer) | 936 if (cachePolicy == CachePolicyHistoryBuffer) |
933 return Use; | 937 return Use; |
934 | 938 |
935 // Don't reuse resources with Cache-control: no-store. | 939 // Don't reuse resources with Cache-control: no-store. |
936 if (existingResource->hasCacheControlNoStoreHeader()) { | 940 if (existingResource->hasCacheControlNoStoreHeader()) { |
937 WTF_LOG(ResourceLoading, "ResourceFetcher::determineRevalidationPolicy r
eloading due to Cache-control: no-store."); | 941 WTF_LOG(ResourceLoading, "ResourceFetcher::determineRevalidationPolicy r
eloading due to Cache-control: no-store."); |
938 return Reload; | 942 return Reload; |
939 } | 943 } |
940 | 944 |
941 // If fetching a resource with a different 'CORS enabled' flag, reload. | |
942 if (type != Resource::MainResource && options.corsEnabled != existingResourc
e->options().corsEnabled) | |
943 return Reload; | |
944 | |
945 // If credentials were sent with the previous request and won't be | 945 // If credentials were sent with the previous request and won't be |
946 // with this one, or vice versa, re-fetch the resource. | 946 // with this one, or vice versa, re-fetch the resource. |
947 // | 947 // |
948 // This helps with the case where the server sends back | 948 // This helps with the case where the server sends back |
949 // "Access-Control-Allow-Origin: *" all the time, but some of the | 949 // "Access-Control-Allow-Origin: *" all the time, but some of the |
950 // client's requests are made without CORS and some with. | 950 // client's requests are made without CORS and some with. |
951 if (existingResource->resourceRequest().allowStoredCredentials() != request.
allowStoredCredentials()) { | 951 if (existingResource->resourceRequest().allowStoredCredentials() != request.
allowStoredCredentials()) { |
952 WTF_LOG(ResourceLoading, "ResourceFetcher::determineRevalidationPolicy r
eloading due to difference in credentials settings."); | 952 WTF_LOG(ResourceLoading, "ResourceFetcher::determineRevalidationPolicy r
eloading due to difference in credentials settings."); |
953 return Reload; | 953 return Reload; |
954 } | 954 } |
(...skipping 502 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1457 } | 1457 } |
1458 } | 1458 } |
1459 | 1459 |
1460 void ResourceFetcher::trace(Visitor* visitor) | 1460 void ResourceFetcher::trace(Visitor* visitor) |
1461 { | 1461 { |
1462 visitor->trace(m_document); | 1462 visitor->trace(m_document); |
1463 ResourceLoaderHost::trace(visitor); | 1463 ResourceLoaderHost::trace(visitor); |
1464 } | 1464 } |
1465 | 1465 |
1466 } | 1466 } |
OLD | NEW |