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

Side by Side Diff: chrome/browser/navigation_controller.cc

Issue 9062: Hack around crash. (Closed) Base URL: svn://chrome-svn/chrome/branches/chrome_official_branch/src/
Patch Set: '' Created 12 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 #include "chrome/browser/navigation_controller.h" 5 #include "chrome/browser/navigation_controller.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/file_util.h" 8 #include "base/file_util.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/string_util.h" 10 #include "base/string_util.h"
(...skipping 844 matching lines...) Expand 10 before | Expand all | Expand 10 after
855 855
856 entries_.pop_back(); 856 entries_.pop_back();
857 857
858 if (last_committed_entry_index_ >= current_size - 1) { 858 if (last_committed_entry_index_ >= current_size - 1) {
859 last_committed_entry_index_ = current_size - 2; 859 last_committed_entry_index_ = current_size - 2;
860 860
861 if (last_committed_entry_index_ != -1) { 861 if (last_committed_entry_index_ != -1) {
862 // Broadcast the notification of the navigation. This is kind of a hack, 862 // Broadcast the notification of the navigation. This is kind of a hack,
863 // since the navigation wasn't actually committed. But this function is 863 // since the navigation wasn't actually committed. But this function is
864 // used for interstital pages, and the UI needs to get updated when the 864 // used for interstital pages, and the UI needs to get updated when the
865 // interstitial page 865 // interstitial page. Since we want to preserve the SSL state, we
866 // recreate the serialized security info so the SSL manager doesn't
867 // clear out the state (thinking it just got a commit from the renderer
868 // with no security state).
866 LoadCommittedDetails details; 869 LoadCommittedDetails details;
867 details.entry = GetActiveEntry(); 870 details.entry = GetActiveEntry();
868 details.is_auto = false; 871 details.is_auto = false;
869 details.is_in_page = false; 872 details.is_in_page = false;
870 details.is_main_frame = true; 873 details.is_main_frame = true;
874 details.serialized_security_info = SSLManager::SerializeSecurityInfo(
875 details.entry->ssl().cert_id(),
876 details.entry->ssl().cert_status(),
877 details.entry->ssl().security_bits());
871 NotifyNavigationEntryCommitted(&details); 878 NotifyNavigationEntryCommitted(&details);
872 } 879 }
873 } 880 }
874 881
875 NotifyPrunedEntries(this, false, 1); 882 NotifyPrunedEntries(this, false, 1);
876 } 883 }
877 } 884 }
878 885
879 void NavigationController::AddDummyEntryForInterstitial( 886 void NavigationController::AddDummyEntryForInterstitial(
880 const NavigationEntry& clone_me) { 887 const NavigationEntry& clone_me) {
(...skipping 21 matching lines...) Expand all
902 return AreURLsInPageNavigation(last_committed->url(), url); 909 return AreURLsInPageNavigation(last_committed->url(), url);
903 } 910 }
904 911
905 void NavigationController::DiscardPendingEntry() { 912 void NavigationController::DiscardPendingEntry() {
906 DiscardPendingEntryInternal(); 913 DiscardPendingEntryInternal();
907 914
908 // Synchronize the active_contents_ to the last committed entry. 915 // Synchronize the active_contents_ to the last committed entry.
909 NavigationEntry* last_entry = GetLastCommittedEntry(); 916 NavigationEntry* last_entry = GetLastCommittedEntry();
910 if (last_entry && last_entry->tab_type() != active_contents_->type()) { 917 if (last_entry && last_entry->tab_type() != active_contents_->type()) {
911 TabContents* from_contents = active_contents_; 918 TabContents* from_contents = active_contents_;
919 if (from_contents->type() == active_contents_->type()) {
920 // EVIL HACK ALERT! This condition is a wallpaper patch around bug
921 // http://code.google.com/p/chromium/issues/detail?id=2855
922 // See the bug for more, but the short answer is that an old render view
923 // host's "cancel" message will get received by a newer one that happens
924 // to be navigated to the same URL, which will trigger improperly
925 // discarding the pending entry. This will in turn trigger tab contents
926 // collection and other bad things.
927 //
928 // This early return doesn't fix the problem at all, but does prevent the
929 // immediate crash. There are very likely to be problems as a result of
930 // the confused state that this generates, so the underlying bug really
931 // needs to be fixed!
932 return;
933 }
912 from_contents->set_is_active(false); 934 from_contents->set_is_active(false);
913 935
914 // Switch back to the previous tab contents. 936 // Switch back to the previous tab contents.
915 active_contents_ = GetTabContents(last_entry->tab_type()); 937 active_contents_ = GetTabContents(last_entry->tab_type());
916 DCHECK(active_contents_); 938 DCHECK(active_contents_);
917 939
918 active_contents_->set_is_active(true); 940 active_contents_->set_is_active(true);
919 941
920 // If we are transitioning from two types of WebContents, we need to migrate 942 // If we are transitioning from two types of WebContents, we need to migrate
921 // the download shelf if it is visible. The download shelf may have been 943 // the download shelf if it is visible. The download shelf may have been
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after
1220 int NavigationController::GetEntryIndexWithPageID( 1242 int NavigationController::GetEntryIndexWithPageID(
1221 TabContentsType type, SiteInstance* instance, int32 page_id) const { 1243 TabContentsType type, SiteInstance* instance, int32 page_id) const {
1222 for (int i = static_cast<int>(entries_.size()) - 1; i >= 0; --i) { 1244 for (int i = static_cast<int>(entries_.size()) - 1; i >= 0; --i) {
1223 if ((entries_[i]->tab_type() == type) && 1245 if ((entries_[i]->tab_type() == type) &&
1224 (entries_[i]->site_instance() == instance) && 1246 (entries_[i]->site_instance() == instance) &&
1225 (entries_[i]->page_id() == page_id)) 1247 (entries_[i]->page_id() == page_id))
1226 return i; 1248 return i;
1227 } 1249 }
1228 return -1; 1250 return -1;
1229 } 1251 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698