Enabled logging for WebUIs working in off-the-record context.
BUG=453779
TEST=manually
Review URL: https://codereview.chromium.org/893573002
Cr-Commit-Position: refs/heads/master@{#315806}
(cherry picked from commit 6b3e53c4f03afc8f999c17aaa139523c098a4775)
Review URL: https://codereview.chromium.org/925933002
Cr-Commit-Position: refs/branch-heads/2272@{#288}
Cr-Branched-From: 827a380cfdb31aa54c8d56e63ce2c3fd8c3ba4d4-refs/heads/master@{#310958}
diff --git a/content/browser/frame_host/render_frame_host_impl.cc b/content/browser/frame_host/render_frame_host_impl.cc
index 00fed25..3edcf7c 100644
--- a/content/browser/frame_host/render_frame_host_impl.cc
+++ b/content/browser/frame_host/render_frame_host_impl.cc
@@ -551,14 +551,20 @@
return;
// Pass through log level only on WebUI pages to limit console spew.
- int32 resolved_level =
- HasWebUIScheme(delegate_->GetMainFrameLastCommittedURL()) ? level : 0;
+ const bool is_web_ui =
+ HasWebUIScheme(delegate_->GetMainFrameLastCommittedURL());
+ const int32 resolved_level = is_web_ui ? level : ::logging::LOG_INFO;
// LogMessages can be persisted so this shouldn't be logged in incognito mode.
- if (resolved_level >= ::logging::GetMinLogLevel()
- && !GetSiteInstance()->GetBrowserContext()->IsOffTheRecord()) {
- logging::LogMessage("CONSOLE", line_no, resolved_level).stream() << "\"" <<
- message << "\", source: " << source_id << " (" << line_no << ")";
+ // This rule is not applied to WebUI pages, because source code of WebUI is a
+ // part of Chrome source code, and we want to treat messages from WebUI the
+ // same way as we treat log messages from native code.
+ if (::logging::GetMinLogLevel() <= resolved_level &&
+ (is_web_ui ||
+ !GetSiteInstance()->GetBrowserContext()->IsOffTheRecord())) {
+ logging::LogMessage("CONSOLE", line_no, resolved_level).stream()
+ << "\"" << message << "\", source: " << source_id << " (" << line_no
+ << ")";
}
}