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

Side by Side Diff: third_party/WebKit/Source/core/loader/FrameFetchContext.cpp

Issue 2772753002: Change FrameLoadTypeReload to take FrameLoadTypeReloadMainResource's behavior (Closed)
Patch Set: remove Reload Created 3 years, 9 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) 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 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 return (resourceType == ResourceType::kIsMainResource && 246 return (resourceType == ResourceType::kIsMainResource &&
247 (requestType == RequestType::kIsConditional || 247 (requestType == RequestType::kIsConditional ||
248 method == RequestMethod::kIsPost)) 248 method == RequestMethod::kIsPost))
249 ? WebCachePolicy::ValidatingCacheData 249 ? WebCachePolicy::ValidatingCacheData
250 : WebCachePolicy::UseProtocolCachePolicy; 250 : WebCachePolicy::UseProtocolCachePolicy;
251 case FrameLoadTypeBackForward: 251 case FrameLoadTypeBackForward:
252 // Mutates the policy for POST requests to avoid form resubmission. 252 // Mutates the policy for POST requests to avoid form resubmission.
253 return method == RequestMethod::kIsPost 253 return method == RequestMethod::kIsPost
254 ? WebCachePolicy::ReturnCacheDataDontLoad 254 ? WebCachePolicy::ReturnCacheDataDontLoad
255 : WebCachePolicy::ReturnCacheDataElseLoad; 255 : WebCachePolicy::ReturnCacheDataElseLoad;
256 case FrameLoadTypeReload:
257 return WebCachePolicy::ValidatingCacheData;
258 case FrameLoadTypeReloadMainResource: 256 case FrameLoadTypeReloadMainResource:
259 return resourceType == ResourceType::kIsMainResource 257 return resourceType == ResourceType::kIsMainResource
260 ? WebCachePolicy::ValidatingCacheData 258 ? WebCachePolicy::ValidatingCacheData
261 : WebCachePolicy::UseProtocolCachePolicy; 259 : WebCachePolicy::UseProtocolCachePolicy;
262 case FrameLoadTypeReloadBypassingCache: 260 case FrameLoadTypeReloadBypassingCache:
263 // TODO(toyoshim): Should return BypassingCache always, but keep legacy 261 // TODO(toyoshim): Should return BypassingCache always, but keep legacy
264 // logic as is. To be changed in a follow-up patch soon. 262 // logic as is. To be changed in a follow-up patch soon.
265 return (resourceType == ResourceType::kIsMainResource && 263 return (resourceType == ResourceType::kIsMainResource &&
266 (requestType == RequestType::kIsConditional || 264 (requestType == RequestType::kIsConditional ||
267 method == RequestMethod::kIsPost)) 265 method == RequestMethod::kIsPost))
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
368 366
369 if (m_document) { 367 if (m_document) {
370 request.setExternalRequestStateFromRequestorAddressSpace( 368 request.setExternalRequestStateFromRequestorAddressSpace(
371 m_document->addressSpace()); 369 m_document->addressSpace());
372 } 370 }
373 371
374 // The remaining modifications are only necessary for HTTP and HTTPS. 372 // The remaining modifications are only necessary for HTTP and HTTPS.
375 if (!request.url().isEmpty() && !request.url().protocolIsInHTTPFamily()) 373 if (!request.url().isEmpty() && !request.url().protocolIsInHTTPFamily())
376 return; 374 return;
377 375
378 if (masterDocumentLoader()->loadType() == FrameLoadTypeReload) 376 if (masterDocumentLoader()->loadType() == FrameLoadTypeReloadMainResource)
Takashi Toyoshima 2017/03/23 08:45:42 This will cause a behavior change. Introduced by
Takashi Toyoshima 2017/03/24 03:29:17 Resolved: https://codereview.chromium.org/27690330
379 request.clearHTTPHeaderField("Save-Data"); 377 request.clearHTTPHeaderField("Save-Data");
380 378
381 if (frame()->settings() && frame()->settings()->getDataSaverEnabled()) 379 if (frame()->settings() && frame()->settings()->getDataSaverEnabled())
382 request.setHTTPHeaderField("Save-Data", "on"); 380 request.setHTTPHeaderField("Save-Data", "on");
383 } 381 }
384 382
385 WebCachePolicy FrameFetchContext::resourceRequestCachePolicy( 383 WebCachePolicy FrameFetchContext::resourceRequestCachePolicy(
386 ResourceRequest& request, 384 ResourceRequest& request,
387 Resource::Type type, 385 Resource::Type type,
388 FetchRequest::DeferOption defer) const { 386 FetchRequest::DeferOption defer) const {
(...skipping 691 matching lines...) Expand 10 before | Expand all | Expand 10 after
1080 response); 1078 response);
1081 } 1079 }
1082 1080
1083 DEFINE_TRACE(FrameFetchContext) { 1081 DEFINE_TRACE(FrameFetchContext) {
1084 visitor->trace(m_document); 1082 visitor->trace(m_document);
1085 visitor->trace(m_documentLoader); 1083 visitor->trace(m_documentLoader);
1086 FetchContext::trace(visitor); 1084 FetchContext::trace(visitor);
1087 } 1085 }
1088 1086
1089 } // namespace blink 1087 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698