Closed Bug 1695150 Opened 4 years ago Closed 1 year ago

ObjectInspector should show wrapped primitive

Categories

(DevTools :: Shared Components, enhancement, P3)

enhancement

Tracking

(firefox119 fixed)

RESOLVED FIXED
119 Branch
Tracking Status
firefox119 --- fixed

People

(Reporter: nchevobbe, Assigned: LyScott123, Mentored)

Details

Attachments

(1 file)

Steps to reproduce

  1. Open the console
  2. 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.

Hello! Was wondering if I can pick this one up! Thanks!

(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?

Assignee: nobody → LyScott123
Status: NEW → ASSIGNED

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).

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!

Attachment #9349740 - Attachment description: Bug 1695150 - ObjectInspector should show wrapped primitive r?nchevobbe → WIP: Bug 1695150 - ObjectInspector should show wrapped primitive r?nchevobbe
Attachment #9349740 - Attachment description: WIP: Bug 1695150 - ObjectInspector should show wrapped primitive r?nchevobbe → WIP: Bug 1695150 - ObjectInspector should show wrapped primitive
Attachment #9349740 - Attachment description: WIP: Bug 1695150 - ObjectInspector should show wrapped primitive → Bug 1695150 - ObjectInspector should show wrapped primitive. r=nchevobbe
Pushed by nchevobbe@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/efec110c91d5 ObjectInspector should show wrapped primitive. r=nchevobbe,devtools-reviewers
Status: ASSIGNED → RESOLVED
Closed: 1 year ago
Resolution: --- → FIXED
Target Milestone: --- → 119 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: