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

Side by Side Diff: content/browser/frame_host/navigation_controller_impl.cc

Issue 2707133003: Fix SSL certificate being wrong in the intended_as_new_entry fase of NAVIGATION_TYPE_EXISTING_PAGE. (Closed)
Patch Set: update Created 3 years, 10 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 | 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 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 1083 matching lines...) Expand 10 before | Expand all | Expand 10 after
1094 // entry instead of looking at the pending entry, because the pending entry 1094 // entry instead of looking at the pending entry, because the pending entry
1095 // does not have any subframe history items. 1095 // does not have any subframe history items.
1096 if (is_in_page && GetLastCommittedEntry()) { 1096 if (is_in_page && GetLastCommittedEntry()) {
1097 FrameNavigationEntry* frame_entry = new FrameNavigationEntry( 1097 FrameNavigationEntry* frame_entry = new FrameNavigationEntry(
1098 params.frame_unique_name, params.item_sequence_number, 1098 params.frame_unique_name, params.item_sequence_number,
1099 params.document_sequence_number, rfh->GetSiteInstance(), nullptr, 1099 params.document_sequence_number, rfh->GetSiteInstance(), nullptr,
1100 params.url, params.referrer, params.method, params.post_id); 1100 params.url, params.referrer, params.method, params.post_id);
1101 new_entry = GetLastCommittedEntry()->CloneAndReplace( 1101 new_entry = GetLastCommittedEntry()->CloneAndReplace(
1102 frame_entry, true, rfh->frame_tree_node(), 1102 frame_entry, true, rfh->frame_tree_node(),
1103 delegate_->GetFrameTree()->root()); 1103 delegate_->GetFrameTree()->root());
1104 if (new_entry->GetURL().GetOrigin() != params.url.GetOrigin()) {
1105 // TODO(jam): we had one report of this with a URL that was redirecting to
1106 // only tildes. Until we understand that better, don't copy the cert in
1107 // this case.
1108 new_entry->GetSSL() = SSLStatus();
1109 }
1104 1110
1105 // We expect |frame_entry| to be owned by |new_entry|. This should never 1111 // We expect |frame_entry| to be owned by |new_entry|. This should never
1106 // fail, because it's the main frame. 1112 // fail, because it's the main frame.
1107 CHECK(frame_entry->HasOneRef()); 1113 CHECK(frame_entry->HasOneRef());
1108 1114
1109 update_virtual_url = new_entry->update_virtual_url_with_url(); 1115 update_virtual_url = new_entry->update_virtual_url_with_url();
1110 } 1116 }
1111 1117
1112 // Only make a copy of the pending entry if it is appropriate for the new page 1118 // Only make a copy of the pending entry if it is appropriate for the new page
1113 // that was just loaded. Verify this by checking if the entry corresponds 1119 // that was just loaded. Verify this by checking if the entry corresponds
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
1205 1211
1206 // TODO(creis): Classify location.replace as NEW_PAGE instead of EXISTING_PAGE 1212 // TODO(creis): Classify location.replace as NEW_PAGE instead of EXISTING_PAGE
1207 // in https://crbug.com/596707. 1213 // in https://crbug.com/596707.
1208 1214
1209 NavigationEntryImpl* entry; 1215 NavigationEntryImpl* entry;
1210 if (params.intended_as_new_entry) { 1216 if (params.intended_as_new_entry) {
1211 // This was intended as a new entry but the pending entry was lost in the 1217 // This was intended as a new entry but the pending entry was lost in the
1212 // meanwhile and no new page was created. We are stuck at the last committed 1218 // meanwhile and no new page was created. We are stuck at the last committed
1213 // entry. 1219 // entry.
1214 entry = GetLastCommittedEntry(); 1220 entry = GetLastCommittedEntry();
1221 CHECK(!is_in_page);
1222 entry->GetSSL() = handle->ssl_status();
1215 } else if (params.nav_entry_id) { 1223 } else if (params.nav_entry_id) {
1216 // This is a browser-initiated navigation (back/forward/reload). 1224 // This is a browser-initiated navigation (back/forward/reload).
1217 entry = GetEntryWithUniqueID(params.nav_entry_id); 1225 entry = GetEntryWithUniqueID(params.nav_entry_id);
1218 1226
1219 if (is_in_page) { 1227 if (is_in_page) {
1220 // There's no SSLStatus in the NavigationHandle for in-page navigations, 1228 // There's no SSLStatus in the NavigationHandle for in-page navigations,
1221 // so normally we leave |entry|'s SSLStatus as is. However if this was a 1229 // so normally we leave |entry|'s SSLStatus as is. However if this was a
1222 // restored in-page navigation entry, then it won't have an SSLStatus. So 1230 // restored in-page navigation entry, then it won't have an SSLStatus. So
1223 // we need to copy over the SSLStatus from the entry that navigated it. 1231 // we need to copy over the SSLStatus from the entry that navigated it.
1224 NavigationEntryImpl* last_entry = GetLastCommittedEntry(); 1232 NavigationEntryImpl* last_entry = GetLastCommittedEntry();
(...skipping 922 matching lines...) Expand 10 before | Expand all | Expand 10 after
2147 } 2155 }
2148 } 2156 }
2149 } 2157 }
2150 2158
2151 void NavigationControllerImpl::SetGetTimestampCallbackForTest( 2159 void NavigationControllerImpl::SetGetTimestampCallbackForTest(
2152 const base::Callback<base::Time()>& get_timestamp_callback) { 2160 const base::Callback<base::Time()>& get_timestamp_callback) {
2153 get_timestamp_callback_ = get_timestamp_callback; 2161 get_timestamp_callback_ = get_timestamp_callback;
2154 } 2162 }
2155 2163
2156 } // namespace content 2164 } // namespace content
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