Backed out changeset fb76e4e1d9e0 (bug 1563996) for crashes on consoleservice.logcat. CLOSED TREE
authorCsoregi Natalia <ncsoregi@mozilla.com>
Tue, 09 Jul 2019 13:26:14 +0300
changeset 481885 05e65f3f2ab4b98de1cbee6365033c9f36d85bdb
parent 481884 a817e3f2e0c9c0c5e7ee6cbcf161471a1bd25cc2
child 481886 2a3cb9e2b22ceff1bef713460294d4e3987a0e26
push id89448
push userncsoregi@mozilla.com
push dateTue, 09 Jul 2019 10:27:23 +0000
treeherderautoland@05e65f3f2ab4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1563996
milestone70.0a1
backs outfb76e4e1d9e0700d996dcc39c206310a68a11907
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Backed out changeset fb76e4e1d9e0 (bug 1563996) for crashes on consoleservice.logcat. CLOSED TREE
mobile/android/app/mobile.js
modules/libpref/init/StaticPrefList.h
xpcom/base/nsConsoleService.cpp
--- a/mobile/android/app/mobile.js
+++ b/mobile/android/app/mobile.js
@@ -776,16 +776,23 @@ pref("layout.accessiblecaret.script_chan
 
 // Optionally provide haptic feedback on longPress selection events.
 pref("layout.accessiblecaret.hapticfeedback", true);
 
 // Initial text selection on long-press is enhanced to provide
 // a smarter phone-number selection for direct-dial ActionBar action.
 pref("layout.accessiblecaret.extend_selection_for_phone_number", true);
 
+// Disable sending console to logcat on release builds.
+#ifdef RELEASE_OR_BETA
+pref("consoleservice.logcat", false);
+#else
+pref("consoleservice.logcat", true);
+#endif
+
 pref("browser.tabs.showAudioPlayingIcon", true);
 
 pref("dom.serviceWorkers.enabled", true);
 
 // Allow service workers to open windows for a longer period after a notification
 // click on mobile.  This is to account for some devices being quite slow.
 pref("dom.serviceWorkers.disable_open_click_delay", 5000);
 
--- a/modules/libpref/init/StaticPrefList.h
+++ b/modules/libpref/init/StaticPrefList.h
@@ -1050,30 +1050,16 @@ VARCACHE_PREF(
   Live,
   "clipboard.autocopy",
   clipboard_autocopy,
   bool, PREF_VALUE
 )
 #undef PREF_VALUE
 
 //---------------------------------------------------------------------------
-// Prefs starting with "consoleservice."
-//---------------------------------------------------------------------------
-
-#if defined(ANDROID)
-// Disable sending console to logcat on release builds.
-VARCACHE_PREF(
-  Live,
-  "consoleservice.logcat",
-   consoleservice_logcat,
-  bool, NOT_IN_RELEASE_OR_BETA_VALUE
-)
-#endif
-
-//---------------------------------------------------------------------------
 // Prefs starting with "device."
 //---------------------------------------------------------------------------
 
 // Is support for the device sensors API enabled?
 VARCACHE_PREF(
   Live,
   "device.sensors.enabled",
   device_sensors_enabled,
--- a/xpcom/base/nsConsoleService.cpp
+++ b/xpcom/base/nsConsoleService.cpp
@@ -22,17 +22,16 @@
 #include "nsIObserverService.h"
 #include "nsPrintfCString.h"
 #include "nsProxyRelease.h"
 #include "nsIScriptError.h"
 #include "nsISupportsPrimitives.h"
 
 #include "mozilla/Preferences.h"
 #include "mozilla/Services.h"
-#include "mozilla/StaticPrefs.h"
 #include "mozilla/SystemGroup.h"
 
 #if defined(ANDROID)
 #  include <android/log.h>
 #  include "mozilla/dom/ContentChild.h"
 #endif
 #ifdef XP_WIN
 #  include <windows.h>
@@ -53,16 +52,19 @@ NS_IMPL_CLASSINFO(nsConsoleService, null
 NS_IMPL_QUERY_INTERFACE_CI(nsConsoleService, nsIConsoleService, nsIObserver)
 NS_IMPL_CI_INTERFACE_GETTER(nsConsoleService, nsIConsoleService, nsIObserver)
 
 static const bool gLoggingEnabled = true;
 static const bool gLoggingBuffered = true;
 #ifdef XP_WIN
 static bool gLoggingToDebugger = true;
 #endif  // XP_WIN
+#if defined(ANDROID)
+static bool gLoggingLogcat = false;
+#endif  // defined(ANDROID)
 
 nsConsoleService::MessageElement::~MessageElement() {}
 
 nsConsoleService::nsConsoleService()
     : mCurrentSize(0),
       mDeliveringMessage(false),
       mLock("nsConsoleService.mLock") {
   // XXX grab this from a pref!
@@ -131,16 +133,26 @@ nsConsoleService::~nsConsoleService() {
 }
 
 class AddConsolePrefWatchers : public Runnable {
  public:
   explicit AddConsolePrefWatchers(nsConsoleService* aConsole)
       : mozilla::Runnable("AddConsolePrefWatchers"), mConsole(aConsole) {}
 
   NS_IMETHOD Run() override {
+#if defined(ANDROID)
+    Preferences::AddBoolVarCache(&gLoggingLogcat, "consoleservice.logcat",
+#  ifdef RELEASE_OR_BETA
+                                 false
+#  else
+                                 true
+#  endif
+    );
+#endif  // defined(ANDROID)
+
     nsCOMPtr<nsIObserverService> obs = mozilla::services::GetObserverService();
     MOZ_ASSERT(obs);
     obs->AddObserver(mConsole, NS_XPCOM_SHUTDOWN_OBSERVER_ID, false);
     obs->AddObserver(mConsole, "inner-window-destroyed", false);
 
     if (!gLoggingBuffered) {
       mConsole->Reset();
     }
@@ -231,17 +243,17 @@ nsresult nsConsoleService::LogMessageWit
   /*
    * Lock while updating buffer, and while taking snapshot of
    * listeners array.
    */
   {
     MutexAutoLock lock(mLock);
 
 #if defined(ANDROID)
-    if (StaticPrefs::consoleservice_logcat() && aOutputMode == OutputToLog) {
+    if (gLoggingLogcat && 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) {