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

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: Rebase Created 3 years, 9 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 | « content/browser/frame_host/render_frame_host_manager.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 9531 matching lines...) Expand 10 before | Expand all | Expand 10 after
9542 web_contents()->GetTextInputManager()); 9542 web_contents()->GetTextInputManager());
9543 for (size_t index = 0; index < frames_.size(); ++index) { 9543 for (size_t index = 0; index < frames_.size(); ++index) {
9544 std::string text = base::StringPrintf("text%zu", index); 9544 std::string text = base::StringPrintf("text%zu", index);
9545 FocusInputInFrame(frames_[index]); 9545 FocusInputInFrame(frames_[index]);
9546 CommitText(text.c_str()); 9546 CommitText(text.c_str());
9547 selection_observer.WaitForSelectedText(text); 9547 selection_observer.WaitForSelectedText(text);
9548 } 9548 }
9549 } 9549 }
9550 #endif // OS_ANDROID 9550 #endif // OS_ANDROID
9551 9551
9552 // Test that an OOPIF at b.com can navigate to a cross-site a.com URL that
9553 // transfers back to b.com. See https://crbug.com/681077#c10 and
9554 // https://crbug.com/660407.
9555 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest,
9556 SubframeTransfersToCurrentRFH) {
9557 GURL main_url(embedded_test_server()->GetURL(
9558 "a.com", "/cross_site_iframe_factory.html?a(b)"));
9559 ASSERT_TRUE(NavigateToURL(shell(), main_url));
9560
9561 FrameTreeNode* root = static_cast<WebContentsImpl*>(shell()->web_contents())
9562 ->GetFrameTree()
9563 ->root();
9564 scoped_refptr<SiteInstanceImpl> b_site_instance =
9565 root->child_at(0)->current_frame_host()->GetSiteInstance();
9566
9567 // Navigate subframe to a URL that will redirect from a.com back to b.com.
9568 // This navigation shouldn't time out. Also ensure that the pending RFH
9569 // that was created for a.com is destroyed.
9570 GURL frame_url(
9571 embedded_test_server()->GetURL("a.com", "/cross-site/b.com/title2.html"));
9572 NavigateIframeToURL(shell()->web_contents(), "child-0", frame_url);
9573 EXPECT_FALSE(root->child_at(0)->render_manager()->pending_frame_host());
9574 GURL redirected_url(embedded_test_server()->GetURL("b.com", "/title2.html"));
9575 EXPECT_EQ(root->child_at(0)->current_url(), redirected_url);
9576 EXPECT_EQ(b_site_instance,
9577 root->child_at(0)->current_frame_host()->GetSiteInstance());
9578
9579 // Try the same navigation, but use the browser-initiated path.
9580 NavigateFrameToURL(root->child_at(0), frame_url);
9581 EXPECT_FALSE(root->child_at(0)->render_manager()->pending_frame_host());
9582 EXPECT_EQ(root->child_at(0)->current_url(), redirected_url);
9583 EXPECT_EQ(b_site_instance,
9584 root->child_at(0)->current_frame_host()->GetSiteInstance());
9585 }
9586
9552 } // namespace content 9587 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/frame_host/render_frame_host_manager.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698