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/render_frame_host_impl.h" | 5 #include "content/browser/frame_host/render_frame_host_impl.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 963 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
974 const base::string16& source_id) { | 974 const base::string16& source_id) { |
975 if (level < logging::LOG_VERBOSE || level > logging::LOG_FATAL) { | 975 if (level < logging::LOG_VERBOSE || level > logging::LOG_FATAL) { |
976 bad_message::ReceivedBadMessage( | 976 bad_message::ReceivedBadMessage( |
977 GetProcess(), bad_message::RFH_DID_ADD_CONSOLE_MESSAGE_BAD_SEVERITY); | 977 GetProcess(), bad_message::RFH_DID_ADD_CONSOLE_MESSAGE_BAD_SEVERITY); |
978 return; | 978 return; |
979 } | 979 } |
980 | 980 |
981 if (delegate_->DidAddMessageToConsole(level, message, line_no, source_id)) | 981 if (delegate_->DidAddMessageToConsole(level, message, line_no, source_id)) |
982 return; | 982 return; |
983 | 983 |
| 984 // In order for CSP violation detections in the tests to work, console |
| 985 // messages must be forwarded to logging::LogMessage(). |
| 986 // Ref: https://crbug.com/638050 |
| 987 |
984 // Pass through log level only on WebUI pages to limit console spew. | 988 // Pass through log level only on WebUI pages to limit console spew. |
985 const bool is_web_ui = | 989 const bool is_web_ui = |
986 HasWebUIScheme(delegate_->GetMainFrameLastCommittedURL()); | 990 HasWebUIScheme(delegate_->GetMainFrameLastCommittedURL()); |
987 const int32_t resolved_level = is_web_ui ? level : ::logging::LOG_INFO; | 991 const int32_t resolved_level = is_web_ui ? level : ::logging::LOG_INFO; |
988 | 992 |
989 // LogMessages can be persisted so this shouldn't be logged in incognito mode. | 993 // LogMessages can be persisted so this shouldn't be logged in incognito mode. |
990 // This rule is not applied to WebUI pages, because source code of WebUI is a | 994 // This rule is not applied to WebUI pages, because source code of WebUI is a |
991 // part of Chrome source code, and we want to treat messages from WebUI the | 995 // part of Chrome source code, and we want to treat messages from WebUI the |
992 // same way as we treat log messages from native code. | 996 // same way as we treat log messages from native code. |
993 if (::logging::GetMinLogLevel() <= resolved_level && | 997 if (::logging::GetMinLogLevel() <= resolved_level && |
(...skipping 2353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3347 // There is no pending NavigationEntry in these cases, so pass 0 as the | 3351 // There is no pending NavigationEntry in these cases, so pass 0 as the |
3348 // pending_nav_entry_id. If the previous handle was a prematurely aborted | 3352 // pending_nav_entry_id. If the previous handle was a prematurely aborted |
3349 // navigation loaded via LoadDataWithBaseURL, propagate the entry id. | 3353 // navigation loaded via LoadDataWithBaseURL, propagate the entry id. |
3350 return NavigationHandleImpl::Create( | 3354 return NavigationHandleImpl::Create( |
3351 params.url, frame_tree_node_, is_renderer_initiated, | 3355 params.url, frame_tree_node_, is_renderer_initiated, |
3352 params.was_within_same_page, base::TimeTicks::Now(), | 3356 params.was_within_same_page, base::TimeTicks::Now(), |
3353 entry_id_for_data_nav, false); // started_from_context_menu | 3357 entry_id_for_data_nav, false); // started_from_context_menu |
3354 } | 3358 } |
3355 | 3359 |
3356 } // namespace content | 3360 } // namespace content |
OLD | NEW |