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 #include "content/browser/frame_host/navigation_controller_impl.h" | 5 #include "content/browser/frame_host/navigation_controller_impl.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
(...skipping 1290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1301 rfh->GetSiteInstance(), | 1301 rfh->GetSiteInstance(), |
1302 params.page_id); | 1302 params.page_id); |
1303 if (entry_index < 0 || | 1303 if (entry_index < 0 || |
1304 entry_index >= static_cast<int>(entries_.size())) { | 1304 entry_index >= static_cast<int>(entries_.size())) { |
1305 NOTREACHED(); | 1305 NOTREACHED(); |
1306 return false; | 1306 return false; |
1307 } | 1307 } |
1308 | 1308 |
1309 // Update the current navigation entry in case we're going back/forward. | 1309 // Update the current navigation entry in case we're going back/forward. |
1310 if (entry_index != last_committed_entry_index_) { | 1310 if (entry_index != last_committed_entry_index_) { |
1311 // Make sure that a subframe commit isn't changing the main frame URL. | |
Avi (use Gerrit)
2015/04/30 15:25:28
Wouldn't this check also apply for DidNavManualSub
Charlie Reis
2015/04/30 16:28:28
I like that idea, but it doesn't look like there's
| |
1312 // Otherwise the renderer process may be confused, leading to a URL spoof. | |
1313 if (GetLastCommittedEntry()->GetURL() != | |
1314 GetEntryAtIndex(entry_index)->GetURL()) { | |
1315 bad_message::ReceivedBadMessage(rfh->GetProcess(), | |
1316 bad_message::NC_AUTO_SUBFRAME); | |
1317 } | |
1311 last_committed_entry_index_ = entry_index; | 1318 last_committed_entry_index_ = entry_index; |
1312 DiscardNonCommittedEntriesInternal(); | 1319 DiscardNonCommittedEntriesInternal(); |
1313 return true; | 1320 return true; |
1314 } | 1321 } |
1315 | 1322 |
1316 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | 1323 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
1317 switches::kSitePerProcess)) { | 1324 switches::kSitePerProcess)) { |
1318 // This may be a "new auto" case where we add a new FrameNavigationEntry, or | 1325 // This may be a "new auto" case where we add a new FrameNavigationEntry, or |
1319 // it may be a "history auto" case where we update an existing one. | 1326 // it may be a "history auto" case where we update an existing one. |
1320 int64 frame_tree_node_id = rfh->frame_tree_node()->frame_tree_node_id(); | 1327 int64 frame_tree_node_id = rfh->frame_tree_node()->frame_tree_node_id(); |
(...skipping 533 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1854 } | 1861 } |
1855 } | 1862 } |
1856 } | 1863 } |
1857 | 1864 |
1858 void NavigationControllerImpl::SetGetTimestampCallbackForTest( | 1865 void NavigationControllerImpl::SetGetTimestampCallbackForTest( |
1859 const base::Callback<base::Time()>& get_timestamp_callback) { | 1866 const base::Callback<base::Time()>& get_timestamp_callback) { |
1860 get_timestamp_callback_ = get_timestamp_callback; | 1867 get_timestamp_callback_ = get_timestamp_callback; |
1861 } | 1868 } |
1862 | 1869 |
1863 } // namespace content | 1870 } // namespace content |
OLD | NEW |