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

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: review comments 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 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 if (!frame->parent() && is_content_initiated &&
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
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) &&
2063 default_policy == WebKit::WebNavigationPolicyCurrentTab && 2056 default_policy == WebKit::WebNavigationPolicyCurrentTab &&
2064 request.httpMethod() == "GET" && !url.SchemeIs(chrome::kAboutScheme)) { 2057 request.httpMethod() == "GET" && !url.SchemeIs(chrome::kAboutScheme)) {
2065 bool send_referrer = false; 2058 bool send_referrer = false;
2066 bool should_fork = 2059 bool should_fork =
2067 (enabled_bindings_ & content::BINDINGS_POLICY_WEB_UI) || 2060 (enabled_bindings_ & content::BINDINGS_POLICY_WEB_UI) ||
2068 frame->isViewSourceModeEnabled() || 2061 frame->isViewSourceModeEnabled() ||
2069 url.SchemeIs(chrome::kViewSourceScheme); 2062 url.SchemeIs(chrome::kViewSourceScheme);
2070 2063
2071 if (!should_fork) { 2064 if (!should_fork) {
2072 // Give the embedder a chance. 2065 // 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); 2318 document_state->set_request_time(params.request_time);
2326 2319
2327 // A navigation resulting from loading a javascript URL should not be treated 2320 // 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 2321 // as a browser initiated event. Instead, we want it to look as if the page
2329 // initiated any load resulting from JS execution. 2322 // initiated any load resulting from JS execution.
2330 if (!params.url.SchemeIs(chrome::kJavaScriptScheme)) { 2323 if (!params.url.SchemeIs(chrome::kJavaScriptScheme)) {
2331 NavigationState* navigation_state = NavigationState::CreateBrowserInitiated( 2324 NavigationState* navigation_state = NavigationState::CreateBrowserInitiated(
2332 params.page_id, 2325 params.page_id,
2333 params.pending_history_list_offset, 2326 params.pending_history_list_offset,
2334 params.transition); 2327 params.transition);
2328 navigation_state->set_transferred_request_child_id(
2329 params.transferred_request_child_id);
2330 navigation_state->set_transferred_request_request_id(
2331 params.transferred_request_request_id);
2335 if (params.navigation_type == ViewMsg_Navigate_Type::RESTORE) { 2332 if (params.navigation_type == ViewMsg_Navigate_Type::RESTORE) {
2336 // We're doing a load of a page that was restored from the last session. 2333 // 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) 2334 // 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 2335 // 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 2336 // explicitly override that by setting the policy here so that as
2340 // necessary we load from the network. 2337 // necessary we load from the network.
2341 document_state->set_cache_policy_override( 2338 document_state->set_cache_policy_override(
2342 WebURLRequest::UseProtocolCachePolicy); 2339 WebURLRequest::UseProtocolCachePolicy);
2343 } 2340 }
2344 document_state->set_navigation_state(navigation_state); 2341 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()); 2722 request.setCachePolicy(document_state->cache_policy_override());
2726 transition_type = navigation_state->transition_type(); 2723 transition_type = navigation_state->transition_type();
2727 } 2724 }
2728 2725
2729 request.setExtraData( 2726 request.setExtraData(
2730 new RequestExtraData(frame->referrerPolicy(), 2727 new RequestExtraData(frame->referrerPolicy(),
2731 (frame == top_frame), 2728 (frame == top_frame),
2732 frame->identifier(), 2729 frame->identifier(),
2733 frame->parent() == top_frame, 2730 frame->parent() == top_frame,
2734 frame->parent() ? frame->parent()->identifier() : -1, 2731 frame->parent() ? frame->parent()->identifier() : -1,
2735 transition_type)); 2732 transition_type,
2733 navigation_state->transferred_request_child_id(),
2734 navigation_state->transferred_request_request_id()));
2736 2735
2737 DocumentState* top_document_state = 2736 DocumentState* top_document_state =
2738 DocumentState::FromDataSource(top_data_source); 2737 DocumentState::FromDataSource(top_data_source);
2739 // TODO(gavinp): separate out prefetching and prerender field trials 2738 // TODO(gavinp): separate out prefetching and prerender field trials
2740 // if the rel=prerender rel type is sticking around. 2739 // if the rel=prerender rel type is sticking around.
2741 if (top_document_state && 2740 if (top_document_state &&
2742 (request.targetType() == WebURLRequest::TargetIsPrefetch || 2741 (request.targetType() == WebURLRequest::TargetIsPrefetch ||
2743 request.targetType() == WebURLRequest::TargetIsPrerender)) 2742 request.targetType() == WebURLRequest::TargetIsPrerender))
2744 top_document_state->set_was_prefetcher(true); 2743 top_document_state->set_was_prefetcher(true);
2745 2744
(...skipping 2015 matching lines...) Expand 10 before | Expand all | Expand 10 after
4761 return !!RenderThreadImpl::current()->compositor_thread(); 4760 return !!RenderThreadImpl::current()->compositor_thread();
4762 } 4761 }
4763 4762
4764 void RenderViewImpl::OnJavaBridgeInit( 4763 void RenderViewImpl::OnJavaBridgeInit(
4765 const IPC::ChannelHandle& channel_handle) { 4764 const IPC::ChannelHandle& channel_handle) {
4766 DCHECK(!java_bridge_dispatcher_.get()); 4765 DCHECK(!java_bridge_dispatcher_.get());
4767 #if defined(ENABLE_JAVA_BRIDGE) 4766 #if defined(ENABLE_JAVA_BRIDGE)
4768 java_bridge_dispatcher_.reset(new JavaBridgeDispatcher(this, channel_handle)); 4767 java_bridge_dispatcher_.reset(new JavaBridgeDispatcher(this, channel_handle));
4769 #endif 4768 #endif
4770 } 4769 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698