console.log for DOM nodes sends unhelpful information to stdout
Categories
(DevTools :: Console, enhancement, P3)
Tracking
(firefox112 fixed)
Tracking | Status | |
---|---|---|
firefox112 | --- | fixed |
People
(Reporter: mossop, Assigned: Gijs)
References
(Blocks 1 open bug)
Details
Attachments
(1 file)
A lot of what used to be XBL elements are now custom elements, normally subclasses of MozElementBase. If you pass one of these to console.log you get decent output in the browser console, but in stdout you get quite unhelpful things like ({})
or ({renderedOnce:true, _inheritedElements:{'.menu-iconic-text':{_lastFormattedAccessKey:null, isRunningDelayedConnectedCallback:false}, '.menu-text':null, '.menu-iconic-highlightable-text':{_lastFormattedAccessKey:null, isRunningDelayedConnectedCallback:false}, '.menu-iconic-left':{}}, initializedAttributeInheritance:true})
.
It would be quite useful to output something more sensible in this case. Something like <element attr1="..." attr2="..." ... />
would be fairly clear.
Comment 1•4 years ago
|
||
This appears to be a more general problem with DOM nodes. I double checked console.log(document.body)
in the browser console and see console.log: ({})
in stdout. Seeing a stringified version of the output in the console UI as you suggest seems sensible.
Comment 2•4 years ago
|
||
This is only visible with chrome code by default. You could reproduce with messages coming from content with --setpref devtools.console.stdout.content=true
.
Updated•4 years ago
|
Updated•2 years ago
|
Assignee | ||
Comment 3•1 year ago
|
||
I would really like to see this fixed. As I said in bug 1813485, I'm willing to do the work if someone can point me to where the dump/stringification stuff for this lives.
Comment 4•1 year ago
|
||
(In reply to :Gijs (he/him) from comment #3)
I would really like to see this fixed. As I said in bug 1813485, I'm willing to do the work if someone can point me to where the dump/stringification stuff for this lives.
I'm not sure about this, but it may happen from https://searchfox.org/mozilla-central/source/dom/console/Console.cpp#2671-2740 ?
Assignee | ||
Comment 5•1 year ago
|
||
Updated•1 year ago
|
Pushed by gijskruitbosch@gmail.com: https://hg.mozilla.org/integration/autoland/rev/46b47ef1af37 improve console method's dump logging for DOM elements, r=nchevobbe,smaug
Comment 7•1 year ago
|
||
bugherder |
Description
•