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

Side by Side Diff: content/browser/site_per_process_browsertest.cc

Issue 2636193003: Fix cross-site subframe navigations that transfer back to original RFH. (Closed)
Patch Set: Try #3 Created 3 years, 11 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/site_per_process_browsertest.h" 5 #include "content/browser/site_per_process_browsertest.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 9080 matching lines...) Expand 10 before | Expand all | Expand 10 after
9091 EXPECT_TRUE(NavigateToURL( 9091 EXPECT_TRUE(NavigateToURL(
9092 shell(), embedded_test_server()->GetURL("b.com", "/title3.html"))); 9092 shell(), embedded_test_server()->GetURL("b.com", "/title3.html")));
9093 9093
9094 // Pretend that a.com just requested a context menu. This used to cause a 9094 // Pretend that a.com just requested a context menu. This used to cause a
9095 // because the RenderWidgetHostView is destroyed when the frame is swapped and 9095 // because the RenderWidgetHostView is destroyed when the frame is swapped and
9096 // added to pending delete list. 9096 // added to pending delete list.
9097 rfh->OnMessageReceived( 9097 rfh->OnMessageReceived(
9098 FrameHostMsg_ContextMenu(rfh->GetRoutingID(), ContextMenuParams())); 9098 FrameHostMsg_ContextMenu(rfh->GetRoutingID(), ContextMenuParams()));
9099 } 9099 }
9100 9100
9101 // Test that an OOPIF at b.com can navigate to a cross-site a.com URL that
9102 // transfers back to b.com. See https://crbug.com/681077#c10 and
9103 // https://crbug.com/660407.
9104 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest,
9105 SubframeTransfersToCurrentRFH) {
9106 GURL main_url(embedded_test_server()->GetURL(
9107 "a.com", "/cross_site_iframe_factory.html?a(b)"));
9108 ASSERT_TRUE(NavigateToURL(shell(), main_url));
9109
9110 FrameTreeNode* root = static_cast<WebContentsImpl*>(shell()->web_contents())
9111 ->GetFrameTree()
9112 ->root();
9113 scoped_refptr<SiteInstanceImpl> b_site_instance =
9114 root->child_at(0)->current_frame_host()->GetSiteInstance();
9115
9116 // Navigate subframe to a URL that will redirect from a.com back to b.com.
9117 // This navigation shouldn't time out. Also ensure that the pending RFH
9118 // that was created for a.com is destroyed.
9119 GURL frame_url(
9120 embedded_test_server()->GetURL("a.com", "/cross-site/b.com/title2.html"));
9121 NavigateIframeToURL(shell()->web_contents(), "child-0", frame_url);
9122 EXPECT_FALSE(root->child_at(0)->render_manager()->pending_frame_host());
9123 GURL redirected_url(embedded_test_server()->GetURL("b.com", "/title2.html"));
9124 EXPECT_EQ(root->child_at(0)->current_url(), redirected_url);
9125 EXPECT_EQ(b_site_instance,
9126 root->child_at(0)->current_frame_host()->GetSiteInstance());
9127
9128 // Try the same navigation, but use the browser-initiated path.
9129 NavigateFrameToURL(root->child_at(0), frame_url);
9130 EXPECT_FALSE(root->child_at(0)->render_manager()->pending_frame_host());
9131 EXPECT_EQ(root->child_at(0)->current_url(), redirected_url);
9132 EXPECT_EQ(b_site_instance,
9133 root->child_at(0)->current_frame_host()->GetSiteInstance());
9134 }
9135
9101 } // namespace content 9136 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698