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

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

Issue 2953513002: Fix a race between navigation and an interstitial. (Closed)
Patch Set: with test 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..3ece628e668dc4daff0f6a4af65d659d5403cadb 100644
--- a/content/browser/frame_host/navigation_controller_impl.cc
+++ b/content/browser/frame_host/navigation_controller_impl.cc
@@ -1880,10 +1880,15 @@ 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, but WebContents::GetInterstitialPage might return
+ // null if the interstitial was shown but not yet visible while
Charlie Reis 2017/06/22 16:19:38 nit: s/shown/created/, perhaps?
Avi (use Gerrit) 2017/06/22 18:08:51 I'm talking about the range in which WebContents::
Charlie Reis 2017/06/22 21:06:00 Ok. Can you rephrase to say "if the interstitial'
Avi (use Gerrit) 2017/06/22 21:46:42 I rewrote it a few times, and I'm now much happier
+ // InterstitialPage::GetInterstitialPage will return such an interstitial.
+ 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