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 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
275 ->context() | 275 ->context() |
276 .getCachePolicy(); | 276 .getCachePolicy(); |
277 if (parentCachePolicy != CachePolicyVerify) | 277 if (parentCachePolicy != CachePolicyVerify) |
278 return parentCachePolicy; | 278 return parentCachePolicy; |
279 } | 279 } |
280 | 280 |
281 if (loadType == FrameLoadTypeReload) | 281 if (loadType == FrameLoadTypeReload) |
282 return CachePolicyRevalidate; | 282 return CachePolicyRevalidate; |
283 | 283 |
284 if (m_documentLoader && | 284 if (m_documentLoader && |
285 m_documentLoader->request().getCachePolicy() == | 285 m_documentLoader->getRequest().getCachePolicy() == |
286 WebCachePolicy::ReturnCacheDataElseLoad) | 286 WebCachePolicy::ReturnCacheDataElseLoad) |
287 return CachePolicyHistoryBuffer; | 287 return CachePolicyHistoryBuffer; |
288 | 288 |
289 // Returns CachePolicyVerify for other cases, mainly FrameLoadTypeStandard and | 289 // Returns CachePolicyVerify for other cases, mainly FrameLoadTypeStandard and |
290 // FrameLoadTypeReloadMainResource. See public/web/WebFrameLoadType.h to know | 290 // FrameLoadTypeReloadMainResource. See public/web/WebFrameLoadType.h to know |
291 // how these load types work. | 291 // how these load types work. |
292 return CachePolicyVerify; | 292 return CachePolicyVerify; |
293 } | 293 } |
294 | 294 |
295 static WebCachePolicy memoryCachePolicyToResourceRequestCachePolicy( | 295 static WebCachePolicy memoryCachePolicyToResourceRequestCachePolicy( |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
344 shouldDisallowFetchForMainFrameScript(request, defer, *m_document)) | 344 shouldDisallowFetchForMainFrameScript(request, defer, *m_document)) |
345 return WebCachePolicy::ReturnCacheDataDontLoad; | 345 return WebCachePolicy::ReturnCacheDataDontLoad; |
346 | 346 |
347 if (request.isConditional()) | 347 if (request.isConditional()) |
348 return WebCachePolicy::ValidatingCacheData; | 348 return WebCachePolicy::ValidatingCacheData; |
349 | 349 |
350 if (m_documentLoader && m_document && !m_document->loadEventFinished()) { | 350 if (m_documentLoader && m_document && !m_document->loadEventFinished()) { |
351 // For POST requests, we mutate the main resource's cache policy to avoid | 351 // For POST requests, we mutate the main resource's cache policy to avoid |
352 // form resubmission. This policy should not be inherited by subresources. | 352 // form resubmission. This policy should not be inherited by subresources. |
353 WebCachePolicy mainResourceCachePolicy = | 353 WebCachePolicy mainResourceCachePolicy = |
354 m_documentLoader->request().getCachePolicy(); | 354 m_documentLoader->getRequest().getCachePolicy(); |
355 if (m_documentLoader->request().httpMethod() == "POST") { | 355 if (m_documentLoader->getRequest().httpMethod() == "POST") { |
356 if (mainResourceCachePolicy == WebCachePolicy::ReturnCacheDataDontLoad) | 356 if (mainResourceCachePolicy == WebCachePolicy::ReturnCacheDataDontLoad) |
357 return WebCachePolicy::ReturnCacheDataElseLoad; | 357 return WebCachePolicy::ReturnCacheDataElseLoad; |
358 return WebCachePolicy::UseProtocolCachePolicy; | 358 return WebCachePolicy::UseProtocolCachePolicy; |
359 } | 359 } |
360 return memoryCachePolicyToResourceRequestCachePolicy(getCachePolicy()); | 360 return memoryCachePolicyToResourceRequestCachePolicy(getCachePolicy()); |
361 } | 361 } |
362 return WebCachePolicy::UseProtocolCachePolicy; | 362 return WebCachePolicy::UseProtocolCachePolicy; |
363 } | 363 } |
364 | 364 |
365 // The |m_documentLoader| is null in the FrameFetchContext of an imported | 365 // The |m_documentLoader| is null in the FrameFetchContext of an imported |
(...skipping 649 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1015 response); | 1015 response); |
1016 } | 1016 } |
1017 | 1017 |
1018 DEFINE_TRACE(FrameFetchContext) { | 1018 DEFINE_TRACE(FrameFetchContext) { |
1019 visitor->trace(m_document); | 1019 visitor->trace(m_document); |
1020 visitor->trace(m_documentLoader); | 1020 visitor->trace(m_documentLoader); |
1021 FetchContext::trace(visitor); | 1021 FetchContext::trace(visitor); |
1022 } | 1022 } |
1023 | 1023 |
1024 } // namespace blink | 1024 } // namespace blink |
OLD | NEW |