Object Inspector should show [[ProxyHandler]] and [[ProxyTarget]] instead of executing proxy traps

RESOLVED WORKSFORME

Status

DevTools
Console
RESOLVED WORKSFORME
11 months ago
10 days ago

People

(Reporter: Oriol, Unassigned)

Tracking

56 Branch
Dependency tree / graph

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

11 months ago
When you use the Object Inspector on a proxy object, it attempts to get the own properties.

It should display the [[ProxyTarget]] and [[ProxyHandler]] instead.

https://dxr.mozilla.org/mozilla-central/rev/a921bfb8a2cf3db4d9edebe9b35799a3f9d035da/devtools/server/actors/object.js#275-276

    names = this.obj.getOwnPropertyNames();     //  <-- ownKeys trap
    symbols = this.obj.getOwnPropertySymbols(); //  <-- ownKeys trap

https://dxr.mozilla.org/mozilla-central/rev/a921bfb8a2cf3db4d9edebe9b35799a3f9d035da/devtools/server/actors/object.js#298

    prototype: this.hooks.createValueGrip(this.obj.proto), //  <-- getPrototypeOf trap
Hello Oriol, thanks for reporting this.
I filed https://github.com/devtools-html/devtools-core/issues/583 for doing this work on the reps side.
Priority: -- → P2
Whiteboard: [console-html][triage]

Updated

11 months ago
Flags: qe-verify?
Priority: P2 → P3
Whiteboard: [console-html][triage] → [reserve-console-html]
Assignee: nobody → nchevobbe
Status: NEW → ASSIGNED
Priority: P3 → P1

Updated

11 months ago
Iteration: --- → 57.1 - Aug 15

Updated

10 months ago
Iteration: 57.1 - Aug 15 → 57.2 - Aug 29

Updated

10 months ago
Iteration: 57.2 - Aug 29 → 57.3 - Sep 19
Depends on: 1399460
Can you confirm it works as expected Oriol ?
Status: ASSIGNED → RESOLVED
Last Resolved: 9 months ago
Flags: needinfo?(oriol-bugzilla)
Resolution: --- → WORKSFORME

Updated

9 months ago
Assignee: nchevobbe → nobody
Iteration: 57.3 - Sep 19 → ---
Flags: qe-verify?
Priority: P1 → --
Whiteboard: [reserve-console-html]
(Reporter)

Comment 3

9 months ago
It seems there is still a getPrototypeOf call. __proto__ should not be shown.

    inspect(new Proxy({},{}))

    ▼ Proxy
      ▶ <target>: Object {  }
      ▶ <handler>: Object {  }
      ▶ __proto__: Proxy { … }
Flags: needinfo?(oriol-bugzilla)
(Reporter)

Comment 4

9 months ago
Anyways, onPrototypeAndProperties attempts to access objects that shouldn't be accessed (not only proxies). Probably this will be fixed in 1394559, then it would make sense to also modify onPrototype to just return null.
We don't call onPrototypeAndProperties anymore :)
Here is the function where we decide whether or not to load the prototype of a given node : https://github.com/devtools-html/devtools-core/blob/b9616604b90565680292f4ff3bfe2565ad415b17/packages/devtools-reps/src/object-inspector/utils/node.js#L809 .
Here, if we don't need to load it for Proxy, we could probably add another case `&& !nodeIsProxy(item)`.
Let's file an issue on devtools-core to not load prototype for Proxies

Updated

10 days ago
Product: Firefox → DevTools
You need to log in before you can comment on or make changes to this bug.