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

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: conditional disabling 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
« no previous file with comments | « content/public/renderer/navigation_state.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 2034 matching lines...) Expand 10 before | Expand all | Expand 10 after
2045 // tab, and we want to still allow that. 2045 // tab, and we want to still allow that.
2046 // 2046 //
2047 // Note: we do this only for GET requests because our mechanism for switching 2047 // Note: we do this only for GET requests because our mechanism for switching
2048 // processes only issues GET requests. In particular, POST requests don't 2048 // processes only issues GET requests. In particular, POST requests don't
2049 // work, because this mechanism does not preserve form POST data. If it 2049 // work, because this mechanism does not preserve form POST data. If it
2050 // becomes necessary to support process switching for POST requests, we will 2050 // becomes necessary to support process switching for POST requests, we will
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 // TODO(mpcomplete): remove is_redirect clause when http://crbug.com/79520 is
2056 // it's pointless to tell the browser about navigations it gave us. But 2056 // fixed.
2057 // we do potentially ask the browser to handle a redirect that was originally
2058 // initiated by the browser. See http://crbug.com/70943
2059 //
2060 // TODO(creis): Move this redirect check to the browser process to avoid
2061 // ping-ponging. See http://crbug.com/72380.
2062 if (!frame->parent() && (is_content_initiated || is_redirect) && 2057 if (!frame->parent() && (is_content_initiated || is_redirect) &&
2063 default_policy == WebKit::WebNavigationPolicyCurrentTab && 2058 default_policy == WebKit::WebNavigationPolicyCurrentTab &&
2064 request.httpMethod() == "GET" && !url.SchemeIs(chrome::kAboutScheme)) { 2059 request.httpMethod() == "GET" && !url.SchemeIs(chrome::kAboutScheme)) {
2065 bool send_referrer = false; 2060 bool send_referrer = false;
2066 bool should_fork = 2061 bool should_fork =
2067 (enabled_bindings_ & content::BINDINGS_POLICY_WEB_UI) || 2062 (enabled_bindings_ & content::BINDINGS_POLICY_WEB_UI) ||
2068 frame->isViewSourceModeEnabled() || 2063 frame->isViewSourceModeEnabled() ||
2069 url.SchemeIs(chrome::kViewSourceScheme); 2064 url.SchemeIs(chrome::kViewSourceScheme);
2070 2065
2071 if (!should_fork) { 2066 if (!should_fork) {
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after
2325 document_state->set_request_time(params.request_time); 2320 document_state->set_request_time(params.request_time);
2326 2321
2327 // A navigation resulting from loading a javascript URL should not be treated 2322 // 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 2323 // as a browser initiated event. Instead, we want it to look as if the page
2329 // initiated any load resulting from JS execution. 2324 // initiated any load resulting from JS execution.
2330 if (!params.url.SchemeIs(chrome::kJavaScriptScheme)) { 2325 if (!params.url.SchemeIs(chrome::kJavaScriptScheme)) {
2331 NavigationState* navigation_state = NavigationState::CreateBrowserInitiated( 2326 NavigationState* navigation_state = NavigationState::CreateBrowserInitiated(
2332 params.page_id, 2327 params.page_id,
2333 params.pending_history_list_offset, 2328 params.pending_history_list_offset,
2334 params.transition); 2329 params.transition);
2330 navigation_state->set_transferred_request_child_id(
2331 params.transferred_request_child_id);
2332 navigation_state->set_transferred_request_request_id(
2333 params.transferred_request_request_id);
2335 if (params.navigation_type == ViewMsg_Navigate_Type::RESTORE) { 2334 if (params.navigation_type == ViewMsg_Navigate_Type::RESTORE) {
2336 // We're doing a load of a page that was restored from the last session. 2335 // 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) 2336 // 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 2337 // 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 2338 // explicitly override that by setting the policy here so that as
2340 // necessary we load from the network. 2339 // necessary we load from the network.
2341 document_state->set_cache_policy_override( 2340 document_state->set_cache_policy_override(
2342 WebURLRequest::UseProtocolCachePolicy); 2341 WebURLRequest::UseProtocolCachePolicy);
2343 } 2342 }
2344 document_state->set_navigation_state(navigation_state); 2343 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()); 2724 request.setCachePolicy(document_state->cache_policy_override());
2726 transition_type = navigation_state->transition_type(); 2725 transition_type = navigation_state->transition_type();
2727 } 2726 }
2728 2727
2729 request.setExtraData( 2728 request.setExtraData(
2730 new RequestExtraData(frame->referrerPolicy(), 2729 new RequestExtraData(frame->referrerPolicy(),
2731 (frame == top_frame), 2730 (frame == top_frame),
2732 frame->identifier(), 2731 frame->identifier(),
2733 frame->parent() == top_frame, 2732 frame->parent() == top_frame,
2734 frame->parent() ? frame->parent()->identifier() : -1, 2733 frame->parent() ? frame->parent()->identifier() : -1,
2735 transition_type)); 2734 transition_type,
2735 navigation_state->transferred_request_child_id(),
2736 navigation_state->transferred_request_request_id()));
2736 2737
2737 DocumentState* top_document_state = 2738 DocumentState* top_document_state =
2738 DocumentState::FromDataSource(top_data_source); 2739 DocumentState::FromDataSource(top_data_source);
2739 // TODO(gavinp): separate out prefetching and prerender field trials 2740 // TODO(gavinp): separate out prefetching and prerender field trials
2740 // if the rel=prerender rel type is sticking around. 2741 // if the rel=prerender rel type is sticking around.
2741 if (top_document_state && 2742 if (top_document_state &&
2742 (request.targetType() == WebURLRequest::TargetIsPrefetch || 2743 (request.targetType() == WebURLRequest::TargetIsPrefetch ||
2743 request.targetType() == WebURLRequest::TargetIsPrerender)) 2744 request.targetType() == WebURLRequest::TargetIsPrerender))
2744 top_document_state->set_was_prefetcher(true); 2745 top_document_state->set_was_prefetcher(true);
2745 2746
(...skipping 2015 matching lines...) Expand 10 before | Expand all | Expand 10 after
4761 return !!RenderThreadImpl::current()->compositor_thread(); 4762 return !!RenderThreadImpl::current()->compositor_thread();
4762 } 4763 }
4763 4764
4764 void RenderViewImpl::OnJavaBridgeInit( 4765 void RenderViewImpl::OnJavaBridgeInit(
4765 const IPC::ChannelHandle& channel_handle) { 4766 const IPC::ChannelHandle& channel_handle) {
4766 DCHECK(!java_bridge_dispatcher_.get()); 4767 DCHECK(!java_bridge_dispatcher_.get());
4767 #if defined(ENABLE_JAVA_BRIDGE) 4768 #if defined(ENABLE_JAVA_BRIDGE)
4768 java_bridge_dispatcher_.reset(new JavaBridgeDispatcher(this, channel_handle)); 4769 java_bridge_dispatcher_.reset(new JavaBridgeDispatcher(this, channel_handle));
4769 #endif 4770 #endif
4770 } 4771 }
OLDNEW
« no previous file with comments | « content/public/renderer/navigation_state.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698