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

Unified Diff: content/browser/frame_host/render_frame_host_manager.cc

Issue 1505343002: Don't create unexpected OOPIFs in --isolate-extensions. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update comments Created 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/browser/frame_host/navigation_controller_impl_browsertest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/frame_host/render_frame_host_manager.cc
diff --git a/content/browser/frame_host/render_frame_host_manager.cc b/content/browser/frame_host/render_frame_host_manager.cc
index dab752ccce8ef6062353966fc765bb3091c2e4f1..96d6c1f6d836ff6dc84fe017d5e220c0403fd812 100644
--- a/content/browser/frame_host/render_frame_host_manager.cc
+++ b/content/browser/frame_host/render_frame_host_manager.cc
@@ -2319,11 +2319,34 @@ RenderFrameHostImpl* RenderFrameHostManager::UpdateStateForNavigate(
bool dest_is_view_source_mode,
const GlobalRequestID& transferred_request_id,
int bindings) {
- // Don't swap for subframes unless we are in --site-per-process. We can get
- // here in tests for subframes (e.g., NavigateFrameToURL).
- if (!frame_tree_node_->IsMainFrame() &&
- !SiteIsolationPolicy::AreCrossProcessFramesPossible()) {
- return render_frame_host_.get();
+ if (!frame_tree_node_->IsMainFrame()) {
+ // Don't swap for subframes unless we are in an OOPIF-enabled mode. We can
+ // get here in tests for subframes (e.g., NavigateFrameToURL).
+ if (!SiteIsolationPolicy::AreCrossProcessFramesPossible())
+ return render_frame_host_.get();
+
+ // If dest_url is a unique origin like about:blank, then the need for a swap
+ // is determined by the source_instance.
+ GURL resolved_url = dest_url;
+ if (url::Origin(resolved_url).unique()) {
+ // If there is no source_instance for a unique origin, then we should
+ // avoid a process swap.
+ if (!source_instance)
+ return render_frame_host_.get();
+
+ // Use source_instance to determine if a swap is needed.
+ resolved_url = source_instance->GetSiteURL();
+ }
+
+ // If we are in an OOPIF mode that only applies to some sites, only swap if
+ // the policy determines that a transfer would have been needed. We can get
+ // here for session restore.
+ if (!IsRendererTransferNeededForNavigation(render_frame_host_.get(),
+ resolved_url)) {
+ DCHECK(!dest_instance ||
+ dest_instance == render_frame_host_->GetSiteInstance());
+ return render_frame_host_.get();
+ }
}
SiteInstance* current_instance = render_frame_host_->GetSiteInstance();
« no previous file with comments | « content/browser/frame_host/navigation_controller_impl_browsertest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698