| Index: content/browser/frame_host/navigation_controller_impl_browsertest.cc
|
| diff --git a/content/browser/frame_host/navigation_controller_impl_browsertest.cc b/content/browser/frame_host/navigation_controller_impl_browsertest.cc
|
| index 301f27a133c1f85ab24fd1fb4ea454418030f86a..51bebd184f51b33716737d07ae883214a9b1094e 100644
|
| --- a/content/browser/frame_host/navigation_controller_impl_browsertest.cc
|
| +++ b/content/browser/frame_host/navigation_controller_impl_browsertest.cc
|
| @@ -309,6 +309,57 @@ IN_PROC_BROWSER_TEST_F(NavigationControllerBrowserTest, SubframeOnEmptyPage) {
|
| new_shell->web_contents()->GetController().GetLastCommittedEntry());
|
| }
|
|
|
| +// Similar to SubframeOnEmptyPage, but verifies that in-page navigations on the
|
| +// initial about:blank document also do not create NavigationEntries. This was
|
| +// a problem when cloning subframe FrameNavigationEntries in --site-per-process.
|
| +// See https://crbug.com/522193.
|
| +IN_PROC_BROWSER_TEST_F(NavigationControllerBrowserTest, InPageOnEmptyPage) {
|
| + NavigateToURL(shell(), GURL(url::kAboutBlankURL));
|
| + EXPECT_TRUE(WaitForLoadStop(shell()->web_contents()));
|
| +
|
| + FrameTreeNode* root =
|
| + static_cast<WebContentsImpl*>(shell()->web_contents())->
|
| + GetFrameTree()->root();
|
| +
|
| + // Pop open a new window.
|
| + ShellAddedObserver new_shell_observer;
|
| + std::string script = "window.open()";
|
| + EXPECT_TRUE(content::ExecuteScript(root->current_frame_host(), script));
|
| + Shell* new_shell = new_shell_observer.GetShell();
|
| + ASSERT_NE(new_shell->web_contents(), shell()->web_contents());
|
| + FrameTreeNode* new_root =
|
| + static_cast<WebContentsImpl*>(new_shell->web_contents())->
|
| + GetFrameTree()->root();
|
| +
|
| + // Make a new iframe in it.
|
| + NoNavigationsObserver observer(new_shell->web_contents());
|
| + script = "var iframe = document.createElement('iframe');"
|
| + "iframe.src = 'data:text/html,<p>some page</p>';"
|
| + "document.body.appendChild(iframe);";
|
| + EXPECT_TRUE(content::ExecuteScript(new_root->current_frame_host(), script));
|
| + // The success check is of the last-committed entry, and there is none.
|
| + WaitForLoadStopWithoutSuccessCheck(new_shell->web_contents());
|
| +
|
| + ASSERT_EQ(1U, new_root->child_count());
|
| + ASSERT_NE(nullptr, new_root->child_at(0));
|
| +
|
| + // Navigate in-page in the main frame, which should be ignored.
|
| + script = "location.href='#foo';";
|
| + EXPECT_TRUE(content::ExecuteScript(new_root->current_frame_host(), script));
|
| + EXPECT_TRUE(WaitForLoadStop(shell()->web_contents()));
|
| + EXPECT_EQ(nullptr,
|
| + new_shell->web_contents()->GetController().GetLastCommittedEntry());
|
| +
|
| + // Make a new nested iframe. Shouldn't crash.
|
| + script = "var iframe = document.createElement('iframe');"
|
| + "iframe.src = 'data:text/html,<p>nested page</p>';"
|
| + "document.body.appendChild(iframe);";
|
| + EXPECT_TRUE(content::ExecuteScript(
|
| + new_root->child_at(0)->current_frame_host(), script));
|
| + // The success check is of the last-committed entry, and there is none.
|
| + WaitForLoadStopWithoutSuccessCheck(new_shell->web_contents());
|
| +}
|
| +
|
| namespace {
|
|
|
| class FrameNavigateParamsCapturer : public WebContentsObserver {
|
|
|