Skip to content

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

@srujzs

Description

@srujzs

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-web-jsIssues related to JavaScript support for Dart Web, including DDC, dart2js, and JS interop.web-dev-compiler

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions