Index: content/browser/frame_host/navigation_controller_impl.cc |
diff --git a/content/browser/frame_host/navigation_controller_impl.cc b/content/browser/frame_host/navigation_controller_impl.cc |
index 1f07ec664e0b2f0f212e746e2fb5d89d9d80db42..ec704d44cbf777237d067d48cbd962f5a419c6f8 100644 |
--- a/content/browser/frame_host/navigation_controller_impl.cc |
+++ b/content/browser/frame_host/navigation_controller_impl.cc |
@@ -1880,10 +1880,18 @@ void NavigationControllerImpl::NavigateToPendingEntry(ReloadType reload_type) { |
pending_entry_->GetTransitionType() & ui::PAGE_TRANSITION_FORWARD_BACK) { |
delegate_->Stop(); |
- // If an interstitial page is showing, we want to close it to get back |
- // to what was showing before. |
- if (delegate_->GetInterstitialPage()) |
- delegate_->GetInterstitialPage()->DontProceed(); |
+ // If an interstitial page is showing, we want to close it to get back to |
+ // what was showing before. |
+ // |
+ // There are two ways to get the interstitial page given a WebContents. |
+ // Because WebContents::GetInterstitialPage() returns null between the |
+ // interstitial's Show() method being called and the interstitial becoming |
+ // visible, while InterstitialPage::GetInterstitialPage() returns the |
+ // interstitial during that time, use the latter. |
+ InterstitialPage* interstitial = |
+ InterstitialPage::GetInterstitialPage(GetWebContents()); |
+ if (interstitial) |
+ interstitial->DontProceed(); |
DiscardNonCommittedEntries(); |
return; |