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 67a150e11a6ac9700f05fa5aa63cc57d0bd0075a..8ffd6abdeace2bab1bde29f543505c297bc4e2fe 100644 |
--- a/content/browser/frame_host/render_frame_host_manager.cc |
+++ b/content/browser/frame_host/render_frame_host_manager.cc |
@@ -1269,6 +1269,12 @@ bool RenderFrameHostManager::ShouldSwapBrowsingInstancesForNavigation( |
SiteInstance* new_site_instance, |
const GURL& new_effective_url, |
bool new_is_view_source_mode) const { |
+ // A subframe must stay in the same BrowsingInstance as its parent. |
+ // TODO(nasko): Ensure that SiteInstance swap is still triggered for subframes |
+ // in the cases covered by the rest of the checks in this method. |
+ if (!frame_tree_node_->IsMainFrame()) |
+ return false; |
+ |
// If new_entry already has a SiteInstance, assume it is correct. We only |
// need to force a swap if it is in a different BrowsingInstance. |
if (new_site_instance) { |