Bug 972038 - Replace calls to GetMessageMoz with ToString to save callers from having to convert to UTF-8. r=jimm
authorJustin Shrake <justinshrake@gmail.com>
Tue, 18 Feb 2014 09:47:54 -0500
changeset 169361 ecd5c56ed519c8698bf83de67a3cdadf0e7cb25c
parent 169360 7173c66302c343a51d333b97cb1fc3a59004fba7
child 169362 9db0ee6f95e19c773e3eabad288bbb6e9efc9260
push id26245
push userryanvm@gmail.com
push dateTue, 18 Feb 2014 20:18:17 +0000
treeherdermozilla-central@9019cc90719c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjimm
bugs972038
milestone30.0a1
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
Bug 972038 - Replace calls to GetMessageMoz with ToString to save callers from having to convert to UTF-8. r=jimm
xpcom/base/nsConsoleService.cpp
--- a/xpcom/base/nsConsoleService.cpp
+++ b/xpcom/base/nsConsoleService.cpp
@@ -163,22 +163,21 @@ nsConsoleService::LogMessageWithMode(nsI
     if (message == nullptr)
         return NS_ERROR_INVALID_ARG;
 
     if (!sLoggingEnabled) {
         return NS_OK;
     }
 
     if (NS_IsMainThread() && mDeliveringMessage) {
-        nsString msg;
-        message->GetMessageMoz(getter_Copies(msg));
+        nsCString msg;
+        message->ToString(msg);
         NS_WARNING(nsPrintfCString("Reentrancy error: some client attempted "
             "to display a message to the console while in a console listener. "
-            "The following message was discarded: \"%s\"",
-            NS_ConvertUTF16toUTF8(msg).get()).get());
+            "The following message was discarded: \"%s\"", msg.get()).get());
         return NS_ERROR_FAILURE;
     }
 
     nsRefPtr<LogMessageRunnable> r;
     nsIConsoleMessage *retiredMessage;
 
     if (sLoggingBuffered) {
         NS_ADDREF(message); // early, in case it's same as replaced below.
@@ -189,21 +188,20 @@ nsConsoleService::LogMessageWithMode(nsI
      * listeners array.
      */
     {
         MutexAutoLock lock(mLock);
 
 #if defined(ANDROID)
         if (outputMode == OutputToLog)
         {
-            nsXPIDLString msg;
-            message->GetMessageMoz(getter_Copies(msg));
+            nsCString msg;
+            message->ToString(msg);
             __android_log_print(ANDROID_LOG_ERROR, "GeckoConsole",
-                        "%s",
-                        NS_LossyConvertUTF16toASCII(msg).get());
+                        "%s", msg.get());
         }
 #endif
 #ifdef XP_WIN
         if (IsDebuggerPresent()) {
             nsString msg;
             message->GetMessageMoz(getter_Copies(msg));
             msg.AppendLiteral("\n");
             OutputDebugStringW(msg.get());