Open Bug 973365 Opened 10 years ago Updated 2 years ago

Shorter strings can be displayed longer than longer ones in the console

Categories

(DevTools :: Console, defect, P4)

27 Branch
x86
Windows XP
defect

Tracking

(Not tracked)

REOPENED

People

(Reporter: obrufau, Unassigned)

References

Details

(Whiteboard: [btpp-backlog])

User Agent: Mozilla/5.0 (Windows NT 5.1; rv:30.0) Gecko/20100101 Firefox/30.0 (Beta/Release)
Build ID: 20140216030203

Steps to reproduce:

Run the following code:

    function fillConsole(n) {
        var arr=[];
        for(var i=1; i<=n; ++i) arr.push(i);
        console.log(arr.join(' '));
    }
    fillConsole(2e3);
    fillConsole(3e3);


Actual results:

The first call fillConsole(2e3) fills the console with big string.

The second call fillConsole(3e3) shows a clipped string, which can be expanded.

The problem is that the string displayed by fillConsole(2e3) is much larger than the clipped one of fillConsole(3e3).


Expected results:

Shorter strings shouldn't be displayed longer than longer ones.
Component: Untriaged → Developer Tools: Console
This is due to the LONG_STRING_LENGTH being larger than the LONG_STRING_INITIAL_LENGTH here: https://dxr.mozilla.org/mozilla-central/source/devtools/server/main.js#164.  It is a bit inconsistent, although this is set by the debugger server so any changes would affect all tools and not just the console.
Status: UNCONFIRMED → NEW
Ever confirmed: true
Priority: -- → P3
Whiteboard: [btpp-backlog]
Product: Firefox → DevTools
Priority: P3 → P4

We have to set an arbitrary limit, so there's not much we could do (aside from capping the string to long strings' initial length, but that's not something that would be useful IMO)

Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → WONTFIX

Nicolas Chevobbe: Obviously, the limits need to be set to something. This bug isn't about allowing arbitrary length output in the console, it's about having the maximum limit be the same as the length to which longer output is truncated. As it currently works, it's confusing to people doing development with Mozilla software. If the lengths were the same, even if both were the shorter limit, then a developer would immediately know that the system had just done something normal and expected: truncated output that was too long. Easy. Expected.

Currently, because different limits are used (quite significantly different limits), the first thing a developer things of is that something is wrong with what they are outputting. They then check to see if the string they were outputting got mangled in their own code. Ultimately, this can cost each developer that encounters it a considerable amount of time, because having the truncated length be substantially shorter than the maximum length is so unexpected.

If the lengths were the same, then a developer would immediately think: "Oh, that's the limit to which they truncate." Truncating the output is normal and expected.

From the above comments, it sounds like all it would take to actually fix the issue is to just change the definition of a single constant value, but perhaps some unit tests would need to change. The actual change sounds like it's trivial and doing so would save considerable time for various developers trying to use Mozilla's software.

So, please re-open this bug.

Status: RESOLVED → REOPENED
Resolution: WONTFIX → ---
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.