mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 867208 - Console.jsm is truncating messages. r=jwalker
This commit is contained in:
parent
1f388e88f5
commit
6d670aaa3f
@ -44,7 +44,8 @@ let gTimerRegistry = new Map();
|
||||
* @param {object} aOptions (optional)
|
||||
* An object allowing format customization. The only customization
|
||||
* allowed currently is 'truncate' which can take the value "start" to
|
||||
* truncate strings from the start as opposed to the end.
|
||||
* truncate strings from the start as opposed to the end or "center" to
|
||||
* truncate strings in the center
|
||||
* @return {string}
|
||||
* The original string formatted to fit the specified lengths
|
||||
*/
|
||||
@ -59,6 +60,12 @@ function fmt(aStr, aMaxLen, aMinLen, aOptions) {
|
||||
if (aOptions && aOptions.truncate == "start") {
|
||||
return "_" + aStr.substring(aStr.length - aMaxLen + 1);
|
||||
}
|
||||
else if (aOptions && aOptions.truncate == "center") {
|
||||
let start = aStr.substring(0, (aMaxLen / 2));
|
||||
|
||||
let end = aStr.substring((aStr.length - (aMaxLen / 2)) + 1);
|
||||
return start + "_" + end;
|
||||
}
|
||||
else {
|
||||
return aStr.substring(0, aMaxLen - 1) + "_";
|
||||
}
|
||||
@ -125,15 +132,15 @@ function stringify(aThing) {
|
||||
// Can't use a real ellipsis here, because cmd.exe isn't unicode-enabled
|
||||
json = "{" + Object.keys(aThing).join(":..,") + ":.., " + "}";
|
||||
}
|
||||
return type + fmt(json, 50, 0);
|
||||
return type + json;
|
||||
}
|
||||
|
||||
if (typeof aThing == "function") {
|
||||
return fmt(aThing.toString().replace(/\s+/g, " "), 80, 0);
|
||||
return aThing.toString().replace(/\s+/g, " ");
|
||||
}
|
||||
|
||||
let str = aThing.toString().replace(/\n/g, "|");
|
||||
return fmt(str, 80, 0);
|
||||
return str;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -334,7 +341,7 @@ function formatTrace(aTrace) {
|
||||
aTrace.forEach(function(frame) {
|
||||
reply += fmt(frame.filename, 20, 20, { truncate: "start" }) + " " +
|
||||
fmt(frame.lineNumber, 5, 5) + " " +
|
||||
fmt(frame.functionName, 75, 75) + "\n";
|
||||
fmt(frame.functionName, 75, 75, { truncate: "center" }) + "\n";
|
||||
});
|
||||
return reply;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user