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

Unified Diff: content/renderer/render_view_impl.cc

Issue 101203007: Override cache policy when changing a reload to a back/forward navigation. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: content/renderer/render_view_impl.cc
diff --git a/content/renderer/render_view_impl.cc b/content/renderer/render_view_impl.cc
index be301da3f21dda598e6c03d7cfeb2726186a3631..8210d281ecbb12aa1dadc95f0905a56af55e8ece 100644
--- a/content/renderer/render_view_impl.cc
+++ b/content/renderer/render_view_impl.cc
@@ -1360,6 +1360,8 @@ void RenderViewImpl::OnNavigate(const ViewMsg_Navigate_Params& params) {
FOR_EACH_OBSERVER(RenderViewObserver, observers_, Navigate(params.url));
bool is_reload = IsReload(params);
+ WebURLRequest::CachePolicy cache_policy =
+ WebURLRequest::UseProtocolCachePolicy;
// If this is a stale back/forward (due to a recent navigation the browser
// didn't know about), ignore it.
@@ -1377,6 +1379,7 @@ void RenderViewImpl::OnNavigate(const ViewMsg_Navigate_Params& params) {
// params.state. Setting is_reload to false will treat this like a back
// navigation to accomplish that.
is_reload = false;
+ cache_policy = WebURLRequest::ReloadIgnoringCacheData;
// We refresh timezone when a view is swapped in since timezone
// can get out of sync when the system timezone is updated while
@@ -1410,10 +1413,9 @@ void RenderViewImpl::OnNavigate(const ViewMsg_Navigate_Params& params) {
if (is_reload && frame->currentHistoryItem().isNull()) {
// We cannot reload if we do not have any history state. This happens, for
- // example, when recovering from a crash. Our workaround here is a bit of
- // a hack since it means that reload after a crashed tab does not cause an
- // end-to-end cache validation.
+ // example, when recovering from a crash.
is_reload = false;
+ cache_policy = WebURLRequest::ReloadIgnoringCacheData;
darin (slow to review) 2014/01/07 07:39:59 good fix for that old bug.
}
pending_navigation_params_.reset(new ViewMsg_Navigate_Params(params));
@@ -1441,7 +1443,7 @@ void RenderViewImpl::OnNavigate(const ViewMsg_Navigate_Params& params) {
// Ensure we didn't save the swapped out URL in UpdateState, since the
// browser should never be telling us to navigate to swappedout://.
CHECK(item.urlString() != WebString::fromUTF8(kSwappedOutURL));
- frame->loadHistoryItem(item);
+ frame->loadHistoryItem(item, cache_policy);
}
} else if (!params.base_url_for_data_url.is_empty()) {
// A loadData request with a specified base URL.
@@ -3452,6 +3454,11 @@ void RenderViewImpl::PopulateDocumentStateFromPending(
// can result in stale data for pages that are set to expire. We explicitly
// override that by setting the policy here so that as necessary we load
// from the network.
+ //
+ // TODO(davidben): Remove this in favor of passing a cache policy to the
+ // loadHistoryItem call in OnNavigate. That requires not overloading
+ // UseProtocolCachePolicy to mean both "normal load" and "determine cache
+ // policy based on load type, etc".
internal_data->set_cache_policy_override(
WebURLRequest::UseProtocolCachePolicy);
}
« chrome/browser/crash_recovery_browsertest.cc ('K') | « chrome/browser/crash_recovery_browsertest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698