[ddc] runtime doesn't support interceptors for native types on some corner cases #53864
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
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.
The text was updated successfully, but these errors were encountered: