mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-22 17:55:50 +00:00
Bug 880752 - Console.jsm stdout/err output is joined with commas and nukes newlines; r=jwalker
This commit is contained in:
parent
e7201e1a33
commit
cc70e4aa11
@ -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";
|
||||
}
|
||||
@ -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;
|
||||
}
|
||||
|
||||
@ -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(" "));
|
||||
};
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user