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

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: Fix PlzNavigate Created 3 years, 10 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 9321 matching lines...) Expand 10 before | Expand all | Expand 10 after
9332 "a.com", base::StringPrintf("/site_isolation/" 9332 "a.com", base::StringPrintf("/site_isolation/"
9333 "subframes_with_resources.html?urls=%s,%s&" 9333 "subframes_with_resources.html?urls=%s,%s&"
9334 "numSubresources=3", 9334 "numSubresources=3",
9335 path0.c_str(), path1.c_str()))); 9335 path0.c_str(), path1.c_str())));
9336 EXPECT_TRUE(NavigateToURL(shell(), url)); 9336 EXPECT_TRUE(NavigateToURL(shell(), url));
9337 bool result; 9337 bool result;
9338 EXPECT_TRUE(ExecuteScriptAndExtractBool(shell(), "createFrames()", &result)); 9338 EXPECT_TRUE(ExecuteScriptAndExtractBool(shell(), "createFrames()", &result));
9339 EXPECT_TRUE(result); 9339 EXPECT_TRUE(result);
9340 } 9340 }
9341 9341
9342 // Test that an OOPIF at b.com can navigate to a cross-site a.com URL that
9343 // transfers back to b.com. See https://crbug.com/681077#c10 and
9344 // https://crbug.com/660407.
9345 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest,
9346 SubframeTransfersToCurrentRFH) {
9347 GURL main_url(embedded_test_server()->GetURL(
9348 "a.com", "/cross_site_iframe_factory.html?a(b)"));
9349 ASSERT_TRUE(NavigateToURL(shell(), main_url));
9350
9351 FrameTreeNode* root = static_cast<WebContentsImpl*>(shell()->web_contents())
9352 ->GetFrameTree()
9353 ->root();
9354 scoped_refptr<SiteInstanceImpl> b_site_instance =
9355 root->child_at(0)->current_frame_host()->GetSiteInstance();
9356
9357 // Navigate subframe to a URL that will redirect from a.com back to b.com.
9358 // This navigation shouldn't time out. Also ensure that the pending RFH
9359 // that was created for a.com is destroyed.
9360 GURL frame_url(
9361 embedded_test_server()->GetURL("a.com", "/cross-site/b.com/title2.html"));
9362 NavigateIframeToURL(shell()->web_contents(), "child-0", frame_url);
9363 EXPECT_FALSE(root->child_at(0)->render_manager()->pending_frame_host());
9364 GURL redirected_url(embedded_test_server()->GetURL("b.com", "/title2.html"));
9365 EXPECT_EQ(root->child_at(0)->current_url(), redirected_url);
9366 EXPECT_EQ(b_site_instance,
9367 root->child_at(0)->current_frame_host()->GetSiteInstance());
9368
9369 // Try the same navigation, but use the browser-initiated path.
9370 NavigateFrameToURL(root->child_at(0), frame_url);
9371 EXPECT_FALSE(root->child_at(0)->render_manager()->pending_frame_host());
9372 EXPECT_EQ(root->child_at(0)->current_url(), redirected_url);
9373 EXPECT_EQ(b_site_instance,
9374 root->child_at(0)->current_frame_host()->GetSiteInstance());
9375 }
9376
9342 } // namespace content 9377 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698