diff options
author | jcampan@chromium.org <jcampan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-04-27 23:59:39 +0000 |
---|---|---|
committer | jcampan@chromium.org <jcampan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-04-27 23:59:39 +0000 |
commit | 2bf52ed344c1036c5b35100e18c23b0698b750fc (patch) | |
tree | 58cf0de05e17a173c8af46edca1c1a5ec61d7a77 /chrome | |
parent | 97ba7b078d6971d0ca7e713749b1671999f1fc28 (diff) | |
download | chromium_src-2bf52ed344c1036c5b35100e18c23b0698b750fc.zip chromium_src-2bf52ed344c1036c5b35100e18c23b0698b750fc.tar.gz chromium_src-2bf52ed344c1036c5b35100e18c23b0698b750fc.tar.bz2 |
When navigating from an interstitial to another page with an interstitial, we should not discard the non committed entries, as this would cause the new navigation pending entry to go away.
BUG=9791
TEST=Visit a page with an SSL error (ex: https://ebay.com). Focus the location bar and press enter (to navigate again to that page). The interstitial should be shown again and the location bar should show the URL. Also ensure that interstitial pages (SSL and safe browsing) still work as expected.
Review URL: http://codereview.chromium.org/100002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@14687 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/browser/tab_contents/interstitial_page.cc | 16 | ||||
-rw-r--r-- | chrome/browser/tab_contents/interstitial_page.h | 6 |
2 files changed, 19 insertions, 3 deletions
diff --git a/chrome/browser/tab_contents/interstitial_page.cc b/chrome/browser/tab_contents/interstitial_page.cc index 6f32c76..ca9be04 100644 --- a/chrome/browser/tab_contents/interstitial_page.cc +++ b/chrome/browser/tab_contents/interstitial_page.cc @@ -106,6 +106,7 @@ InterstitialPage::InterstitialPage(WebContents* tab, : tab_(tab), url_(url), new_navigation_(new_navigation), + should_discard_pending_nav_entry_(new_navigation), enabled_(true), action_taken_(false), render_view_host_(NULL), @@ -138,10 +139,19 @@ void InterstitialPage::Show() { // If an interstitial is already showing, close it before showing the new one. // Be careful not to take an action on the old interstitial more than once. if (tab_->interstitial_page()) { - if (tab_->interstitial_page()->action_taken()) + if (tab_->interstitial_page()->action_taken()) { tab_->interstitial_page()->Hide(); - else + } else { + // If we are currently showing an interstitial page for which we created + // a transient entry and a new interstitial is shown as the result of a + // new browser initiated navigation, then that transient entry has already + // been discarded and a new pending navigation entry created. + // So we should not discard that new pending navigation entry. + // See http://crbug.com/9791 + if (new_navigation_ && tab_->interstitial_page()->new_navigation_) + tab_->interstitial_page()->should_discard_pending_nav_entry_= false; tab_->interstitial_page()->DontProceed(); + } } // Block the resource requests for the render view host while it is hidden. @@ -316,7 +326,7 @@ void InterstitialPage::DontProceed() { else TakeActionOnResourceDispatcher(CANCEL); - if (new_navigation_) { + if (should_discard_pending_nav_entry_) { // Since no navigation happens we have to discard the transient entry // explicitely. Note that by calling DiscardNonCommittedEntries() we also // discard the pending entry, which is what we want, since the navigation is diff --git a/chrome/browser/tab_contents/interstitial_page.h b/chrome/browser/tab_contents/interstitial_page.h index 1c42520..1e35ea4 100644 --- a/chrome/browser/tab_contents/interstitial_page.h +++ b/chrome/browser/tab_contents/interstitial_page.h @@ -151,6 +151,12 @@ class InterstitialPage : public NotificationObserver, // which case a transient navigation entry is created). bool new_navigation_; + // Whether we should discard the pending navigation entry when not proceeding. + // This is to deal with cases where |new_navigation_| is true but a new + // pending entry was created since this interstitial was shown and we should + // not discard it. + bool should_discard_pending_nav_entry_; + // Whether this interstitial is enabled. See Disable() for more info. bool enabled_; |