[DDC] Avoid consuming and returning Dart objects directly in runtime debugging APIs #56966
Labels
area-web-js
Issues related to JavaScript support for Dart Web, including DDC, dart2js, and JS interop.
web-dev-compiler
DWDS interacts with the runtime debugging APIs available here: https://github.com/dart-lang/sdk/blob/eafb6b73f7ddab69d7832f20fc7e336d62bcca48/sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/debugger.dart. While these will be re-exposed in a different manner in
ddc_module_loader.js
with the new module format, many of these APIs still consume and return Dart objects e.g.getObjectMetadata
orgetRecordFields
.Instead, we've floated around a few ideas:
WeakMap
of Dart objects to some ID. This ID would then be packaged with other metadata in some JSON-like format.WeakRef
of the Dart object.1 is preferred due to the extra information provided. One complication is that DWDS type-checks the resulting object using basic JS type-checks, so we may only want to do this replacement when the value is not a JS type e.g.
string
,array
(but the values inside should also be examined).Possibly related issue: #40273
The text was updated successfully, but these errors were encountered: