You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
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 thevalue.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.
The text was updated successfully, but these errors were encountered: