Skip to content

[DDC] Avoid consuming and returning Dart objects directly in runtime debugging APIs #56966

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

Open
srujzs opened this issue Oct 25, 2024 · 0 comments
Labels
area-web-js Issues related to JavaScript support for Dart Web, including DDC, dart2js, and JS interop. web-dev-compiler

Comments

@srujzs
Copy link
Contributor

srujzs commented Oct 25, 2024

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 or getRecordFields.

Instead, we've floated around a few ideas:

  1. A WeakMap of Dart objects to some ID. This ID would then be packaged with other metadata in some JSON-like format.
  2. A direct 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

@srujzs srujzs added web-dev-compiler area-web-js Issues related to JavaScript support for Dart Web, including DDC, dart2js, and JS interop. labels Oct 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-web-js Issues related to JavaScript support for Dart Web, including DDC, dart2js, and JS interop. web-dev-compiler
Projects
None yet
Development

No branches or pull requests

1 participant