2 ms·
> For each message to be sent to or received from a worker we need to convert it to a string. Strange, according to MDN data sent to web workers needs only be
by zamalek 11y ago
> For each message to be sent to or received from a worker we need to convert it to a string.
Strange, according to MDN data sent to web workers needs only be deep clone-able[1]. Is this non-standard Gecko behavior?
> aMessage: This may be any value or JavaScript object handled by the structured clone algorithm, which includes cyclical references.
[1]: https://developer.mozilla.org/en-US/docs/Web/API/Worker/postMessage https://developer.mozilla.org/en-US/docs/Web/API/Worker/post...
- jwmerrill 11y agoUsing the structured clone algorithm for worker postMessage calls is standard: https://html.spec.whatwg.org/multipage/workers.html#communicating-with-a-dedicated-worker https://html.spec.whatwg.org/multipage/workers.html#communic...
- msoad 11y agoIt converts it to a string anyway.
- zamalek 11y agoGecko, at the very least, maintains cycles in the object graph. This is something that a naïve JSON round-trip can't do.