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 #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/debug/trace_event.h" | 9 #include "base/debug/trace_event.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 116 // The one thing we do know is that cross-origin navigations will *never* be | 116 // The one thing we do know is that cross-origin navigations will *never* be |
| 117 // in-page. Therefore, trust the renderer if the URLs are on the same origin, | 117 // in-page. Therefore, trust the renderer if the URLs are on the same origin, |
| 118 // and assume the renderer is malicious if a cross-origin navigation claims to | 118 // and assume the renderer is malicious if a cross-origin navigation claims to |
| 119 // be in-page. | 119 // be in-page. |
| 120 bool AreURLsInPageNavigation(const GURL& existing_url, | 120 bool AreURLsInPageNavigation(const GURL& existing_url, |
| 121 const GURL& new_url, | 121 const GURL& new_url, |
| 122 bool renderer_says_in_page, | 122 bool renderer_says_in_page, |
| 123 RenderFrameHost* rfh) { | 123 RenderFrameHost* rfh) { |
| 124 WebPreferences prefs = rfh->GetRenderViewHost()->GetWebkitPreferences(); | 124 WebPreferences prefs = rfh->GetRenderViewHost()->GetWebkitPreferences(); |
| 125 bool is_same_origin = existing_url.is_empty() || | 125 bool is_same_origin = existing_url.is_empty() || |
| 126 existing_url == GURL(url::kAboutBlankURL) || | |
|
nasko
2014/07/09 07:11:17
Shouldn't this only apply if there is no session h
| |
| 126 existing_url.GetOrigin() == new_url.GetOrigin() || | 127 existing_url.GetOrigin() == new_url.GetOrigin() || |
| 127 !prefs.web_security_enabled; | 128 !prefs.web_security_enabled; |
| 128 if (!is_same_origin && renderer_says_in_page) | 129 if (!is_same_origin && renderer_says_in_page) |
| 129 rfh->GetProcess()->ReceivedBadMessage(); | 130 rfh->GetProcess()->ReceivedBadMessage(); |
| 130 return is_same_origin && renderer_says_in_page; | 131 return is_same_origin && renderer_says_in_page; |
| 131 } | 132 } |
| 132 | 133 |
| 133 // Determines whether or not we should be carrying over a user agent override | 134 // Determines whether or not we should be carrying over a user agent override |
| 134 // between two NavigationEntries. | 135 // between two NavigationEntries. |
| 135 bool ShouldKeepOverride(const NavigationEntry* last_entry) { | 136 bool ShouldKeepOverride(const NavigationEntry* last_entry) { |
| (...skipping 1639 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1775 } | 1776 } |
| 1776 } | 1777 } |
| 1777 } | 1778 } |
| 1778 | 1779 |
| 1779 void NavigationControllerImpl::SetGetTimestampCallbackForTest( | 1780 void NavigationControllerImpl::SetGetTimestampCallbackForTest( |
| 1780 const base::Callback<base::Time()>& get_timestamp_callback) { | 1781 const base::Callback<base::Time()>& get_timestamp_callback) { |
| 1781 get_timestamp_callback_ = get_timestamp_callback; | 1782 get_timestamp_callback_ = get_timestamp_callback; |
| 1782 } | 1783 } |
| 1783 | 1784 |
| 1784 } // namespace content | 1785 } // namespace content |
| OLD | NEW |