Closed Bug 1388831 Opened 7 years ago Closed 7 years ago

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

Categories

(DevTools :: Console, defect)

56 Branch
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED WORKSFORME

People

(Reporter: Oriol, Unassigned)

References

Details

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]
Flags: qe-verify?
Priority: P2 → P3
Whiteboard: [console-html][triage] → [reserve-console-html]
Assignee: nobody → nchevobbe
Status: NEW → ASSIGNED
Priority: P3 → P1
Iteration: --- → 57.1 - Aug 15
Iteration: 57.1 - Aug 15 → 57.2 - Aug 29
Iteration: 57.2 - Aug 29 → 57.3 - Sep 19
Depends on: 1399460
Can you confirm it works as expected Oriol ?
Status: ASSIGNED → RESOLVED
Closed: 7 years ago
Flags: needinfo?(oriol-bugzilla)
Resolution: --- → WORKSFORME
Assignee: nchevobbe → nobody
Iteration: 57.3 - Sep 19 → ---
Flags: qe-verify?
Priority: P1 → --
Whiteboard: [reserve-console-html]
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)
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
Product: Firefox → DevTools
You need to log in before you can comment on or make changes to this bug.