| OLD | NEW |
| (Empty) | |
| 1 'use strict'; |
| 2 |
| 3 if (self.importScripts) { |
| 4 self.importScripts('/resources/testharness.js'); |
| 5 self.importScripts('../resources/rs-utils.js'); |
| 6 } |
| 7 |
| 8 function duckTypedPassThroughTransform() { |
| 9 let enqueueInReadable; |
| 10 let closeReadable; |
| 11 |
| 12 return { |
| 13 writable: new WritableStream({ |
| 14 write(chunk) { |
| 15 enqueueInReadable(chunk); |
| 16 }, |
| 17 |
| 18 close() { |
| 19 closeReadable(); |
| 20 } |
| 21 }), |
| 22 |
| 23 readable: new ReadableStream({ |
| 24 start(c) { |
| 25 enqueueInReadable = c.enqueue.bind(c); |
| 26 closeReadable = c.close.bind(c); |
| 27 } |
| 28 }) |
| 29 }; |
| 30 } |
| 31 |
| 32 promise_test(() => { |
| 33 const readableEnd = sequentialReadableStream(5).pipeThrough(duckTypedPassThrou
ghTransform()); |
| 34 |
| 35 return readableStreamToArray(readableEnd).then(chunks => |
| 36 assert_array_equals(chunks, [1, 2, 3, 4, 5]), 'chunks should match'); |
| 37 }, 'Piping through a duck-typed pass-through transform stream should work'); |
| 38 |
| 39 done(); |
| OLD | NEW |