OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
155 return ReturnCacheDataElseLoad; | 155 return ReturnCacheDataElseLoad; |
156 return UseProtocolCachePolicy; | 156 return UseProtocolCachePolicy; |
157 } | 157 } |
158 | 158 |
159 ResourceRequestCachePolicy FrameFetchContext::resourceRequestCachePolicy(const R esourceRequest& request, Resource::Type type) const | 159 ResourceRequestCachePolicy FrameFetchContext::resourceRequestCachePolicy(const R esourceRequest& request, Resource::Type type) const |
160 { | 160 { |
161 if (type == Resource::MainResource) { | 161 if (type == Resource::MainResource) { |
162 FrameLoadType frameLoadType = frame()->loader().loadType(); | 162 FrameLoadType frameLoadType = frame()->loader().loadType(); |
163 if (request.httpMethod() == "POST" && frameLoadType == FrameLoadTypeBack Forward) | 163 if (request.httpMethod() == "POST" && frameLoadType == FrameLoadTypeBack Forward) |
164 return ReturnCacheDataDontLoad; | 164 return ReturnCacheDataDontLoad; |
165 if (!frame()->host()->overrideEncoding().isEmpty() || frameLoadType == F rameLoadTypeBackForward) | 165 if (!frame()->host()->overrideEncoding().isEmpty()) |
166 return ReturnCacheDataElseLoad; | 166 return ReturnCacheDataElseLoad; |
167 if (frameLoadType == FrameLoadTypeReloadFromOrigin) | 167 if (frameLoadType == FrameLoadTypeSame || request.isConditional() || req uest.httpMethod() == "POST") |
168 return ReloadBypassingCache; | |
169 if (frameLoadType == FrameLoadTypeReload || frameLoadType == FrameLoadTy peSame || request.isConditional() || request.httpMethod() == "POST") | |
170 return ReloadIgnoringCacheData; | 168 return ReloadIgnoringCacheData; |
171 Frame* parent = frame()->tree().parent(); | 169 |
172 if (parent && parent->isLocalFrame()) | 170 for (Frame* f = frame(); f; f = f->tree().parent()) { |
Nate Chapin
2015/07/15 18:24:03
This function is no longer recursive. Everything a
dcheng
2015/07/16 06:55:47
Incidentally, is this OK to potentially skip ances
Nate Chapin
2015/07/16 18:05:41
In general, either (1) an iframe load is a navigat
| |
173 return toLocalFrame(parent)->document()->fetcher()->context().resour ceRequestCachePolicy(request, type); | 171 if (!f->isLocalFrame()) |
172 continue; | |
173 frameLoadType = toLocalFrame(f)->loader().loadType(); | |
174 if (frameLoadType == FrameLoadTypeBackForward) | |
175 return ReturnCacheDataElseLoad; | |
176 if (frameLoadType == FrameLoadTypeReloadFromOrigin) | |
177 return ReloadBypassingCache; | |
178 if (frameLoadType == FrameLoadTypeReload) | |
179 return ReloadIgnoringCacheData; | |
180 } | |
174 return UseProtocolCachePolicy; | 181 return UseProtocolCachePolicy; |
175 } | 182 } |
176 | 183 |
177 if (request.isConditional()) | 184 if (request.isConditional()) |
178 return ReloadIgnoringCacheData; | 185 return ReloadIgnoringCacheData; |
179 | 186 |
180 if (m_documentLoader && m_document && !m_document->loadEventFinished()) { | 187 if (m_documentLoader && m_document && !m_document->loadEventFinished()) { |
181 // For POST requests, we mutate the main resource's cache policy to avoi d form resubmission. | 188 // For POST requests, we mutate the main resource's cache policy to avoi d form resubmission. |
182 // This policy should not be inherited by subresources. | 189 // This policy should not be inherited by subresources. |
183 ResourceRequestCachePolicy mainResourceCachePolicy = m_documentLoader->r equest().cachePolicy(); | 190 ResourceRequestCachePolicy mainResourceCachePolicy = m_documentLoader->r equest().cachePolicy(); |
(...skipping 478 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
662 } | 669 } |
663 | 670 |
664 DEFINE_TRACE(FrameFetchContext) | 671 DEFINE_TRACE(FrameFetchContext) |
665 { | 672 { |
666 visitor->trace(m_document); | 673 visitor->trace(m_document); |
667 visitor->trace(m_documentLoader); | 674 visitor->trace(m_documentLoader); |
668 FetchContext::trace(visitor); | 675 FetchContext::trace(visitor); |
669 } | 676 } |
670 | 677 |
671 } // namespace blink | 678 } // namespace blink |
OLD | NEW |