-
Notifications
You must be signed in to change notification settings - Fork 29.6k
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
Native property accessor has no internal fields if evaluated under the Inspector #19879
Comments
In this case, you could:
|
Thank you for your fast response! I've performed a quick test and moving the native Accessor to the instance template does fix the issue with the internal fields being missing. Am I right in understanding that, because the Accessor is on the prototype instance it is being evaluated by the Inspector as part of the prototype object? That would certainly explain the problem. I think using a combination of your second and third suggestions would be best for my integration as it would prevent bad usage rather than tolerating it. I'll update this ticket once I've done that. |
Yes! As far as I can tell, this is exactly the same as the issue we ran into in Node.js a while ago with The problem with @addaleax’s approach of putting the method on the instance (aka Option 2 in the “How do we fix this?” section in the linked issue) is that it can cause nontrivial memory usage increase (see #17636 (comment)). I would recommend going with Option 1 in your own application, which is also what we ended up doing to fix |
I've spent a little more time looking at this issue. In my use case I want the Inspector to display the value of the native Accessor as that very useful to the developer. This means I cannot use the first option as, if the In order for the Inspector to display the native Accessor value I must move it to the So for clarity I took the following steps:
Thank you both for your help! |
I am working on a native Node addon that exposes a C++ library to JavaScript. The primary reason for choosing Node was support for the inspector protocol and ease of debugging. The native addon works correctly if the script is run without the inspector attached but will fail if the inspector reads from a natively backed Accessor.
When the inspector attempts to read the natively backed Accessor the object passed for
this
does not have any internal fields. This is a problem as an internal field is used to store the raw C++ pointer the Accessor should read from. This implies that the inspector is working with a clone of the object, though a cursory glance through Node and V8 didn't find any reason for why that might be the case.I have tried using both Chrome DevTools and Visual Studio as debugging clients and the behaviour is the same.
Is this behaviour expected?
My use case can be demonstrated using the following (slightly simplified) code:
Where
GetPropertyValue
is implemented as:The text was updated successfully, but these errors were encountered: