Skip to content

[ddc] runtime doesn't support interceptors for native types on some corner cases #53864

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

Closed
sigmundch opened this issue Oct 25, 2023 · 0 comments
Labels
area-web-js Issues related to JavaScript support for Dart Web, including DDC, dart2js, and JS interop closed-not-planned Closed as we don't intend to take action on the reported issue P3 A lower priority bug or feature request web-dev-compiler

Comments

@sigmundch
Copy link
Member

DDC's mechanism to add a Dart API to a JavaScript native class relies on adding members to the native class's prototype and to the native class's constructor. The prototype is used for interface dispatch, while the properties added to the constructor are used for implementing dcalls.

Some browser APIs no longer return instances of a class, but objects created via Object.create. For example, this came up a few years ago when changes to Gamepad caused issues when bootstraping apps. Our solution to avoid issues was to bailout if an instance doesn't have it's own prototype and constructor (see this change).

Turns out, there are a family of APIs that have a prototype but no constructor. For example, the FileEntry APIs. But, because we bailout when either is missing, the API is not functional. This is the reason behind #47786, but also the reason why in a recent triage we found most fileapi tests failing in DDC (except in firefox).

We could potentially change the bailout to add the interface dispatch if we have a prototype even though we don't have a constructor. That would help use APIs with interface dispatch, but would quickly fail if you use dcalls. This behavior cliff would be very surprising too. In fact, the fileapi tests that led me to this issue would hit this problem, they use dcalls too.

Given our current goals to move towards interop-based DOM access in package:web, I don't believe this is worth changing in DDC at the moment.

In summary, I'm filing this issue for tracking and documentation purposes, but my intend is to close it as "wont-fix" unless we have additional reasons to change directions.

@sigmundch sigmundch added closed-not-planned Closed as we don't intend to take action on the reported issue P3 A lower priority bug or feature request web-dev-compiler area-web-js Issues related to JavaScript support for Dart Web, including DDC, dart2js, and JS interop labels Oct 25, 2023
copybara-service bot pushed a commit that referenced this issue Oct 27, 2023
These tests had several issues. The fixes are aimed to reduce flakiness
and remove invalid configurations where tests are not providing any
value. Some of the issues include:

* some tests interferered with each other causing a 18% flakiness rate
  in chrome: they used a common file system that ended up being shared
  in a single browser instance. This is why some tests failed when they
  find a file exists before it was created [1].

* some tests were not properly using async_helper/async_minitest, so
  they may complete before they finish executing

* DDC no longer supports these APIs due to
  #53864. We don't intend to fix
  those issues, so there is no purpose in running these tests in DDC at this
  time.

[1]: https://logs.chromium.org/logs/dart/buildbucket/cr-buildbucket/8766313714239949697/+/u/test_results/ignored_flaky_test_failure_logs

Change-Id: I1dbb28eba2d962000a4d425563dbc1eb6b55dbed
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/332266
Commit-Queue: Sigmund Cherem <[email protected]>
Reviewed-by: Srujan Gaddam <[email protected]>
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 closed-not-planned Closed as we don't intend to take action on the reported issue P3 A lower priority bug or feature request web-dev-compiler
Projects
None yet
Development

No branches or pull requests

1 participant