summaryrefslogtreecommitdiff
path: root/chromium/content/browser/frame_host
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/content/browser/frame_host')
-rw-r--r--chromium/content/browser/frame_host/interstitial_page_impl.cc6
-rw-r--r--chromium/content/browser/frame_host/navigation_controller_impl_browsertest.cc37
2 files changed, 43 insertions, 0 deletions
diff --git a/chromium/content/browser/frame_host/interstitial_page_impl.cc b/chromium/content/browser/frame_host/interstitial_page_impl.cc
index af9c604d578..94e29b878e1 100644
--- a/chromium/content/browser/frame_host/interstitial_page_impl.cc
+++ b/chromium/content/browser/frame_host/interstitial_page_impl.cc
@@ -836,6 +836,12 @@ void InterstitialPageImpl::Shutdown() {
}
void InterstitialPageImpl::OnNavigatingAwayOrTabClosing() {
+ // Notify the RenderWidgetHostView so it can clean up interstitial resources
+ // before the WebContents is fully destroyed.
+ if (render_view_host_ && render_view_host_->GetWidget() &&
+ render_view_host_->GetWidget()->GetView()) {
+ render_view_host_->GetWidget()->GetView()->OnInterstitialPageGoingAway();
+ }
if (action_taken_ == NO_ACTION) {
// We are navigating away from the interstitial or closing a tab with an
// interstitial. Default to DontProceed(). We don't just call Hide as
diff --git a/chromium/content/browser/frame_host/navigation_controller_impl_browsertest.cc b/chromium/content/browser/frame_host/navigation_controller_impl_browsertest.cc
index ee48fdd3405..1462dab7844 100644
--- a/chromium/content/browser/frame_host/navigation_controller_impl_browsertest.cc
+++ b/chromium/content/browser/frame_host/navigation_controller_impl_browsertest.cc
@@ -7656,6 +7656,43 @@ IN_PROC_BROWSER_TEST_F(NavigationControllerBrowserTest,
}
}
+// Regression test for https://crbug.com/845923.
+IN_PROC_BROWSER_TEST_F(NavigationControllerBrowserTest,
+ GoBackFromCrossSiteSubFrame) {
+ // Navigate to a page with a cross-site frame.
+ GURL main_url(embedded_test_server()->GetURL(
+ "a.com", "/cross_site_iframe_factory.html?a(b)"));
+ EXPECT_TRUE(NavigateToURL(shell(), main_url));
+ FrameTreeNode* root = static_cast<WebContentsImpl*>(shell()->web_contents())
+ ->GetFrameTree()
+ ->root();
+ GURL initial_subframe_url =
+ root->child_at(0)->current_frame_host()->GetLastCommittedURL();
+ NavigationControllerImpl& controller = static_cast<NavigationControllerImpl&>(
+ shell()->web_contents()->GetController());
+ EXPECT_EQ(1, controller.GetEntryCount());
+ EXPECT_EQ(0, controller.GetCurrentEntryIndex());
+
+ // Navigate the subframe to another cross-site location
+ // (this prepares for executing history.back() in a later step).
+ GURL final_subframe_url =
+ embedded_test_server()->GetURL("b.com", "/title1.html");
+ NavigateFrameToURL(root->child_at(0), final_subframe_url);
+ EXPECT_EQ(final_subframe_url,
+ root->child_at(0)->current_frame_host()->GetLastCommittedURL());
+ EXPECT_EQ(2, controller.GetEntryCount());
+ EXPECT_EQ(1, controller.GetCurrentEntryIndex());
+
+ // Execute |history.back()| in the subframe.
+ TestNavigationObserver nav_observer(shell()->web_contents(), 1);
+ EXPECT_TRUE(ExecuteScript(root->child_at(0), "history.back()"));
+ nav_observer.Wait();
+ EXPECT_EQ(initial_subframe_url,
+ root->child_at(0)->current_frame_host()->GetLastCommittedURL());
+ EXPECT_EQ(2, controller.GetEntryCount());
+ EXPECT_EQ(0, controller.GetCurrentEntryIndex());
+}
+
IN_PROC_BROWSER_TEST_F(NavigationControllerBrowserTest,
HashNavigationVsBeforeUnloadEvent) {
GURL main_url(embedded_test_server()->GetURL("/title1.html"));