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 1443 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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's origin. | 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 // We can't check the path since that may change (https://crbug.com/373041). | 1461 // We can't check the path since that may change (https://crbug.com/373041). |
1462 if (GetLastCommittedEntry()->GetURL().GetOrigin() != | 1462 if (GetLastCommittedEntry()->GetURL().GetOrigin() != |
1463 GetEntryAtIndex(entry_index)->GetURL().GetOrigin()) { | 1463 GetEntryAtIndex(entry_index)->GetURL().GetOrigin()) { |
1464 bad_message::ReceivedBadMessage(rfh->GetProcess(), | 1464 // TODO(creis): This is unexpectedly being encountered in practice. If |
1465 bad_message::NC_AUTO_SUBFRAME); | 1465 // you encounter this in practice, please post details to |
| 1466 // https://crbug.com/486916. Once that's resolved, we'll change this to |
| 1467 // kill the renderer process with bad_message::NC_AUTO_SUBFRAME. |
| 1468 NOTREACHED() << "Unexpected main frame origin change on AUTO_SUBFRAME."; |
1466 } | 1469 } |
1467 last_committed_entry_index_ = entry_index; | 1470 last_committed_entry_index_ = entry_index; |
1468 DiscardNonCommittedEntriesInternal(); | 1471 DiscardNonCommittedEntriesInternal(); |
1469 return true; | 1472 return true; |
1470 } | 1473 } |
1471 | 1474 |
1472 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | 1475 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
1473 switches::kSitePerProcess)) { | 1476 switches::kSitePerProcess)) { |
1474 // This may be a "new auto" case where we add a new FrameNavigationEntry, or | 1477 // This may be a "new auto" case where we add a new FrameNavigationEntry, or |
1475 // it may be a "history auto" case where we update an existing one. | 1478 // it may be a "history auto" case where we update an existing one. |
(...skipping 541 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2017 } | 2020 } |
2018 } | 2021 } |
2019 } | 2022 } |
2020 | 2023 |
2021 void NavigationControllerImpl::SetGetTimestampCallbackForTest( | 2024 void NavigationControllerImpl::SetGetTimestampCallbackForTest( |
2022 const base::Callback<base::Time()>& get_timestamp_callback) { | 2025 const base::Callback<base::Time()>& get_timestamp_callback) { |
2023 get_timestamp_callback_ = get_timestamp_callback; | 2026 get_timestamp_callback_ = get_timestamp_callback; |
2024 } | 2027 } |
2025 | 2028 |
2026 } // namespace content | 2029 } // namespace content |
OLD | NEW |