Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix JS value to Dart conversion when receiving from a web socket (#298)
`MessageEvent` is a `package:web` type and `data` field is a JS value of type `JSAny?`. The receiving end of the `sink` is here: https://github.com/dart-lang/sdk/blob/26107a319a7503deafee404e3462644a873e2920/pkg/vm_service/lib/src/vm_service.dart#L1795 This code currently does not expect to see JS objects, so passing a `JSAny?` to the sink breaks it. The fix should be in the generating end rather than the receiving end: `JSAny?` is supposed to be an unboxed value, not a boxed Dart value. In an ideal world we shouldn't be able to pass it as a Dart object. So we call `dartify` and convert it to a Dart object. This fixes DevTools when compiled to Wasm. Thanks to @eyebrowsoffire and @mkustermann for help with debugging. Co-authored-by: Kevin Moore <[email protected]>
- Loading branch information