Re: [whatwg/encoding] Make decode() and encodeInto() accept SharedArrayBuffer-backed views (#172)

> Node.js v14.15.5 does implement this, and it allows decoding text from shared views.

As far as I can tell, Node.js's implementation of both `TextDecoder.protoype.decode` and `TextEncoder.prototype.encodeInto` can be racy when the buffer source is backed by a SAB.

Deno doesn't support `TextEncoder.prototype.encodeInto` with a SAB-backed destination, but it does support `TextDecoder.prototype.decode` with a shared input – although this started out as a bug. Deno's JS<->Rust bindings layer doesn't yet support shared buffer sources, and will throw if passed one – but in JS we were making an unnecessary copy of the input before calling into Rust, and that copy was backed by a regular `ArrayBuffer`. [We then decided to keep that copy only for the shared case.](https://github.com/denoland/deno/pull/12573)

-- 
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/encoding/issues/172#issuecomment-1050838285

You are receiving this because you are subscribed to this thread.

Message ID: <whatwg/encoding/issues/172/1050838285@github.com>

Received on Friday, 25 February 2022 13:08:12 UTC