Re: [whatwg/streams] Specify ReadableStream.[[Transfer]] (#623)

> If you ignore the question of "so how does this work for Indexed DB's use of structured clone"

Can you elaborate? I'm not familiar with IndexedDB. This PR doesn't make streams cloneable anyway, trying to clone them is still an error as long as ReadableStream lacks a `[[Clone]]` internal method. They're still only transferable.

> This seems similar to the question of what happens if the underlyingSource calls controller.enqueue(somethingUncloneable). The answer is to error the destination stream, right?

Not necessarily.  Why should a `cloning` stream be errored, when `bytes` streams don't error the stream when you provide an unacceptable chunk either? You can just have `enqueue` throw if cloning/serializing to an Agent Record fails. If the underlyingSource doesn't catch the thrown DataCloneError, *then* the stream obviously gets errored.

And 'erroring the stream' still leaves the original question of what even to actually put in that storedError slot at all--

> With a TypeError of some kind I guess.

Right, that. Or a generic DataCloneError? We could attempt a StructuredClone of the error object actually, since it may or may not be uncloneable, and just place a DataCloneError in the slot if the clone attempt throws.

> Reflect.ownKeys

That I wasn't aware of, neat.

-- 
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/pull/623#issuecomment-265913714

Received on Friday, 9 December 2016 02:07:58 UTC