diff --git a/src/workerd/api/streams/common.h b/src/workerd/api/streams/common.h index 57c9e518c40..23ebfc16b0b 100644 --- a/src/workerd/api/streams/common.h +++ b/src/workerd/api/streams/common.h @@ -287,12 +287,12 @@ class ReadableStreamSource { }; struct PipeToOptions { - jsg::Optional preventClose; jsg::Optional preventAbort; jsg::Optional preventCancel; + jsg::Optional preventClose; jsg::Optional> signal; - JSG_STRUCT(preventClose, preventAbort, preventCancel, signal); + JSG_STRUCT(preventAbort, preventCancel, preventClose, signal); JSG_STRUCT_TS_OVERRIDE(StreamPipeOptions); // An additional, internal only property that is used to indicate diff --git a/src/workerd/api/streams/readable.h b/src/workerd/api/streams/readable.h index 8f227a1354c..769ae350873 100644 --- a/src/workerd/api/streams/readable.h +++ b/src/workerd/api/streams/readable.h @@ -267,10 +267,10 @@ class ReadableStream: public jsg::Object { returnFunction, ValuesOptions); struct Transform { - jsg::Ref writable; jsg::Ref readable; + jsg::Ref writable; - JSG_STRUCT(writable, readable); + JSG_STRUCT(readable, writable); JSG_STRUCT_TS_OVERRIDE(ReadableWritablePair { readable: ReadableStream; writable: WritableStream; diff --git a/src/wpt/streams-test.ts b/src/wpt/streams-test.ts index c90deb11ad2..012330d5d2b 100644 --- a/src/wpt/streams-test.ts +++ b/src/wpt/streams-test.ts @@ -85,25 +85,11 @@ export default { ], }, 'piping/pipe-through.any.js': { - comment: 'To be investigated', - expectedFailures: [ - "pipeThrough should brand-check readable and not allow 'null'", - "pipeThrough should brand-check readable and not allow 'undefined'", - "pipeThrough should brand-check readable and not allow '0'", - "pipeThrough should brand-check readable and not allow 'NaN'", - "pipeThrough should brand-check readable and not allow 'true'", - "pipeThrough should brand-check readable and not allow 'ReadableStream'", - "pipeThrough should brand-check readable and not allow '[object ReadableStream]'", - "pipeThrough should brand-check writable and not allow 'null'", - "pipeThrough should brand-check writable and not allow 'undefined'", - "pipeThrough should brand-check writable and not allow '0'", - "pipeThrough should brand-check writable and not allow 'NaN'", - "pipeThrough should brand-check writable and not allow 'true'", - "pipeThrough should brand-check writable and not allow 'WritableStream'", - "pipeThrough should brand-check writable and not allow '[object WritableStream]'", - 'pipeThrough should rethrow errors from accessing readable or writable', - 'pipeThrough() should throw if readable/writable getters throw', - ], + comment: 'Windows has different property access order', + expectedFailures: + process.platform === 'win32' + ? ['pipeThrough() should throw if readable/writable getters throw'] + : [], }, 'piping/then-interception.any.js': { comment: @@ -113,19 +99,7 @@ export default { 'tee should not be observable', ], }, - 'piping/throwing-options.any.js': { - comment: 'To be investigated', - expectedFailures: [ - 'pipeThrough should stop after getting preventAbort throws', - 'pipeThrough should stop after getting preventCancel throws', - 'pipeThrough should stop after getting preventClose throws', - 'pipeThrough should stop after getting signal throws', - 'pipeTo should stop after getting preventAbort throws', - 'pipeTo should stop after getting preventCancel throws', - 'pipeTo should stop after getting preventClose throws', - 'pipeTo should stop after getting signal throws', - ], - }, + 'piping/throwing-options.any.js': {}, 'piping/transform-streams.any.js': {}, 'queuing-strategies-size-function-per-global.window.js': { diff --git a/types/generated-snapshot/experimental/index.d.ts b/types/generated-snapshot/experimental/index.d.ts index 5861da6b2f7..71ad307077e 100755 --- a/types/generated-snapshot/experimental/index.d.ts +++ b/types/generated-snapshot/experimental/index.d.ts @@ -2641,6 +2641,8 @@ interface Transformer { expectedLength?: number; } interface StreamPipeOptions { + preventAbort?: boolean; + preventCancel?: boolean; /** * Pipes this readable stream to a given writable stream destination. The way in which the piping process behaves under various error conditions can be customized with a number of passed options. It returns a promise that fulfills when the piping process completes successfully, or rejects if any errors were encountered. * @@ -2659,8 +2661,6 @@ interface StreamPipeOptions { * The signal option can be set to an AbortSignal to allow aborting an ongoing pipe operation via the corresponding AbortController. In this case, this source readable stream will be canceled, and destination aborted, unless the respective options preventCancel or preventAbort are set. */ preventClose?: boolean; - preventAbort?: boolean; - preventCancel?: boolean; signal?: AbortSignal; } type ReadableStreamReadResult = @@ -2953,13 +2953,13 @@ declare abstract class TransformStreamDefaultController { terminate(): void; } interface ReadableWritablePair { + readable: ReadableStream; /** * Provides a convenient, chainable way of piping this readable stream through a transform stream (or any other { writable, readable } pair). It simply pipes the stream into the writable side of the supplied pair, and returns the readable side for further use. * * Piping a stream will lock it for the duration of the pipe, preventing any other consumer from acquiring a reader. */ writable: WritableStream; - readable: ReadableStream; } /** * The **`WritableStream`** interface of the Streams API provides a standard abstraction for writing streaming data to a destination, known as a sink. diff --git a/types/generated-snapshot/experimental/index.ts b/types/generated-snapshot/experimental/index.ts index d0e23b3181b..742fc36d2f9 100755 --- a/types/generated-snapshot/experimental/index.ts +++ b/types/generated-snapshot/experimental/index.ts @@ -2649,6 +2649,8 @@ export interface Transformer { expectedLength?: number; } export interface StreamPipeOptions { + preventAbort?: boolean; + preventCancel?: boolean; /** * Pipes this readable stream to a given writable stream destination. The way in which the piping process behaves under various error conditions can be customized with a number of passed options. It returns a promise that fulfills when the piping process completes successfully, or rejects if any errors were encountered. * @@ -2667,8 +2669,6 @@ export interface StreamPipeOptions { * The signal option can be set to an AbortSignal to allow aborting an ongoing pipe operation via the corresponding AbortController. In this case, this source readable stream will be canceled, and destination aborted, unless the respective options preventCancel or preventAbort are set. */ preventClose?: boolean; - preventAbort?: boolean; - preventCancel?: boolean; signal?: AbortSignal; } export type ReadableStreamReadResult = @@ -2961,13 +2961,13 @@ export declare abstract class TransformStreamDefaultController { terminate(): void; } export interface ReadableWritablePair { + readable: ReadableStream; /** * Provides a convenient, chainable way of piping this readable stream through a transform stream (or any other { writable, readable } pair). It simply pipes the stream into the writable side of the supplied pair, and returns the readable side for further use. * * Piping a stream will lock it for the duration of the pipe, preventing any other consumer from acquiring a reader. */ writable: WritableStream; - readable: ReadableStream; } /** * The **`WritableStream`** interface of the Streams API provides a standard abstraction for writing streaming data to a destination, known as a sink. diff --git a/types/generated-snapshot/latest/index.d.ts b/types/generated-snapshot/latest/index.d.ts index 52b72adfe5d..8ef2ca82c91 100755 --- a/types/generated-snapshot/latest/index.d.ts +++ b/types/generated-snapshot/latest/index.d.ts @@ -2545,6 +2545,8 @@ interface Transformer { expectedLength?: number; } interface StreamPipeOptions { + preventAbort?: boolean; + preventCancel?: boolean; /** * Pipes this readable stream to a given writable stream destination. The way in which the piping process behaves under various error conditions can be customized with a number of passed options. It returns a promise that fulfills when the piping process completes successfully, or rejects if any errors were encountered. * @@ -2563,8 +2565,6 @@ interface StreamPipeOptions { * The signal option can be set to an AbortSignal to allow aborting an ongoing pipe operation via the corresponding AbortController. In this case, this source readable stream will be canceled, and destination aborted, unless the respective options preventCancel or preventAbort are set. */ preventClose?: boolean; - preventAbort?: boolean; - preventCancel?: boolean; signal?: AbortSignal; } type ReadableStreamReadResult = @@ -2857,13 +2857,13 @@ declare abstract class TransformStreamDefaultController { terminate(): void; } interface ReadableWritablePair { + readable: ReadableStream; /** * Provides a convenient, chainable way of piping this readable stream through a transform stream (or any other { writable, readable } pair). It simply pipes the stream into the writable side of the supplied pair, and returns the readable side for further use. * * Piping a stream will lock it for the duration of the pipe, preventing any other consumer from acquiring a reader. */ writable: WritableStream; - readable: ReadableStream; } /** * The **`WritableStream`** interface of the Streams API provides a standard abstraction for writing streaming data to a destination, known as a sink. diff --git a/types/generated-snapshot/latest/index.ts b/types/generated-snapshot/latest/index.ts index e4773dbe76c..cc8ef8028f1 100755 --- a/types/generated-snapshot/latest/index.ts +++ b/types/generated-snapshot/latest/index.ts @@ -2553,6 +2553,8 @@ export interface Transformer { expectedLength?: number; } export interface StreamPipeOptions { + preventAbort?: boolean; + preventCancel?: boolean; /** * Pipes this readable stream to a given writable stream destination. The way in which the piping process behaves under various error conditions can be customized with a number of passed options. It returns a promise that fulfills when the piping process completes successfully, or rejects if any errors were encountered. * @@ -2571,8 +2573,6 @@ export interface StreamPipeOptions { * The signal option can be set to an AbortSignal to allow aborting an ongoing pipe operation via the corresponding AbortController. In this case, this source readable stream will be canceled, and destination aborted, unless the respective options preventCancel or preventAbort are set. */ preventClose?: boolean; - preventAbort?: boolean; - preventCancel?: boolean; signal?: AbortSignal; } export type ReadableStreamReadResult = @@ -2865,13 +2865,13 @@ export declare abstract class TransformStreamDefaultController { terminate(): void; } export interface ReadableWritablePair { + readable: ReadableStream; /** * Provides a convenient, chainable way of piping this readable stream through a transform stream (or any other { writable, readable } pair). It simply pipes the stream into the writable side of the supplied pair, and returns the readable side for further use. * * Piping a stream will lock it for the duration of the pipe, preventing any other consumer from acquiring a reader. */ writable: WritableStream; - readable: ReadableStream; } /** * The **`WritableStream`** interface of the Streams API provides a standard abstraction for writing streaming data to a destination, known as a sink.