Skip to content

Commit

Permalink
Bug 880752 - Console.jsm stdout/err output is joined with commas and…
Browse files Browse the repository at this point in the history
… nukes newlines; r=jwalker
  • Loading branch information
gijsk committed Jun 7, 2013
1 parent e7201e1 commit cc70e4a
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions toolkit/devtools/Console.jsm
Original file line number Diff line number Diff line change
Expand Up @@ -111,11 +111,12 @@ function getCtorName(aObj) {
*
* @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";
}
Expand Down Expand Up @@ -145,7 +146,10 @@ function stringify(aThing) {
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;
}

Expand Down Expand Up @@ -465,9 +469,9 @@ function createDumper(aLevel) {
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(" "));
};
}

Expand Down

0 comments on commit cc70e4a

Please sign in to comment.