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 21 matching lines...) Expand all Loading... | |
| 32 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | 32 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
| 33 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 33 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 34 */ | 34 */ |
| 35 | 35 |
| 36 #include "content/browser/frame_host/navigation_controller_impl.h" | 36 #include "content/browser/frame_host/navigation_controller_impl.h" |
| 37 | 37 |
| 38 #include <utility> | 38 #include <utility> |
| 39 | 39 |
| 40 #include "base/bind.h" | 40 #include "base/bind.h" |
| 41 #include "base/command_line.h" | 41 #include "base/command_line.h" |
| 42 #include "base/debug/alias.h" | |
| 42 #include "base/debug/dump_without_crashing.h" | 43 #include "base/debug/dump_without_crashing.h" |
| 43 #include "base/logging.h" | 44 #include "base/logging.h" |
| 44 #include "base/memory/ptr_util.h" | 45 #include "base/memory/ptr_util.h" |
| 45 #include "base/metrics/histogram_macros.h" | 46 #include "base/metrics/histogram_macros.h" |
| 46 #include "base/strings/string_number_conversions.h" // Temporary | 47 #include "base/strings/string_number_conversions.h" // Temporary |
| 47 #include "base/strings/string_util.h" | 48 #include "base/strings/string_util.h" |
| 48 #include "base/strings/utf_string_conversions.h" | 49 #include "base/strings/utf_string_conversions.h" |
| 49 #include "base/time/time.h" | 50 #include "base/time/time.h" |
| 50 #include "base/trace_event/trace_event.h" | 51 #include "base/trace_event/trace_event.h" |
| 51 #include "build/build_config.h" | 52 #include "build/build_config.h" |
| (...skipping 1037 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1089 bool update_virtual_url = false; | 1090 bool update_virtual_url = false; |
| 1090 | 1091 |
| 1091 // First check if this is an in-page navigation. If so, clone the current | 1092 // First check if this is an in-page navigation. If so, clone the current |
| 1092 // entry instead of looking at the pending entry, because the pending entry | 1093 // entry instead of looking at the pending entry, because the pending entry |
| 1093 // does not have any subframe history items. | 1094 // does not have any subframe history items. |
| 1094 if (is_in_page && GetLastCommittedEntry()) { | 1095 if (is_in_page && GetLastCommittedEntry()) { |
| 1095 FrameNavigationEntry* frame_entry = new FrameNavigationEntry( | 1096 FrameNavigationEntry* frame_entry = new FrameNavigationEntry( |
| 1096 params.frame_unique_name, params.item_sequence_number, | 1097 params.frame_unique_name, params.item_sequence_number, |
| 1097 params.document_sequence_number, rfh->GetSiteInstance(), nullptr, | 1098 params.document_sequence_number, rfh->GetSiteInstance(), nullptr, |
| 1098 params.url, params.referrer, params.method, params.post_id); | 1099 params.url, params.referrer, params.method, params.post_id); |
| 1099 new_entry = GetLastCommittedEntry()->CloneAndReplace( | 1100 new_entry = GetLastCommittedEntry()->CloneAndReplace( |
|
jam
2017/02/16 04:34:37
also maybe here as well?
estark
2017/02/16 06:28:09
Done.
| |
| 1100 frame_entry, true, rfh->frame_tree_node(), | 1101 frame_entry, true, rfh->frame_tree_node(), |
| 1101 delegate_->GetFrameTree()->root()); | 1102 delegate_->GetFrameTree()->root()); |
| 1102 | 1103 |
| 1103 // We expect |frame_entry| to be owned by |new_entry|. This should never | 1104 // We expect |frame_entry| to be owned by |new_entry|. This should never |
| 1104 // fail, because it's the main frame. | 1105 // fail, because it's the main frame. |
| 1105 CHECK(frame_entry->HasOneRef()); | 1106 CHECK(frame_entry->HasOneRef()); |
| 1106 | 1107 |
| 1107 update_virtual_url = new_entry->update_virtual_url_with_url(); | 1108 update_virtual_url = new_entry->update_virtual_url_with_url(); |
| 1108 } | 1109 } |
| 1109 | 1110 |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1202 | 1203 |
| 1203 // TODO(creis): Classify location.replace as NEW_PAGE instead of EXISTING_PAGE | 1204 // TODO(creis): Classify location.replace as NEW_PAGE instead of EXISTING_PAGE |
| 1204 // in https://crbug.com/596707. | 1205 // in https://crbug.com/596707. |
| 1205 | 1206 |
| 1206 NavigationEntryImpl* entry; | 1207 NavigationEntryImpl* entry; |
| 1207 if (params.intended_as_new_entry) { | 1208 if (params.intended_as_new_entry) { |
| 1208 // This was intended as a new entry but the pending entry was lost in the | 1209 // This was intended as a new entry but the pending entry was lost in the |
| 1209 // meanwhile and no new page was created. We are stuck at the last committed | 1210 // meanwhile and no new page was created. We are stuck at the last committed |
| 1210 // entry. | 1211 // entry. |
| 1211 entry = GetLastCommittedEntry(); | 1212 entry = GetLastCommittedEntry(); |
| 1213 // TODO(estark): remove this DumpWithoutCrashing after investigating | |
| 1214 // https://crbug.com/688425. | |
| 1215 if (entry && | |
| 1216 !url::Origin(entry->GetURL()) | |
| 1217 .IsSameOriginWith(url::Origin(params.url))) { | |
| 1218 std::string debug_info = | |
| 1219 std::string(is_in_page ? "Is in page, " : "Is not in page, ") + | |
| 1220 std::string(params.nav_entry_id ? "has nav entry id, " | |
| 1221 : "does not have nav entry id, ") + | |
| 1222 std::string(params.did_create_new_entry | |
| 1223 ? "did create new entry, " | |
| 1224 : "did not create new entry, ") + | |
| 1225 std::string(params.should_replace_current_entry | |
| 1226 ? "should replace current entry " | |
| 1227 : "should not replace current entry"); | |
| 1228 char debug_buf[200]; | |
| 1229 base::strlcpy(debug_buf, debug_info.c_str(), arraysize(debug_buf)); | |
| 1230 base::debug::Alias(&debug_buf); | |
| 1231 base::debug::DumpWithoutCrashing(); | |
| 1232 } | |
| 1212 } else if (params.nav_entry_id) { | 1233 } else if (params.nav_entry_id) { |
| 1213 // This is a browser-initiated navigation (back/forward/reload). | 1234 // This is a browser-initiated navigation (back/forward/reload). |
| 1214 entry = GetEntryWithUniqueID(params.nav_entry_id); | 1235 entry = GetEntryWithUniqueID(params.nav_entry_id); |
| 1215 | 1236 |
| 1216 // Needed for the restore case, where the serialized NavigationEntry doesn't | 1237 // Needed for the restore case, where the serialized NavigationEntry doesn't |
| 1217 // have the SSL state. Note that for in-page navigation, there's no | 1238 // have the SSL state. Note that for in-page navigation, there's no |
| 1218 // SSLStatus in the NavigationHandle so don't overwrite the existing entry's | 1239 // SSLStatus in the NavigationHandle so don't overwrite the existing entry's |
| 1219 // SSLStatus. | 1240 // SSLStatus. |
| 1220 if (!is_in_page) | 1241 if (!is_in_page) |
| 1221 entry->GetSSL() = handle->ssl_status(); | 1242 entry->GetSSL() = handle->ssl_status(); |
| (...skipping 912 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2134 } | 2155 } |
| 2135 } | 2156 } |
| 2136 } | 2157 } |
| 2137 | 2158 |
| 2138 void NavigationControllerImpl::SetGetTimestampCallbackForTest( | 2159 void NavigationControllerImpl::SetGetTimestampCallbackForTest( |
| 2139 const base::Callback<base::Time()>& get_timestamp_callback) { | 2160 const base::Callback<base::Time()>& get_timestamp_callback) { |
| 2140 get_timestamp_callback_ = get_timestamp_callback; | 2161 get_timestamp_callback_ = get_timestamp_callback; |
| 2141 } | 2162 } |
| 2142 | 2163 |
| 2143 } // namespace content | 2164 } // namespace content |
| OLD | NEW |