ObjectInspector should show wrapped primitive
Categories
(DevTools :: Shared Components, enhancement, P3)
Tracking
(firefox119 fixed)
Tracking | Status | |
---|---|---|
firefox119 | --- | fixed |
People
(Reporter: nchevobbe, Assigned: LyScott123, Mentored)
Details
Attachments
(1 file)
Steps to reproduce
- Open the console
- Evaluate
inspect(Object(123))
Actual results
▼ Number
▶︎ __proto__: Number { 0 }
Expected results
It would be useful to show the 123
, e.g.
▼ Number
<primitive>: 123
▶︎ __proto__: Number { 0 }
And analogous for boolean, string and symbol objects. The grip of the primitive value is exposed in the wrappedValue
property of the preview.
Assignee | ||
Comment 1•1 year ago
|
||
Hello! Was wondering if I can pick this one up! Thanks!
Reporter | ||
Comment 2•1 year ago
|
||
(In reply to LyScott123 from comment #1)
Hello! Was wondering if I can pick this one up! Thanks!
Hello LyScott123, sure, I can assign it to you.
You would have to add a new item in https://searchfox.org/mozilla-central/rev/fb43eb3bdf5b51000bc7dfe3474cbe56ca2ab63c/devtools/client/shared/components/object-inspector/utils/node.js#20-36
Then you can try to copy what we do to create those custom nodes (e.g. https://searchfox.org/mozilla-central/rev/fb43eb3bdf5b51000bc7dfe3474cbe56ca2ab63c/devtools/client/shared/components/object-inspector/utils/node.js#375-384)
You'll probably need the Browser Toolbox (https://firefox-source-docs.mozilla.org/devtools-user/browser_toolbox/index.html), which is basically DevTools for the whole Firefox UI (including DevTools themselves)
Don't hesitate to ask any question, here or in https://matrix.to/#/#devtools:mozilla.org
Notes:
I was wondering if this was still valid, as in the console we render something like Number { 123 }
, but in tiny mode (e.g. in Debugger scopes), we only show Number
, so it would make sense to add a dedicated node. Not sure about <primitive>
now, maybe <primitiveValue>
would be more explicit?
Comment 3•1 year ago
|
||
Even if expanded objects are no longer shown in tiny mode in the console, it still seems strange that the reps preview shows more information than the object inspector.
Also note that Object(123n)
doesn't show 123n
in the preview (but probably it should).
Assignee | ||
Comment 4•1 year ago
|
||
Assignee | ||
Comment 5•1 year ago
|
||
Sorry this took so long! Was a lot more involved than I thought. I think I got it though! Let me know if there is anything I need to change! =] Thanks!
Updated•1 year ago
|
Updated•1 year ago
|
Updated•1 year ago
|
Comment 7•1 year ago
|
||
bugherder |
Description
•