Index: content/browser/web_contents/web_contents_impl.cc |
diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc |
index 8aea87eae6df3c70b7b21a7f1ec03a1e53a1b19d..5d4e9003a776fa156fee91a96061c3d3368407a3 100644 |
--- a/content/browser/web_contents/web_contents_impl.cc |
+++ b/content/browser/web_contents/web_contents_impl.cc |
@@ -363,6 +363,14 @@ WebContentsImpl::WebContentsImpl( |
WebContentsImpl::~WebContentsImpl() { |
is_being_destroyed_ = true; |
+ // If there is an interstitial page being shown, tell it to close down early |
+ // so that this contents will be alive enough to handle all the UI triggered |
+ // by that. <http://crbug.com/363564> |
+ InterstitialPageImpl* interstitial_page = |
+ static_cast<InterstitialPageImpl*>(GetInterstitialPage()); |
+ if (interstitial_page) |
+ interstitial_page->WebContentsWillBeDestroyed(); |
+ |
// Delete all RFH pending shutdown, which will lead the corresponding RVH to |
// shutdown and be deleted as well. |
frame_tree_.ForEach( |
@@ -1769,7 +1777,7 @@ void WebContentsImpl::AttachInterstitialPage( |
} |
void WebContentsImpl::DetachInterstitialPage() { |
- if (GetInterstitialPage()) |
+ if (ShowingInterstitialPage()) |
GetRenderManager()->remove_interstitial_page(); |
FOR_EACH_OBSERVER(WebContentsObserver, observers_, |
DidDetachInterstitialPage()); |