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

Unified Diff: chrome/renderer/render_view.cc

Issue 341043: Changes session restore to use a normal load rather than preferring... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 1 month 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
« no previous file with comments | « chrome/renderer/navigation_state.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/renderer/render_view.cc
===================================================================
--- chrome/renderer/render_view.cc (revision 30525)
+++ chrome/renderer/render_view.cc (working copy)
@@ -720,7 +720,7 @@
AboutHandler::MaybeHandle(params.url);
- bool is_reload = params.reload;
+ bool is_reload = (params.navigation_type == ViewMsg_Navigate_Params::RELOAD);
WebFrame* main_frame = webview()->mainFrame();
if (is_reload && main_frame->currentHistoryItem().isNull()) {
@@ -735,8 +735,17 @@
// as a browser initiated event. Instead, we want it to look as if the page
// initiated any load resulting from JS execution.
if (!params.url.SchemeIs(chrome::kJavaScriptScheme)) {
- pending_navigation_state_.reset(NavigationState::CreateBrowserInitiated(
- params.page_id, params.transition, params.request_time));
+ NavigationState* state = NavigationState::CreateBrowserInitiated(
+ params.page_id, params.transition, params.request_time);
+ if (params.navigation_type == ViewMsg_Navigate_Params::RESTORE) {
+ // We're doing a load of a page that was restored from the last session.
+ // By default this prefers the cache over loading (LOAD_PREFERRING_CACHE)
+ // which 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.
+ state->set_cache_policy_override(WebURLRequest::UseProtocolCachePolicy);
+ }
+ pending_navigation_state_.reset(state);
}
// If we are reloading, then WebKit will use the history state of the current
@@ -2327,6 +2336,17 @@
void RenderView::willSendRequest(
WebFrame* frame, unsigned identifier, WebURLRequest& request,
const WebURLResponse& redirect_response) {
+ WebFrame* top_frame = frame->top();
+ if (!top_frame)
+ top_frame = frame;
+ WebDataSource* data_source = top_frame->provisionalDataSource();
+ if (!data_source)
+ data_source = top_frame->dataSource();
+ if (data_source) {
+ NavigationState* state = NavigationState::FromDataSource(data_source);
+ if (state && state->is_cache_policy_override_set())
+ request.setCachePolicy(state->cache_policy_override());
+ }
request.setRequestorID(routing_id_);
}
« no previous file with comments | « chrome/renderer/navigation_state.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698