worker: use fake MessageEvent for port.onmessage
Instead of passing the payload for Workers directly to .onmessage
,
perform something more similar to what the browser API provides,
namely create an event object with a .data
property.
This does not make MessagePort
implement the EventTarget
API, nor
does it implement the full MessageEvent
API, but it would make
such extensions non-breaking changes if we desire them at
some point in the future.
(This would be a breaking change if Workers were not experimental. Currently, this method is also undocumented and only exists with the idea of enabling some degree of Web compatibility.)
Checklist
-
make -j4 test
(UNIX), orvcbuild test
(Windows) passes -
tests and/or benchmarks are included -
commit message follows commit guidelines