Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(978)

Unified Diff: content/browser/frame_host/navigation_controller_impl.cc

Issue 2953513002: Fix a race between navigation and an interstitial. (Closed)
Patch Set: reword Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | content/browser/web_contents/web_contents_impl_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
« no previous file with comments | « no previous file | content/browser/web_contents/web_contents_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698