-
Notifications
You must be signed in to change notification settings - Fork 49.8k
[Flight] Copy the name field of a serialized function debug value #34085
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
Conversation
| return (0, eval)('({' + JSON.stringify(name) + ':class{}})')[ | ||
| name | ||
| ]; | ||
| let fn; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should really take this fallback path whenever there’s a static initializer or static constructor function since that causes a side effect that might be unexpected even if it doesn’t error.
It could also be a security issue if you’re debugging a third party RSC service (which isn’t really supported yet but should minimize the surface).
It’s just tricky. Might have to bail on anything that contains lower case class and static at word boundaries.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added this bailout
6d4dd70 to
01128dd
Compare
|
Unfortunately it seems that Chrome doesn't always use this name as the display name of a class instance even when defined on the constructor. |
…cebook#34085) This ensures that if the name is set manually after the declaration, then we get that name when we log the value. For example Node.js `Response` is declared as `_Response` and then later assigned a new name. We should probably really serialize all static enumerable properties but "name" is non-enumerable so it's still a special case. DiffTrain build for [3958d5d](facebook@3958d5d)
…cebook#34085) This ensures that if the name is set manually after the declaration, then we get that name when we log the value. For example Node.js `Response` is declared as `_Response` and then later assigned a new name. We should probably really serialize all static enumerable properties but "name" is non-enumerable so it's still a special case. DiffTrain build for [3958d5d](facebook@3958d5d)
This ensures that if the name is set manually after the declaration, then we get that name when we log the value. For example Node.js
Responseis declared as_Responseand then later assigned a new name.We should probably really serialize all static enumerable properties but "name" is non-enumerable so it's still a special case.