Fix JS value to Dart conversion when receiving from a web socket (dart-lang/web_socket_channel#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 <kevmoo@google.com>
2 files changed
tree: 28f8b62557d1373c38d06847ca703860c3a0726b
  1. pkgs/