-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
[CP] Check dart:ffi imports and wasm:import/export pragmas in user code #55890
Comments
@mkustermann do you know how to test this? |
If the actual commits on |
LGTM |
…agmas in user code - Disallow importing `dart:ffi` in user code. - Disallow `wasm:import` and `wasm:export` pragmas in user code. Bug: #53910 Cherry-pick: https://dart-review.googlesource.com/c/sdk/+/369040 Cherry-pick-request: #55890 Change-Id: Ifaaeb4f2c4b13bd5f564ffbf5281d6439ac6dd56 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/369040 Reviewed-by: Alexander Thomas <athom@google.com> Reviewed-by: Martin Kustermann <kustermann@google.com> Commit-Queue: Martin Kustermann <kustermann@google.com>
The CP was merged now. |
I am using I am not using Flutter, I am just porting dart to wasm. |
Some background:
Because of all these reasons we strive to have solutions that work across DDC (our development tool), Dart2JS (our deployment compiler for all JS environments) and Dart2Wasm (for JS environments that support it). => The recommended strategy to expose APIs is to use JS interop. @magic-akari let me know if that works for you. |
Thank you for your reply. @mkustermann
However, there are still some issues: The exported function is attached to So, I made some modifications to the output JS file, changing To follow best practices, I hope to automate this process. Alternatively, attaching it to the exports of wasm is also a good choice. |
One can install the exported API functions on any JavaScript object, not just on
We'd like to make dart apps work in DDC, dart2wasm & dart2js - so we'd want to avoid a dart2wasm specific solution. (Maybe in the future we extend the scope to make dart2wasm apps run in pure wasm environments and have a development mode for dart2wasm, but there's much longer term) Hope you got unblocked now. I'm going to lock this issue as it's about a cherry-pick and that has landed. |
Commit(s) to merge
dbcf23a
35bc17a
Target
stable
Prepared changelist for beta/stable
https://dart-review.googlesource.com/c/sdk/+/369040
Issue Description
dart2wasm currently allows importing
dart:ffi
(to use@Native
) and usingwasm:import
andwasm:export
pragmas.However none of these were designed for end users. We have no documentation on how to properly use them, and they can cause compile time or runtime crashes.
What is the fix
Disallow importing
dart:ffi
and usingwasm:import
andwasm:export
pragmas.Why cherry-pick
These features were never intended for users. They will cause confusion.
Risk
None, however we should make sure the checks allow uses of these features in Flutter.
Issue link(s)
#55744
Extra Info
No response
The text was updated successfully, but these errors were encountered: