Bug 1159830 - Autophone - webappstartup should not use console.log to output WEBAPP STARTUP COMPLETE. r=snorp, r=froydnj, a=lizzard
authorRandall Barker <rbarker@mozilla.com>
Fri, 29 May 2015 09:58:04 -0400
changeset 266235 cadc2cc10081
parent 266234 ab9bfc1f6f00
child 266236 90c96749f1a3
push id4796
push userryanvm@gmail.com
push date2015-06-11 16:30 +0000
treeherdermozilla-beta@ad1f0e1ddaf2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssnorp, froydnj, lizzard
bugs1159830
milestone39.0
Bug 1159830 - Autophone - webappstartup should not use console.log to output WEBAPP STARTUP COMPLETE. r=snorp, r=froydnj, a=lizzard
mobile/android/app/mobile.js
xpcom/base/nsConsoleService.cpp
--- a/mobile/android/app/mobile.js
+++ b/mobile/android/app/mobile.js
@@ -854,8 +854,15 @@ pref("reader.color_scheme", "auto");
 // Color scheme values available in reader mode UI.
 pref("reader.color_scheme.values", "[\"dark\",\"auto\",\"light\"]");
 
 // Whether to use a vertical or horizontal toolbar.
 pref("reader.toolbar.vertical", false);
 
 // Whether or not to display buttons related to reading list in reader view.
 pref("browser.readinglist.enabled", true);
+
+// Disable sending console to logcat on release builds.
+#ifdef RELEASE_BUILD
+pref("consoleservice.logcat", false);
+#else
+pref("consoleservice.logcat", true);
+#endif
--- a/xpcom/base/nsConsoleService.cpp
+++ b/xpcom/base/nsConsoleService.cpp
@@ -43,16 +43,20 @@ NS_IMPL_RELEASE(nsConsoleService)
 NS_IMPL_CLASSINFO(nsConsoleService, nullptr,
                   nsIClassInfo::THREADSAFE | nsIClassInfo::SINGLETON,
                   NS_CONSOLESERVICE_CID)
 NS_IMPL_QUERY_INTERFACE_CI(nsConsoleService, nsIConsoleService)
 NS_IMPL_CI_INTERFACE_GETTER(nsConsoleService, nsIConsoleService)
 
 static bool sLoggingEnabled = true;
 static bool sLoggingBuffered = true;
+#if defined(ANDROID)
+static bool sLoggingLogcat = true;
+#endif // defined(ANDROID)
+
 
 nsConsoleService::nsConsoleService()
   : mMessages(nullptr)
   , mCurrent(0)
   , mFull(false)
   , mDeliveringMessage(false)
   , mLock("nsConsoleService.mLock")
 {
@@ -81,16 +85,19 @@ public:
   explicit AddConsolePrefWatchers(nsConsoleService* aConsole) : mConsole(aConsole)
   {
   }
 
   NS_IMETHOD Run()
   {
     Preferences::AddBoolVarCache(&sLoggingEnabled, "consoleservice.enabled", true);
     Preferences::AddBoolVarCache(&sLoggingBuffered, "consoleservice.buffered", true);
+#if defined(ANDROID)
+    Preferences::AddBoolVarCache(&sLoggingLogcat, "consoleservice.logcat", true);
+#endif // defined(ANDROID)
     if (!sLoggingBuffered) {
       mConsole->Reset();
     }
     return NS_OK;
   }
 
 private:
   nsRefPtr<nsConsoleService> mConsole;
@@ -201,18 +208,18 @@ nsConsoleService::LogMessageWithMode(nsI
 
   /*
    * Lock while updating buffer, and while taking snapshot of
    * listeners array.
    */
   {
     MutexAutoLock lock(mLock);
 
-#if defined(ANDROID) && !defined(RELEASE_BUILD)
-    if (aOutputMode == OutputToLog) {
+#if defined(ANDROID)
+    if (sLoggingLogcat && aOutputMode == OutputToLog) {
       nsCString msg;
       aMessage->ToString(msg);
 
       /** Attempt to use the process name as the log tag. */
       mozilla::dom::ContentChild* child =
           mozilla::dom::ContentChild::GetSingleton();
       nsCString appName;
       if (child) {