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

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: 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 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.
1885 if (delegate_->GetInterstitialPage()) 1885 //
1886 delegate_->GetInterstitialPage()->DontProceed(); 1886 // There are two ways to get the interstitial page given a WebContents.
1887 // Because WebContents::GetInterstitialPage() returns null between the
1888 // interstitial's Show() method being called and the interstitial becoming
1889 // visible, while InterstitialPage::GetInterstitialPage() returns the
1890 // interstitial during that time, use the latter.
1891 InterstitialPage* interstitial =
1892 InterstitialPage::GetInterstitialPage(GetWebContents());
1893 if (interstitial)
1894 interstitial->DontProceed();
1887 1895
1888 DiscardNonCommittedEntries(); 1896 DiscardNonCommittedEntries();
1889 return; 1897 return;
1890 } 1898 }
1891 1899
1892 // If an interstitial page is showing, the previous renderer is blocked and 1900 // If an interstitial page is showing, the previous renderer is blocked and
1893 // cannot make new requests. Unblock (and disable) it to allow this 1901 // cannot make new requests. Unblock (and disable) it to allow this
1894 // navigation to succeed. The interstitial will stay visible until the 1902 // navigation to succeed. The interstitial will stay visible until the
1895 // resulting DidNavigate. 1903 // resulting DidNavigate.
1896 if (delegate_->GetInterstitialPage()) { 1904 if (delegate_->GetInterstitialPage()) {
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after
2234 DCHECK(pending_entry_index_ == -1 || 2242 DCHECK(pending_entry_index_ == -1 ||
2235 pending_entry_ == GetEntryAtIndex(pending_entry_index_)); 2243 pending_entry_ == GetEntryAtIndex(pending_entry_index_));
2236 } 2244 }
2237 2245
2238 void NavigationControllerImpl::SetGetTimestampCallbackForTest( 2246 void NavigationControllerImpl::SetGetTimestampCallbackForTest(
2239 const base::Callback<base::Time()>& get_timestamp_callback) { 2247 const base::Callback<base::Time()>& get_timestamp_callback) {
2240 get_timestamp_callback_ = get_timestamp_callback; 2248 get_timestamp_callback_ = get_timestamp_callback;
2241 } 2249 }
2242 2250
2243 } // namespace content 2251 } // 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