Skip to content
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

Fix dart:js for cross-frame Arrays #35421

Open
sigmundch opened this issue Dec 14, 2018 · 3 comments
Open

Fix dart:js for cross-frame Arrays #35421

sigmundch opened this issue Dec 14, 2018 · 3 comments
Labels
area-web Use area-web for Dart web related issues, including the DDC and dart2js compilers and JS interop. customer-google3 library-js P3 A lower priority bug or feature request web-js-interop Issues that impact all js interop

Comments

@sigmundch
Copy link
Member

the check o instanceof Array here:
https://github.com/dart-lang/sdk/blob/master/sdk/lib/js/dart2js/js_dart2js.dart#L153

does not work when the array came from a different iframe.

@rakudrama suggests we should use Array.isArray instead.

@sigmundch sigmundch added area-core-library SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries. library-js labels Dec 14, 2018
@LorenVS
Copy link
Contributor

LorenVS commented Dec 14, 2018

I believe this check also needs to be updated:

if (JS('bool', '# instanceof Array', o)) {

@jmesserly jmesserly added web-js-interop Issues that impact all js interop and removed area-core-library SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries. labels Dec 15, 2018
@jmesserly
Copy link

FYI, using "dart:js" JsObject is deprecated (not sure if it has been marked as such, but it should be). I'd be interested to understand the use case and try to find a better solution for you?

"package:js" is the supported approach (https://pub.dartlang.org/packages/js), there are examples here: https://github.com/matanlurey/dart_js_interop, and lots of improvements planned (#35084)

@jmesserly
Copy link

A related issue, apparently dart2js interceptor dispatch uses a.constructor == JsArray (?), which means it doesn't recognize generic arrays created by DDC (except List<dynamic>, presumably). This is based on user reports.

(Aside: I wonder if we'd eventually want some sort of Dart-to-Dart interop for multi-app scenarios, rather than rely on JS interop for communication between the Dart apps.)

@vsmenon vsmenon added the area-web Use area-web for Dart web related issues, including the DDC and dart2js compilers and JS interop. label Jul 22, 2019
@sigmundch sigmundch added P3 A lower priority bug or feature request and removed P3 A lower priority bug or feature request labels Jul 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-web Use area-web for Dart web related issues, including the DDC and dart2js compilers and JS interop. customer-google3 library-js P3 A lower priority bug or feature request web-js-interop Issues that impact all js interop
Projects
None yet
Development

No branches or pull requests

4 participants