Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 1160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1171 void NavigationControllerImpl::RendererDidNavigateToExistingPage( | 1171 void NavigationControllerImpl::RendererDidNavigateToExistingPage( |
| 1172 RenderFrameHostImpl* rfh, | 1172 RenderFrameHostImpl* rfh, |
| 1173 const FrameHostMsg_DidCommitProvisionalLoad_Params& params) { | 1173 const FrameHostMsg_DidCommitProvisionalLoad_Params& params) { |
| 1174 // We should only get here for main frame navigations. | 1174 // We should only get here for main frame navigations. |
| 1175 DCHECK(!rfh->GetParent()); | 1175 DCHECK(!rfh->GetParent()); |
| 1176 | 1176 |
| 1177 // TODO(creis): Classify location.replace as NEW_PAGE instead of EXISTING_PAGE | 1177 // TODO(creis): Classify location.replace as NEW_PAGE instead of EXISTING_PAGE |
| 1178 // in https://crbug.com/596707. | 1178 // in https://crbug.com/596707. |
| 1179 | 1179 |
| 1180 NavigationEntryImpl* entry; | 1180 NavigationEntryImpl* entry; |
| 1181 NavigationHandleImpl* handle = rfh->navigation_handle(); | |
| 1181 if (params.intended_as_new_entry) { | 1182 if (params.intended_as_new_entry) { |
| 1182 // This was intended as a new entry but the pending entry was lost in the | 1183 // 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 | 1184 // meanwhile and no new page was created. We are stuck at the last committed |
| 1184 // entry. | 1185 // entry. |
| 1185 entry = GetLastCommittedEntry(); | 1186 entry = GetLastCommittedEntry(); |
| 1186 } else if (params.nav_entry_id) { | 1187 } else if (params.nav_entry_id) { |
| 1187 // This is a browser-initiated navigation (back/forward/reload). | 1188 // This is a browser-initiated navigation (back/forward/reload). |
| 1188 entry = GetEntryWithUniqueID(params.nav_entry_id); | 1189 entry = GetEntryWithUniqueID(params.nav_entry_id); |
| 1189 | 1190 |
| 1190 // Needed for the restore case, where the serialized NavigationEntry doesn't | 1191 // Needed for the restore case, where the serialized NavigationEntry doesn't |
| 1191 // have the SSL state. | 1192 // have the SSL state. |
| 1192 NavigationHandleImpl* handle = rfh->navigation_handle(); | |
| 1193 entry->GetSSL() = handle->ssl_status(); | 1193 entry->GetSSL() = handle->ssl_status(); |
| 1194 } else { | 1194 } else { |
| 1195 // This is renderer-initiated. The only kinds of renderer-initated | 1195 // This is renderer-initiated. The only kinds of renderer-initated |
| 1196 // navigations that are EXISTING_PAGE are reloads and location.replace, | 1196 // navigations that are EXISTING_PAGE are reloads and location.replace, |
| 1197 // which land us at the last committed entry. | 1197 // which land us at the last committed entry. |
| 1198 entry = GetLastCommittedEntry(); | 1198 entry = GetLastCommittedEntry(); |
| 1199 | |
| 1200 // Until https://crbug.com/596707 is fixed (see comment at top of method), | |
| 1201 // we will get here for location.replace for both same origin and different | |
| 1202 // origin. For the former, there won't be a network request that gives the | |
| 1203 // SSLStatus so we don't want to change this. For the latter, there will be | |
| 1204 // a request and so we need to update the SSLStatus. | |
| 1205 if (params.url.GetOrigin() != entry->GetURL().GetOrigin()) | |
|
felt
2016/09/06 20:09:55
Oof. This fixes the obvious common case but I am c
jam
2016/09/06 20:20:37
If these events occur (mixed content or malicious
jam
2016/09/06 20:28:54
ok thinking some more about this, one issue which
| |
| 1206 entry->GetSSL() = handle->ssl_status(); | |
| 1199 } | 1207 } |
| 1200 DCHECK(entry); | 1208 DCHECK(entry); |
| 1201 | 1209 |
| 1202 // The URL may have changed due to redirects. | 1210 // The URL may have changed due to redirects. |
| 1203 entry->set_page_type(params.url_is_unreachable ? PAGE_TYPE_ERROR | 1211 entry->set_page_type(params.url_is_unreachable ? PAGE_TYPE_ERROR |
| 1204 : PAGE_TYPE_NORMAL); | 1212 : PAGE_TYPE_NORMAL); |
| 1205 entry->SetURL(params.url); | 1213 entry->SetURL(params.url); |
| 1206 entry->SetReferrer(params.referrer); | 1214 entry->SetReferrer(params.referrer); |
| 1207 if (entry->update_virtual_url_with_url()) | 1215 if (entry->update_virtual_url_with_url()) |
| 1208 UpdateVirtualURLToURL(entry, params.url); | 1216 UpdateVirtualURLToURL(entry, params.url); |
| (...skipping 902 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2111 } | 2119 } |
| 2112 } | 2120 } |
| 2113 } | 2121 } |
| 2114 | 2122 |
| 2115 void NavigationControllerImpl::SetGetTimestampCallbackForTest( | 2123 void NavigationControllerImpl::SetGetTimestampCallbackForTest( |
| 2116 const base::Callback<base::Time()>& get_timestamp_callback) { | 2124 const base::Callback<base::Time()>& get_timestamp_callback) { |
| 2117 get_timestamp_callback_ = get_timestamp_callback; | 2125 get_timestamp_callback_ = get_timestamp_callback; |
| 2118 } | 2126 } |
| 2119 | 2127 |
| 2120 } // namespace content | 2128 } // namespace content |
| OLD | NEW |