-
Notifications
You must be signed in to change notification settings - Fork 1.7k
[ddc] Add an API for the debugger to easily identify native JS objects and errors #51583
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
Comments
@srujzs |
Would we still need this API if we start exposing JS types e.g. If I'm understanding this correctly, we'd like to tell if this is not a Dart type and also not one of several JS types. We also want to tell if a variable is a JS I think this is doable with a combination of |
@srujzs I think using JS types and |
@srujzs what needs to be done here to expose JS types? Could adding a ddc runtime API be an easier (even if temporary) solution for now so we prevent dwds from breaking on such changes? |
Can you explain a bit more what you're looking for here? Like subtypes of
We have some JS types exposed via |
FYI - I just came across this issue while investigating #52572. My current change to address that other issue is to remove the coupling between NativeError and Error in the DDC layer, doing this may affect some of the behavior in dwds because we are asking queries about JavaScript using the internal Dart types. Exposing helpers in the DDC runtime seems like it may be the most robust way to improve this. Another option here is to directly identify native objects within JavaScript, but I get the impression it will not be as robust, since we do sometimes map native types to Dart types. |
This is superseded by work in dart-lang/webdev#1949 |
The debugger (dwds) needs to
find if the type of the variable is not related to dart so the variable does not need to be displayed in the UI
find if the type of the variable corresponds to a JS error and needs to be mapped to dart stack trace.
Currently we rely on type names for identifying those, which was proven to be fragile in the past.
See the latest example in dart-lang/webdev#1821
Suggestion:
isNativeJavaScriptError(object)
andisNativeJavaScriptObject(object)
.require('dart_sdk').dart.isNativeJavaScriptError(object)
to use them in the debugger.The text was updated successfully, but these errors were encountered: