console.log omits properties of some objects

RESOLVED WORKSFORME

Status

defect
P3
normal
RESOLVED WORKSFORME
2 years ago
2 months ago

People

(Reporter: abdullah.exe, Unassigned)

Tracking

(Blocks 1 bug)

Firefox Tracking Flags

(Not tracked)

Details

(Whiteboard: [specification][type:bug])

(Reporter)

Description

2 years ago
What did you do?
================
1. console.log
2. GoJS
3. 

What happened?
==============
After Firefox Update 51.01, I started using Firefox Development tools, as firebug stopped working properly..
That is when I noticed there is difference in console.log output

Firefox development tools console has incomplete output

What should have happened?
==========================
In firebug, console.log display complete info about the object, also google chrome console display complete information of object. Firefox development tools console.log should also display complete information of object

Is there anything else we should know?
======================================
when I use console.log on goJS object, it doesn't display all its properties.
console.log is not the same as in firebug or google chrome.

maybe it is same on other nested objects also, but i noticed this behavior while using goJS plugin.

for example:
console.log(goJSDiagramObject);
Component: General → Developer Tools: Console
Product: Mozilla Developer Network → Firefox
Can you be more specific about what is missing?  Is there a test page that demonstrates the problem?
Flags: needinfo?(abdullah.exe)
Summary: Firefox Developemt Tools issue → console.log omits properties of some objects
(Reporter)

Comment 2

2 years ago
(In reply to J. Ryan Stinnett [:jryans] (use ni?) from comment #1)
> Can you be more specific about what is missing?  Is there a test page that
> demonstrates the problem?

Yes I created the situation in this jsfiddle

https://jsfiddle.net/u4xs36hp/

Compare the console.log result in Firefox Development tools, Google Chrome development tools and firebug(with Firefox version older than 51.01)
^
firebug on Firefox 51.01 doesn't work properly
(Reporter)

Updated

2 years ago
Flags: needinfo?(abdullah.exe)
(In reply to abdullah.exe from comment #2)

> Yes I created the situation in this jsfiddle
> 
> https://jsfiddle.net/u4xs36hp/
> 
> Compare the console.log result in Firefox Development tools, Google Chrome
> development tools and firebug(with Firefox version older than 51.01)
> ^
> firebug on Firefox 51.01 doesn't work properly

Could you say specifically what is missing?
I looked at this with nightly and with chrome and didn't see a real difference.
Both shorten the property list shown in the console, and clicking opens the
object for fuller inspection.  I skimmed the properties and didn't see anything
obviously missing, though there were so many and with very similar names, so
it's possible I missed one... since it sounds like you know exactly what is wrong,
that information would be very helpful.
Flags: needinfo?(abdullah.exe)
The difference is that Firebug and the Chrome DevTools output the object variable names while the Firefox DevTools only output 'Object'.

To be precise, here are the different outputs:

Firebug:
E { __gohashid=206,  Vc=false,  CB=Zg,  more...}

Chrome DevTools:
E {__gohashid: 206, Vc: false, CB: Zg, Ed: 17, Jr: false…}

Firefox DevTools (old console UI):
Object { __gohashid: 206, Vc: false, CB: Object, Ed: 17, Jr: false, nz: "negative", ac: Object, Ib: 555, Mb: 300, Hb: Object, 184 more… }

Firefox DevTools (Nightly)
Object { __gohashid: 206, Vc: false, CB: Object, Ed: 17, Jr: false, nz: "negative", ac: Object, Ib: 555, Mb: 300, Hb: Object }
(also missing the indicator that the object has more items)


Also, objects in arrays are output differently than in Firebug[1]. The output for console.log([{a:1}]), for example, looks like this:

Firebug:
[Object { a=1}]

Firefox DevTools:
Array [ Object ]

Sebastian

[1] https://groups.google.com/d/msg/firebug/IFDmO2Ov2B8/b3wMQLc8EgAJ
Blocks: firebug-gaps
Flags: needinfo?(abdullah.exe)
(Reporter)

Comment 5

2 years ago
^ this is right. @Sebastian Zartner Thanks for explaining it

I have added an each loop on the object, and counted the iterations, the output is 550. but Firefox development tool is only displaying 194

Firefox DevTools
Object { __gohashid: 206, Vc: false, CB: Object, Ed: 17, Jr: false, nz: "negative", ac: Object, Ib: 572, Mb: 300, Hb: Object, 184 more… }

check this JSFiddle: https://jsfiddle.net/u4xs36hp/1/
For me, there is multiple bugs here : 
- the fact that we do not show a "more..." label , which is probably a Rep bug (https://github.com/devtools-html/reps). I will create an issue for that
- the fact that we're showing an "Object" label, instead of "E" - even if I do not know where it comes from (it's not the variable name since or we would display "myDiagram"). Maybe it's the name of the constructor or something like that. I'll dig deeper.

Abdullah, you're counting 500+ properties, but Object.keys returns ~200. If you're doing a for...in loop, I guess you go through the prototype chain, which I don't think is what we want here.

Also, more globally, I'm wondering the usefulness of showing exactly how many more object there are left to show. The Chrome and Firebug way of only displaying "more..." seems nice. I'll think about it.
(In reply to Tom Tromey :tromey from comment #7)
> The constructor problem was noted as a gap by a user here:
> http://stackoverflow.com/questions/43588306/show-object-type-in-firefox-dom-
> inspector/43590542#43590542

The question there actually referred to the display inside the DOM Property Viewer, not the output of console.log() and Co. And the issue mentioned there isn't actually a Firebug gap, as constructor names *are* displayed like in Firebug, only their properties aren't in some cases, which is covered in bug 1267235.

Sebastian
See Also: → 1267235

Updated

10 months ago
Product: Firefox → DevTools

Tested again today, and we do show an ellipsis at the end of the object (and not X more).

Status: UNCONFIRMED → RESOLVED
Last Resolved: 2 months ago
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.