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)
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
Comment 1•7 years ago
|
||
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•7 years ago
|
Flags: qe-verify?
Priority: P2 → P3
Whiteboard: [console-html][triage] → [reserve-console-html]
Updated•7 years ago
|
Assignee: nobody → nchevobbe
Status: NEW → ASSIGNED
Priority: P3 → P1
Updated•7 years ago
|
Iteration: --- → 57.1 - Aug 15
Updated•7 years ago
|
Iteration: 57.1 - Aug 15 → 57.2 - Aug 29
Updated•7 years ago
|
Iteration: 57.2 - Aug 29 → 57.3 - Sep 19
Comment 2•7 years ago
|
||
Can you confirm it works as expected Oriol ?
Status: ASSIGNED → RESOLVED
Closed: 7 years ago
Flags: needinfo?(oriol-bugzilla)
Resolution: --- → WORKSFORME
Updated•7 years ago
|
Assignee: nchevobbe → nobody
Iteration: 57.3 - Sep 19 → ---
Flags: qe-verify?
Priority: P1 → --
Whiteboard: [reserve-console-html]
Reporter | ||
Comment 3•7 years 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•7 years 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.
Comment 5•7 years ago
|
||
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)`.
Comment 6•7 years ago
|
||
Let's file an issue on devtools-core to not load prototype for Proxies
Updated•6 years ago
|
Product: Firefox → DevTools
You need to log in
before you can comment on or make changes to this bug.
Description
•