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