Skip to content

Commit

Permalink
Revert of Swap the main frame in --site-per-process mode too. (patchset
Browse files Browse the repository at this point in the history
#5 id:80001 of https://codereview.chromium.org/1106673002/)

Reason for revert:
This breaks some tests on the site isolation bots.

Original issue's description:
> Swap the main frame in --site-per-process mode too.
>
> Calling swap() is required to set up a lot of required state in Blink
> for the WebRemoteFrame. Without this, bad things happen.
>
> BUG=475003
>
> Committed: https://crrev.com/9463868c8a2d30b6a81db9fd2b61e8a5935ac347
> Cr-Commit-Position: refs/heads/master@{#329012}

TBR=creis@chromium.org,nasko@chromium.org,alexmos@chromium.org
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=475003

Review URL: https://codereview.chromium.org/1137833002

Cr-Commit-Position: refs/heads/master@{#329024}
  • Loading branch information
zetafunction authored and Commit bot committed May 8, 2015
1 parent 8a94811 commit 42cda64
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 39 deletions.
38 changes: 0 additions & 38 deletions content/browser/site_per_process_browsertest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2395,42 +2395,4 @@ IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, RFPHDestruction) {
DepictFrameTree(root));
}

// Test that opening a cross-site window with child frames doesn't crash either
// renderer in --site-per-process. This was previously broken because frame
// swaps weren't being performed on main frames, so it would crash when trying
// to mirror the child frames. https://crbug.com/475003
IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest,
OpenCrossSiteWindowWithFrames) {
ASSERT_EQ(1u, Shell::windows().size());
Shell* main_window = Shell::windows()[0];

// Navigate the main window.
GURL main_url(embedded_test_server()->GetURL("/site_per_process_main.html"));
NavigateToURL(main_window, main_url);
EXPECT_EQ(main_window->web_contents()->GetLastCommittedURL(), main_url);

// Load a cross-site page into a new window.
GURL cross_url =
embedded_test_server()->GetURL("foo.com", "/site_per_process_main.html");
std::string script = "window.open('" + cross_url.spec() + "')";
EXPECT_TRUE(ExecuteScript(main_window->web_contents(), script));
ASSERT_EQ(2u, Shell::windows().size());
Shell* cross_window = Shell::windows()[1];
WaitForLoadStop(cross_window->web_contents());
EXPECT_EQ(cross_window->web_contents()->GetLastCommittedURL(), cross_url);

// Make sure the main window is still live. To create a synchronization point
// and ensure that the renderer has processed all the messages for updating
// the frame tree, execute a simple bit of JS first.
EXPECT_TRUE(ExecuteScript(main_window->web_contents(), "true"));
EXPECT_TRUE(static_cast<WebContentsImpl*>(main_window->web_contents())
->GetMainFrame()
->IsRenderFrameLive());
// And check the cross-site window too.
EXPECT_TRUE(ExecuteScript(cross_window->web_contents(), "true"));
EXPECT_TRUE(static_cast<WebContentsImpl*>(cross_window->web_contents())
->GetMainFrame()
->IsRenderFrameLive());
}

} // namespace content
2 changes: 1 addition & 1 deletion content/renderer/render_frame_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1227,7 +1227,7 @@ void RenderFrameImpl::OnSwapOut(
// Now that all of the cleanup is complete and the browser side is notified,
// start using the RenderFrameProxy, if one is created.
if (proxy) {
if (!is_main_frame || is_site_per_process) {
if (!is_main_frame) {
frame_->swap(proxy->web_frame());

if (is_loading)
Expand Down

0 comments on commit 42cda64

Please sign in to comment.