Re: [whatwg/streams] Communication between workers/windows via Streams API (#244)

> Actually, where should the error-checking be for when someone further up the pipe chain enqueues chunks that contain things which can't be structured-cloned?

It's a good question. I think what would happen is that, as the browser reads the chunks in the background, it tries to structured clone. Any errors go to "report the exception" (i.e. fire an error event on the global scope; show up in the console). At that point we probably cancel the source readable stream, and make the readable stream on the other side of the boundary error.

> Would there be a third type besides default and "bytes", which will throw a TypeError if you try to controller.enqueue such a chunk, like how ReadableByteStreamController throws? And only that type of stream and byte streams are transferable?

That seems over-restrictive, and not really necessary. Also you can't really tell if something is cloneable until you try to clone it (e.g. it may have a throwing getter property). So we couldn't really perform this check until we're ready to do the clone/transfer.

---

The larger issue this might be considered blocked on is https://github.com/whatwg/html/issues/935; see in particular my comment https://github.com/whatwg/html/issues/935#issuecomment-246785244.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/streams/issues/244#issuecomment-257041201

Received on Friday, 28 October 2016 22:12:25 UTC