Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pretty-printing objects from a different frame results in "[object Object]" #1087

Closed
thatfulvioguy opened this issue Apr 1, 2016 · 1 comment

Comments

@thatfulvioguy
Copy link
Contributor

Attempting to pretty-print an object that came from another frame (or any other situation where value.toString !== Object.prototype.toString despite it not actually having a custom toString) results in the normal output of Object.prototype.toString being printed, "[object Object]". This seems to be due to the well-intentioned check for whether an object has a custom toString in order to prefer that over the normal pretty printing behaviour. Specifically, it is the value.toString !== Object.prototype.toString portion which causes a false positive.

This could be fixed by speculatively calling value.toString and comparing its output against the normal Object.prototype.toString output. If the output is different, then the value being pretty printed definitely has a custom toString and the output can be used as is.

@thatfulvioguy
Copy link
Contributor Author

I can submit a PR for this, if you like

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant