| 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 1438 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1449 rfh->GetSiteInstance(), | 1449 rfh->GetSiteInstance(), |
| 1450 params.page_id); | 1450 params.page_id); |
| 1451 if (entry_index < 0 || | 1451 if (entry_index < 0 || |
| 1452 entry_index >= static_cast<int>(entries_.size())) { | 1452 entry_index >= static_cast<int>(entries_.size())) { |
| 1453 NOTREACHED(); | 1453 NOTREACHED(); |
| 1454 return false; | 1454 return false; |
| 1455 } | 1455 } |
| 1456 | 1456 |
| 1457 // Update the current navigation entry in case we're going back/forward. | 1457 // Update the current navigation entry in case we're going back/forward. |
| 1458 if (entry_index != last_committed_entry_index_) { | 1458 if (entry_index != last_committed_entry_index_) { |
| 1459 // Make sure that a subframe commit isn't changing the main frame URL. | 1459 // Make sure that a subframe commit isn't changing the main frame's origin. |
| 1460 // Otherwise the renderer process may be confused, leading to a URL spoof. | 1460 // Otherwise the renderer process may be confused, leading to a URL spoof. |
| 1461 if (GetLastCommittedEntry()->GetURL() != | 1461 // We can't check the path since that may change (https://crbug.com/373041). |
| 1462 GetEntryAtIndex(entry_index)->GetURL()) { | 1462 if (GetLastCommittedEntry()->GetURL().GetOrigin() != |
| 1463 GetEntryAtIndex(entry_index)->GetURL().GetOrigin()) { |
| 1463 bad_message::ReceivedBadMessage(rfh->GetProcess(), | 1464 bad_message::ReceivedBadMessage(rfh->GetProcess(), |
| 1464 bad_message::NC_AUTO_SUBFRAME); | 1465 bad_message::NC_AUTO_SUBFRAME); |
| 1465 } | 1466 } |
| 1466 last_committed_entry_index_ = entry_index; | 1467 last_committed_entry_index_ = entry_index; |
| 1467 DiscardNonCommittedEntriesInternal(); | 1468 DiscardNonCommittedEntriesInternal(); |
| 1468 return true; | 1469 return true; |
| 1469 } | 1470 } |
| 1470 | 1471 |
| 1471 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | 1472 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 1472 switches::kSitePerProcess)) { | 1473 switches::kSitePerProcess)) { |
| (...skipping 545 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2018 } | 2019 } |
| 2019 } | 2020 } |
| 2020 } | 2021 } |
| 2021 | 2022 |
| 2022 void NavigationControllerImpl::SetGetTimestampCallbackForTest( | 2023 void NavigationControllerImpl::SetGetTimestampCallbackForTest( |
| 2023 const base::Callback<base::Time()>& get_timestamp_callback) { | 2024 const base::Callback<base::Time()>& get_timestamp_callback) { |
| 2024 get_timestamp_callback_ = get_timestamp_callback; | 2025 get_timestamp_callback_ = get_timestamp_callback; |
| 2025 } | 2026 } |
| 2026 | 2027 |
| 2027 } // namespace content | 2028 } // namespace content |
| OLD | NEW |