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

Side by Side Diff: content/browser/frame_host/render_frame_host_manager.cc

Issue 2845223002: Fix transfers for data URLs with plugin mime types. (Closed)
Patch Set: Created 3 years, 7 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 unified diff | Download patch
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/FlagExpectations/site-per-process » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/browser/frame_host/render_frame_host_manager.h" 5 #include "content/browser/frame_host/render_frame_host_manager.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <string> 10 #include <string>
(...skipping 2309 matching lines...) Expand 10 before | Expand all | Expand 10 after
2320 const GlobalRequestID& transferred_request_id, 2320 const GlobalRequestID& transferred_request_id,
2321 int bindings, 2321 int bindings,
2322 bool is_reload) { 2322 bool is_reload) {
2323 SiteInstance* current_instance = render_frame_host_->GetSiteInstance(); 2323 SiteInstance* current_instance = render_frame_host_->GetSiteInstance();
2324 bool was_server_redirect = transfer_navigation_handle_ && 2324 bool was_server_redirect = transfer_navigation_handle_ &&
2325 transfer_navigation_handle_->WasServerRedirect(); 2325 transfer_navigation_handle_->WasServerRedirect();
2326 scoped_refptr<SiteInstance> new_instance = GetSiteInstanceForNavigation( 2326 scoped_refptr<SiteInstance> new_instance = GetSiteInstanceForNavigation(
2327 dest_url, source_instance, dest_instance, nullptr, transition, 2327 dest_url, source_instance, dest_instance, nullptr, transition,
2328 dest_is_restore, dest_is_view_source_mode, was_server_redirect); 2328 dest_is_restore, dest_is_view_source_mode, was_server_redirect);
2329 2329
2330 // Note: Do not add code here to determine whether the subframe should swap
2331 // or not. Add it to CanSubframeSwapProcess instead.
2332 bool allowed_to_swap_process =
2333 frame_tree_node_->IsMainFrame() ||
2334 CanSubframeSwapProcess(dest_url, source_instance, dest_instance,
2335 was_server_redirect);
2336
2330 // Inform the transferring NavigationHandle of a transfer to a different 2337 // Inform the transferring NavigationHandle of a transfer to a different
2331 // SiteInstance. It is important do so now, in order to mark the request as 2338 // SiteInstance. It is important do so now, in order to mark the request as
2332 // transferring on the IO thread before attempting to destroy the pending RFH. 2339 // transferring on the IO thread before attempting to destroy the pending RFH.
2333 // This ensures the network request will not be destroyed along the pending 2340 // This ensures the network request will not be destroyed along the pending
2334 // RFH but will persist until it is picked up by the new RFH. 2341 // RFH but will persist until it is picked up by the new RFH.
2335 if (transfer_navigation_handle_.get() && 2342 if (transfer_navigation_handle_.get() &&
2336 transfer_navigation_handle_->GetGlobalRequestID() == 2343 transfer_navigation_handle_->GetGlobalRequestID() ==
2337 transferred_request_id && 2344 transferred_request_id) {
2338 new_instance.get() != 2345 // The transfer is needed when switching to a new SiteInstance. One
2339 transfer_navigation_handle_->GetRenderFrameHost() 2346 // exception is if the process swap is not allowed and the transfer started
2340 ->GetSiteInstance()) { 2347 // in the current RFH, the navigation will stay in the current RFH (even
2341 transfer_navigation_handle_->Transfer(); 2348 // when there is a new SiteInstance), so avoid calling Transfer() on it.
2349 // This matters for some renderer-initiated data URLs navigations, see
2350 // https://crbug.com/697513.
2351 RenderFrameHostImpl* transferring_rfh =
2352 transfer_navigation_handle_->GetRenderFrameHost();
2353 bool transfer_started_from_current_rfh =
2354 transferring_rfh == render_frame_host_.get();
2355 bool should_transfer =
2356 new_instance.get() != transferring_rfh->GetSiteInstance() &&
2357 (!transfer_started_from_current_rfh || allowed_to_swap_process);
2358 if (should_transfer)
2359 transfer_navigation_handle_->Transfer();
2342 } 2360 }
2343 2361
2344 // If we are currently navigating cross-process to a pending RFH for a 2362 // If we are currently navigating cross-process to a pending RFH for a
2345 // different SiteInstance, we want to get back to normal and then navigate as 2363 // different SiteInstance, we want to get back to normal and then navigate as
2346 // usual. We will reuse the pending RFH below if it matches the destination 2364 // usual. We will reuse the pending RFH below if it matches the destination
2347 // SiteInstance. 2365 // SiteInstance.
2348 if (pending_render_frame_host_) { 2366 if (pending_render_frame_host_) {
2349 if (pending_render_frame_host_->GetSiteInstance() != new_instance) { 2367 if (pending_render_frame_host_->GetSiteInstance() != new_instance) {
2350 CancelPending(); 2368 CancelPending();
2351 } else { 2369 } else {
2352 // When a pending RFH is reused, it should always be live, since it is 2370 // When a pending RFH is reused, it should always be live, since it is
2353 // cleared whenever a process dies. 2371 // cleared whenever a process dies.
2354 CHECK(pending_render_frame_host_->IsRenderFrameLive()); 2372 CHECK(pending_render_frame_host_->IsRenderFrameLive());
2355 } 2373 }
2356 } 2374 }
2357 2375
2358 // Note: Do not add code here to determine whether the subframe should swap
2359 // or not. Add it to CanSubframeSwapProcess instead.
2360 bool allowed_to_swap_process =
2361 frame_tree_node_->IsMainFrame() ||
2362 CanSubframeSwapProcess(dest_url, source_instance, dest_instance,
2363 was_server_redirect);
2364
2365 if (new_instance.get() != current_instance && allowed_to_swap_process) { 2376 if (new_instance.get() != current_instance && allowed_to_swap_process) {
2366 TRACE_EVENT_INSTANT2( 2377 TRACE_EVENT_INSTANT2(
2367 "navigation", 2378 "navigation",
2368 "RenderFrameHostManager::UpdateStateForNavigate:New SiteInstance", 2379 "RenderFrameHostManager::UpdateStateForNavigate:New SiteInstance",
2369 TRACE_EVENT_SCOPE_THREAD, 2380 TRACE_EVENT_SCOPE_THREAD,
2370 "current_instance id", current_instance->GetId(), 2381 "current_instance id", current_instance->GetId(),
2371 "new_instance id", new_instance->GetId()); 2382 "new_instance id", new_instance->GetId());
2372 2383
2373 // New SiteInstance: create a pending RFH to navigate. 2384 // New SiteInstance: create a pending RFH to navigate.
2374 2385
(...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after
2814 resolved_url)) { 2825 resolved_url)) {
2815 DCHECK(!dest_instance || 2826 DCHECK(!dest_instance ||
2816 dest_instance == render_frame_host_->GetSiteInstance()); 2827 dest_instance == render_frame_host_->GetSiteInstance());
2817 return false; 2828 return false;
2818 } 2829 }
2819 2830
2820 return true; 2831 return true;
2821 } 2832 }
2822 2833
2823 } // namespace content 2834 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/FlagExpectations/site-per-process » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698