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

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

Issue 2299843002: Fix the page's SSL status not being set on restore. (Closed)
Patch Set: add same page fix and test Created 4 years, 3 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 | « chrome/browser/ssl/ssl_browser_tests.cc ('k') | 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 1168 matching lines...) Expand 10 before | Expand all | Expand 10 after
1179 1179
1180 NavigationEntryImpl* entry; 1180 NavigationEntryImpl* entry;
1181 if (params.intended_as_new_entry) { 1181 if (params.intended_as_new_entry) {
1182 // This was intended as a new entry but the pending entry was lost in the 1182 // This was intended as a new entry but the pending entry was lost in the
1183 // meanwhile and no new page was created. We are stuck at the last committed 1183 // meanwhile and no new page was created. We are stuck at the last committed
1184 // entry. 1184 // entry.
1185 entry = GetLastCommittedEntry(); 1185 entry = GetLastCommittedEntry();
1186 } else if (params.nav_entry_id) { 1186 } else if (params.nav_entry_id) {
1187 // This is a browser-initiated navigation (back/forward/reload). 1187 // This is a browser-initiated navigation (back/forward/reload).
1188 entry = GetEntryWithUniqueID(params.nav_entry_id); 1188 entry = GetEntryWithUniqueID(params.nav_entry_id);
1189
1190 // Needed for the restore case, where the serialized NavigationEntry doesn't
1191 // have the SSL state.
1192 NavigationHandleImpl* handle = rfh->navigation_handle();
1193 entry->GetSSL() = handle->ssl_status();
1189 } else { 1194 } else {
1190 // This is renderer-initiated. The only kinds of renderer-initated 1195 // This is renderer-initiated. The only kinds of renderer-initated
1191 // navigations that are EXISTING_PAGE are reloads and location.replace, 1196 // navigations that are EXISTING_PAGE are reloads and location.replace,
1192 // which land us at the last committed entry. 1197 // which land us at the last committed entry.
1193 entry = GetLastCommittedEntry(); 1198 entry = GetLastCommittedEntry();
1194 } 1199 }
1195 DCHECK(entry); 1200 DCHECK(entry);
1196 1201
1197 // The URL may have changed due to redirects. 1202 // The URL may have changed due to redirects.
1198 entry->set_page_type(params.url_is_unreachable ? PAGE_TYPE_ERROR 1203 entry->set_page_type(params.url_is_unreachable ? PAGE_TYPE_ERROR
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
1253 DCHECK_EQ(pending_entry_->GetUniqueID(), params.nav_entry_id); 1258 DCHECK_EQ(pending_entry_->GetUniqueID(), params.nav_entry_id);
1254 existing_entry->set_unique_id(pending_entry_->GetUniqueID()); 1259 existing_entry->set_unique_id(pending_entry_->GetUniqueID());
1255 1260
1256 // The URL may have changed due to redirects. 1261 // The URL may have changed due to redirects.
1257 existing_entry->set_page_type(params.url_is_unreachable ? PAGE_TYPE_ERROR 1262 existing_entry->set_page_type(params.url_is_unreachable ? PAGE_TYPE_ERROR
1258 : PAGE_TYPE_NORMAL); 1263 : PAGE_TYPE_NORMAL);
1259 if (existing_entry->update_virtual_url_with_url()) 1264 if (existing_entry->update_virtual_url_with_url())
1260 UpdateVirtualURLToURL(existing_entry, params.url); 1265 UpdateVirtualURLToURL(existing_entry, params.url);
1261 existing_entry->SetURL(params.url); 1266 existing_entry->SetURL(params.url);
1262 1267
1268 // If a user presses enter in the omnibox and the server redirects, the URL
1269 // might change (but it's still considered a SAME_PAGE navigation). So we must
1270 // update the SSL status.
1271 existing_entry->GetSSL() = rfh->navigation_handle()->ssl_status();
nasko 2016/09/01 15:48:45 Just out of curiousity, does the new test you adde
jam 2016/09/01 15:53:01 of course :)
1272
1263 // Update the existing FrameNavigationEntry to ensure all of its members 1273 // Update the existing FrameNavigationEntry to ensure all of its members
1264 // reflect the parameters coming from the renderer process. 1274 // reflect the parameters coming from the renderer process.
1265 existing_entry->AddOrUpdateFrameEntry( 1275 existing_entry->AddOrUpdateFrameEntry(
1266 rfh->frame_tree_node(), params.item_sequence_number, 1276 rfh->frame_tree_node(), params.item_sequence_number,
1267 params.document_sequence_number, rfh->GetSiteInstance(), nullptr, 1277 params.document_sequence_number, rfh->GetSiteInstance(), nullptr,
1268 params.url, params.referrer, params.page_state, params.method, 1278 params.url, params.referrer, params.page_state, params.method,
1269 params.post_id); 1279 params.post_id);
1270 1280
1271 DiscardNonCommittedEntries(); 1281 DiscardNonCommittedEntries();
1272 } 1282 }
(...skipping 828 matching lines...) Expand 10 before | Expand all | Expand 10 after
2101 } 2111 }
2102 } 2112 }
2103 } 2113 }
2104 2114
2105 void NavigationControllerImpl::SetGetTimestampCallbackForTest( 2115 void NavigationControllerImpl::SetGetTimestampCallbackForTest(
2106 const base::Callback<base::Time()>& get_timestamp_callback) { 2116 const base::Callback<base::Time()>& get_timestamp_callback) {
2107 get_timestamp_callback_ = get_timestamp_callback; 2117 get_timestamp_callback_ = get_timestamp_callback;
2108 } 2118 }
2109 2119
2110 } // namespace content 2120 } // namespace content
OLDNEW
« no previous file with comments | « chrome/browser/ssl/ssl_browser_tests.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698