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

Side by Side 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 /* 5 /*
6 * Copyright (C) 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. 6 * Copyright (C) 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
7 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) 7 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. 8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved.
9 * (http://www.torchmobile.com/) 9 * (http://www.torchmobile.com/)
10 * 10 *
(...skipping 1862 matching lines...) Expand 10 before | Expand all | Expand 10 after
1873 // will force the throbber to start, but WebKit will essentially ignore the 1873 // will force the throbber to start, but WebKit will essentially ignore the
1874 // navigation, and won't send a message to stop the throbber. To prevent this 1874 // navigation, and won't send a message to stop the throbber. To prevent this
1875 // from happening, we drop the navigation here and stop the slow-to-commit 1875 // from happening, we drop the navigation here and stop the slow-to-commit
1876 // page from loading (which would normally happen during the navigation). 1876 // page from loading (which would normally happen during the navigation).
1877 if (pending_entry_index_ != -1 && 1877 if (pending_entry_index_ != -1 &&
1878 pending_entry_index_ == last_committed_entry_index_ && 1878 pending_entry_index_ == last_committed_entry_index_ &&
1879 pending_entry_->restore_type() == RestoreType::NONE && 1879 pending_entry_->restore_type() == RestoreType::NONE &&
1880 pending_entry_->GetTransitionType() & ui::PAGE_TRANSITION_FORWARD_BACK) { 1880 pending_entry_->GetTransitionType() & ui::PAGE_TRANSITION_FORWARD_BACK) {
1881 delegate_->Stop(); 1881 delegate_->Stop();
1882 1882
1883 // If an interstitial page is showing, we want to close it to get back 1883 // If an interstitial page is showing, we want to close it to get back to
1884 // to what was showing before. 1884 // what was showing before. There are two ways to get the interstitial page
1885 if (delegate_->GetInterstitialPage()) 1885 // given a WebContents, but WebContents::GetInterstitialPage might return
1886 delegate_->GetInterstitialPage()->DontProceed(); 1886 // 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
1887 // InterstitialPage::GetInterstitialPage will return such an interstitial.
1888 InterstitialPage* interstitial =
1889 InterstitialPage::GetInterstitialPage(GetWebContents());
1890 if (interstitial)
1891 interstitial->DontProceed();
1887 1892
1888 DiscardNonCommittedEntries(); 1893 DiscardNonCommittedEntries();
1889 return; 1894 return;
1890 } 1895 }
1891 1896
1892 // If an interstitial page is showing, the previous renderer is blocked and 1897 // If an interstitial page is showing, the previous renderer is blocked and
1893 // cannot make new requests. Unblock (and disable) it to allow this 1898 // cannot make new requests. Unblock (and disable) it to allow this
1894 // navigation to succeed. The interstitial will stay visible until the 1899 // navigation to succeed. The interstitial will stay visible until the
1895 // resulting DidNavigate. 1900 // resulting DidNavigate.
1896 if (delegate_->GetInterstitialPage()) { 1901 if (delegate_->GetInterstitialPage()) {
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after
2234 DCHECK(pending_entry_index_ == -1 || 2239 DCHECK(pending_entry_index_ == -1 ||
2235 pending_entry_ == GetEntryAtIndex(pending_entry_index_)); 2240 pending_entry_ == GetEntryAtIndex(pending_entry_index_));
2236 } 2241 }
2237 2242
2238 void NavigationControllerImpl::SetGetTimestampCallbackForTest( 2243 void NavigationControllerImpl::SetGetTimestampCallbackForTest(
2239 const base::Callback<base::Time()>& get_timestamp_callback) { 2244 const base::Callback<base::Time()>& get_timestamp_callback) {
2240 get_timestamp_callback_ = get_timestamp_callback; 2245 get_timestamp_callback_ = get_timestamp_callback;
2241 } 2246 }
2242 2247
2243 } // namespace content 2248 } // namespace content
OLDNEW
« 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