Re: [whatwg/streams] Support transferable streams (postMessage) (#1053)

@domenic approved this pull request.

LGTM; very nice.

We should work on getting a second implementer signoff, especially on the remaining open questions in #276.

> +
+  <p>The transferred stream can be used exactly like the original. Its [=readable side|readable=]
+  and [=writable sides=] will become locked and no longer directly usable.
+ </dd>
+</dl>
+
+<div algorithm="TransformStream transfer steps">
+ {{TransformStream}} objects are [=transferable objects=]. Their [=transfer steps=], given |value|
+ and |dataHolder|, are:
+
+ 1. Let |readable| be |value|.\[[readable]].
+ 1. Let |writable| be |value|.\[[writable]].
+ 1. If ! [$IsReadableStreamLocked$](|readable|) is true, throw a "{{DataCloneError}}"
+    {{DOMException}}.
+ 1. If ! [$IsWritableStreamLocked$](|writable|) is true, throw a "{{DataCloneError}}"
+    {{DOMException}}.

Adding these checks here, as opposed to delegating to transferring the readable and writable sides independently, avoids ending up with a "half-transferred" transform stream. That's nice :). I wonder if we should `<p class="note">` that? In either case we should be sure we have a test for it.

-- 
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/1053#pullrequestreview-448288025

Received on Tuesday, 14 July 2020 16:54:18 UTC