inspector
inspector copied to clipboard
Property values on platform objects are misreported as "forbidden"
When walking an object, valueof attempts to access properties on the object's prototype:
https://github.com/observablehq/inspector/blob/fe14a1befb66d197f22750312e650a33d7c5608c/src/object.js#L18-L26
Due to implementation details for getters on platform objects this throws TypeError: Illegal invocation, which then gets caught and misinterpreted as SecurityError. As a result the property value is rendered as [forbidden].
To reproduce:
- Create a cell that returns a native object (e.g.
screen,performance) - Expand the object
Slack thread: https://observablehq.slack.com/archives/C01LADG5CF6/p1633558706168700
Proof of concept illustrating two parts of a potential fix:
- Change the
protoargument from a boolean to track the root object we are inspecting, and invoke getters with descriptor.get.apply - Show the getter name in an italic font