Bug 880752 - Console.jsm stdout/err output is joined with commas and nukes newlines; r=jwalker
☠☠ backed out by 489187b2309d ☠ ☠
authorGijs Kruitbosch <gijskruitbosch@gmail.com>
Sat, 08 Jun 2013 00:23:50 +0200
changeset 153480 5bc40c94645c79c13dbd75cb1879d5205bc34868
parent 153479 eb7ff2beda9781ff485004dd031c5528e98eeac4
child 153481 489187b2309d9b8b301c89ca9c72dfb709c101a0
push id2859
push userakeybl@mozilla.com
push dateMon, 16 Sep 2013 19:14:59 +0000
treeherdermozilla-beta@87d3c51cd2bf [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjwalker
bugs880752
milestone25.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 880752 - Console.jsm stdout/err output is joined with commas and nukes newlines; r=jwalker
toolkit/devtools/Console.jsm
--- a/toolkit/devtools/Console.jsm
+++ b/toolkit/devtools/Console.jsm
@@ -106,21 +106,22 @@ function getCtorName(aObj) {
   return Object.prototype.toString.call(aObj).slice(8, -1);
 }
 
 /**
  * A single line stringification of an object designed for use by humans
  *
  * @param {any} aThing
  *        The object to be stringified
+ * @param {boolean} aAllowNewLines
  * @return {string}
  *        A single line representation of aThing, which will generally be at
  *        most 80 chars long
  */
-function stringify(aThing) {
+function stringify(aThing, aAllowNewLines) {
   if (aThing === undefined) {
     return "undefined";
   }
 
   if (aThing === null) {
     return "null";
   }
 
@@ -140,17 +141,20 @@ function stringify(aThing) {
     }
     return type + json;
   }
 
   if (typeof aThing == "function") {
     return aThing.toString().replace(/\s+/g, " ");
   }
 
-  let str = aThing.toString().replace(/\n/g, "|");
+  let str = aThing.toString();
+  if (!aAllowNewLines) {
+    str = str.replace(/\n/g, "|");
+  }
   return str;
 }
 
 /**
  * Create a simple debug representation of a given element.
  *
  * @param {nsIDOMElement} aElement
  *        The element to debug
@@ -460,19 +464,19 @@ function createDumper(aLevel) {
   return function() {
     if (!shouldLog(aLevel, this.maxLogLevel)) {
       return;
     }
     let args = Array.prototype.slice.call(arguments, 0);
     let frame = getStack(Components.stack.caller, 1)[0];
     sendConsoleAPIMessage(aLevel, frame, args);
     let data = args.map(function(arg) {
-      return stringify(arg);
+      return stringify(arg, true);
     });
-    dumpMessage(this, aLevel, data.join(", "));
+    dumpMessage(this, aLevel, data.join(" "));
   };
 }
 
 /**
  * Create a function which will output more detailed level of output when
  * used as a logging function
  *
  * @param {string} aLevel