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

Side by Side Diff: content/renderer/render_view_impl.cc

Issue 8669014: Fix a bug where redirect chain gets lost on process swap. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: latest Created 9 years 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/renderer/render_view_impl.h" 5 #include "content/renderer/render_view_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cmath> 8 #include <cmath>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 2040 matching lines...) Expand 10 before | Expand all | Expand 10 after
2051 // need to send the request's httpBody data up to the browser process, and 2051 // need to send the request's httpBody data up to the browser process, and
2052 // issue a special POST navigation in WebKit (via 2052 // issue a special POST navigation in WebKit (via
2053 // FrameLoader::loadFrameRequest). See ResourceDispatcher and WebURLLoaderImpl 2053 // FrameLoader::loadFrameRequest). See ResourceDispatcher and WebURLLoaderImpl
2054 // for examples of how to send the httpBody data. 2054 // for examples of how to send the httpBody data.
2055 // Note2: We normally don't do this for browser-initiated navigations, since 2055 // Note2: We normally don't do this for browser-initiated navigations, since
2056 // it's pointless to tell the browser about navigations it gave us. But 2056 // it's pointless to tell the browser about navigations it gave us. But
2057 // we do potentially ask the browser to handle a redirect that was originally 2057 // we do potentially ask the browser to handle a redirect that was originally
2058 // initiated by the browser. See http://crbug.com/70943 2058 // initiated by the browser. See http://crbug.com/70943
2059 // 2059 //
2060 // TODO(creis): Move this redirect check to the browser process to avoid 2060 // TODO(creis): Move this redirect check to the browser process to avoid
2061 // ping-ponging. See http://crbug.com/72380. 2061 // ping-ponging. See http://crbug.com/72380.
Charlie Reis 2011/12/02 22:38:11 Remove TODO?
Matt Perry 2011/12/03 00:14:24 Done.
2062 if (!frame->parent() && (is_content_initiated || is_redirect) && 2062 if (!frame->parent() && is_content_initiated &&
2063 default_policy == WebKit::WebNavigationPolicyCurrentTab && 2063 default_policy == WebKit::WebNavigationPolicyCurrentTab &&
2064 request.httpMethod() == "GET" && !url.SchemeIs(chrome::kAboutScheme)) { 2064 request.httpMethod() == "GET" && !url.SchemeIs(chrome::kAboutScheme)) {
2065 bool send_referrer = false; 2065 bool send_referrer = false;
2066 bool should_fork = 2066 bool should_fork =
2067 (enabled_bindings_ & content::BINDINGS_POLICY_WEB_UI) || 2067 (enabled_bindings_ & content::BINDINGS_POLICY_WEB_UI) ||
2068 frame->isViewSourceModeEnabled() || 2068 frame->isViewSourceModeEnabled() ||
2069 url.SchemeIs(chrome::kViewSourceScheme); 2069 url.SchemeIs(chrome::kViewSourceScheme);
2070 2070
2071 if (!should_fork) { 2071 if (!should_fork) {
2072 // Give the embedder a chance. 2072 // Give the embedder a chance.
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after
2325 document_state->set_request_time(params.request_time); 2325 document_state->set_request_time(params.request_time);
2326 2326
2327 // A navigation resulting from loading a javascript URL should not be treated 2327 // A navigation resulting from loading a javascript URL should not be treated
2328 // as a browser initiated event. Instead, we want it to look as if the page 2328 // as a browser initiated event. Instead, we want it to look as if the page
2329 // initiated any load resulting from JS execution. 2329 // initiated any load resulting from JS execution.
2330 if (!params.url.SchemeIs(chrome::kJavaScriptScheme)) { 2330 if (!params.url.SchemeIs(chrome::kJavaScriptScheme)) {
2331 NavigationState* navigation_state = NavigationState::CreateBrowserInitiated( 2331 NavigationState* navigation_state = NavigationState::CreateBrowserInitiated(
2332 params.page_id, 2332 params.page_id,
2333 params.pending_history_list_offset, 2333 params.pending_history_list_offset,
2334 params.transition); 2334 params.transition);
2335 navigation_state->set_transferred_request_child_id(
2336 params.transferred_request_child_id);
2337 navigation_state->set_transferred_request_request_id(
2338 params.transferred_request_request_id);
2335 if (params.navigation_type == ViewMsg_Navigate_Type::RESTORE) { 2339 if (params.navigation_type == ViewMsg_Navigate_Type::RESTORE) {
2336 // We're doing a load of a page that was restored from the last session. 2340 // We're doing a load of a page that was restored from the last session.
2337 // By default this prefers the cache over loading (LOAD_PREFERRING_CACHE) 2341 // By default this prefers the cache over loading (LOAD_PREFERRING_CACHE)
2338 // which can result in stale data for pages that are set to expire. We 2342 // which can result in stale data for pages that are set to expire. We
2339 // explicitly override that by setting the policy here so that as 2343 // explicitly override that by setting the policy here so that as
2340 // necessary we load from the network. 2344 // necessary we load from the network.
2341 document_state->set_cache_policy_override( 2345 document_state->set_cache_policy_override(
2342 WebURLRequest::UseProtocolCachePolicy); 2346 WebURLRequest::UseProtocolCachePolicy);
2343 } 2347 }
2344 document_state->set_navigation_state(navigation_state); 2348 document_state->set_navigation_state(navigation_state);
(...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after
2725 request.setCachePolicy(document_state->cache_policy_override()); 2729 request.setCachePolicy(document_state->cache_policy_override());
2726 transition_type = navigation_state->transition_type(); 2730 transition_type = navigation_state->transition_type();
2727 } 2731 }
2728 2732
2729 request.setExtraData( 2733 request.setExtraData(
2730 new RequestExtraData(frame->referrerPolicy(), 2734 new RequestExtraData(frame->referrerPolicy(),
2731 (frame == top_frame), 2735 (frame == top_frame),
2732 frame->identifier(), 2736 frame->identifier(),
2733 frame->parent() == top_frame, 2737 frame->parent() == top_frame,
2734 frame->parent() ? frame->parent()->identifier() : -1, 2738 frame->parent() ? frame->parent()->identifier() : -1,
2735 transition_type)); 2739 transition_type,
2740 navigation_state->transferred_request_child_id(),
2741 navigation_state->transferred_request_request_id()));
2736 2742
2737 DocumentState* top_document_state = 2743 DocumentState* top_document_state =
2738 DocumentState::FromDataSource(top_data_source); 2744 DocumentState::FromDataSource(top_data_source);
2739 // TODO(gavinp): separate out prefetching and prerender field trials 2745 // TODO(gavinp): separate out prefetching and prerender field trials
2740 // if the rel=prerender rel type is sticking around. 2746 // if the rel=prerender rel type is sticking around.
2741 if (top_document_state && 2747 if (top_document_state &&
2742 (request.targetType() == WebURLRequest::TargetIsPrefetch || 2748 (request.targetType() == WebURLRequest::TargetIsPrefetch ||
2743 request.targetType() == WebURLRequest::TargetIsPrerender)) 2749 request.targetType() == WebURLRequest::TargetIsPrerender))
2744 top_document_state->set_was_prefetcher(true); 2750 top_document_state->set_was_prefetcher(true);
2745 2751
(...skipping 2015 matching lines...) Expand 10 before | Expand all | Expand 10 after
4761 return !!RenderThreadImpl::current()->compositor_thread(); 4767 return !!RenderThreadImpl::current()->compositor_thread();
4762 } 4768 }
4763 4769
4764 void RenderViewImpl::OnJavaBridgeInit( 4770 void RenderViewImpl::OnJavaBridgeInit(
4765 const IPC::ChannelHandle& channel_handle) { 4771 const IPC::ChannelHandle& channel_handle) {
4766 DCHECK(!java_bridge_dispatcher_.get()); 4772 DCHECK(!java_bridge_dispatcher_.get());
4767 #if defined(ENABLE_JAVA_BRIDGE) 4773 #if defined(ENABLE_JAVA_BRIDGE)
4768 java_bridge_dispatcher_.reset(new JavaBridgeDispatcher(this, channel_handle)); 4774 java_bridge_dispatcher_.reset(new JavaBridgeDispatcher(this, channel_handle));
4769 #endif 4775 #endif
4770 } 4776 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698