From 41465f6c4e54af3a2e997224feefaebf14d8222b Mon Sep 17 00:00:00 2001 From: Mattias Buelens Date: Wed, 27 May 2020 00:36:20 +0200 Subject: [PATCH 01/15] Use official WebIDL for Streams --- inputfiles/addedTypes.json | 72 +++++++++ inputfiles/idl/Streams.widl | 274 ++++++++++++++++++-------------- inputfiles/overridingTypes.json | 225 +++++++++++++------------- inputfiles/removedTypes.json | 2 + 4 files changed, 340 insertions(+), 233 deletions(-) diff --git a/inputfiles/addedTypes.json b/inputfiles/addedTypes.json index 11433705e..90acc4b9e 100644 --- a/inputfiles/addedTypes.json +++ b/inputfiles/addedTypes.json @@ -2320,6 +2320,44 @@ } } } + }, + "ReadableStreamDefaultReadDoneResult": { + "name": "ReadableStreamDefaultReadDoneResult", + "members": { + "member": { + "done": { + "name": "done", + "override-type": "true", + "required": 1 + }, + "value": { + "name": "value", + "override-type": "undefined" + } + } + } + }, + "ReadableStreamDefaultReadValueResult": { + "name": "ReadableStreamDefaultReadValueResult", + "type-parameters": [ + { + "name": "T" + } + ], + "members": { + "member": { + "done": { + "name": "done", + "override-type": "false", + "required": 1 + }, + "value": { + "name": "value", + "override-type": "T", + "required": 1 + } + } + } } } }, @@ -2418,6 +2456,40 @@ "type": "ModuleImports" } ] + }, + { + "new-type": "ReadableStreamDefaultReadResult", + "type-parameters": [ + { + "name": "T" + } + ], + "type": [ + { + "type": "ReadableStreamDefaultReadValueResult" + }, + { + "type": "ReadableStreamDefaultReadDoneResult" + } + ], + "override-type": "ReadableStreamDefaultReadValueResult | ReadableStreamDefaultReadDoneResult" + }, + { + "new-type": "ReadableStreamReader", + "type-parameters": [ + { + "name": "T" + } + ], + "type": [ + { + "type": "ReadableStreamDefaultReader" + }, + { + "type": "ReadableStreamBYOBReader" + } + ], + "override-type": "ReadableStreamDefaultReader | ReadableStreamBYOBReader" } ] } diff --git a/inputfiles/idl/Streams.widl b/inputfiles/idl/Streams.widl index 040d5d503..315071d03 100644 --- a/inputfiles/idl/Streams.widl +++ b/inputfiles/idl/Streams.widl @@ -1,186 +1,216 @@ -[Constructor(optional UnderlyingSource underlyingSource, optional QueuingStrategy strategy), - Constructor(optional UnderlyingByteSource underlyingSource, optional QueuingStrategy strategy), - Exposed=(Window,Worker)] +[Exposed=(Window,Worker,Worklet), Transferable] interface ReadableStream { - readonly attribute boolean locked; - Promise cancel(optional any reason); - ReadableStreamBYOBReader getReader(any options); - ReadableStreamDefaultReader getReader(); - any pipeThrough(any pair, optional PipeOptions options); - Promise pipeTo(WritableStream dest, optional PipeOptions options); - [ReadableStream, ReadableStream] tee(); -}; + constructor(optional object underlyingSource, optional QueuingStrategy strategy = {}); -callback QueuingStrategySizeCallback = double (any chunk); + readonly attribute boolean locked; -dictionary QueuingStrategy { - unrestricted double? highWaterMark; - QueuingStrategySizeCallback? size; + Promise cancel(optional any reason); + ReadableStreamReader getReader(optional ReadableStreamGetReaderOptions options = {}); + ReadableStream pipeThrough(ReadableWritablePair transform, optional StreamPipeOptions options = {}); + Promise pipeTo(WritableStream destination, optional StreamPipeOptions options = {}); + sequence tee(); + + async iterable(optional ReadableStreamIteratorOptions options = {}); }; -callback ReadableByteStreamControllerCallback = any (ReadableByteStreamController controller); -callback ReadableStreamDefaultControllerCallback = any (ReadableStreamDefaultController controller); -callback ReadableStreamErrorCallback = any (any reason); +typedef (ReadableStreamDefaultReader or ReadableStreamBYOBReader) ReadableStreamReader; -dictionary UnderlyingSource { - ReadableStreamDefaultControllerCallback? start; - ReadableStreamDefaultControllerCallback? pull; - ReadableStreamErrorCallback? cancel; +enum ReadableStreamReaderMode { "byob" }; - any type; +dictionary ReadableStreamGetReaderOptions { + ReadableStreamReaderMode mode; }; -dictionary UnderlyingByteSource { - ReadableByteStreamControllerCallback? start; - ReadableByteStreamControllerCallback? pull; - ReadableStreamErrorCallback? cancel; - - required DOMString type; - unsigned long? autoAllocateChunkSize; +dictionary ReadableStreamIteratorOptions { + boolean preventCancel = false; }; -dictionary PipeOptions { - boolean? preventClose; - boolean? preventAbort; - boolean? preventCancel; - AbortSignal? signal; +dictionary ReadableWritablePair { + required ReadableStream readable; + required WritableStream writable; }; -dictionary ReadableStreamReadValueResult { - required boolean done; - required any value; +dictionary StreamPipeOptions { + boolean preventClose = false; + boolean preventAbort = false; + boolean preventCancel = false; + AbortSignal signal; }; -dictionary ReadableStreamReadDoneResult { - required boolean done; - any value; +dictionary UnderlyingSource { + UnderlyingSourceStartCallback start; + UnderlyingSourcePullCallback pull; + UnderlyingSourceCancelCallback cancel; + ReadableStreamType type; + [EnforceRange] unsigned long long autoAllocateChunkSize; }; -[Exposed=(Window,Worker)] -typedef (ReadableStreamReadValueResult or ReadableStreamReadDoneResult) ReadableStreamReadResult; +typedef (ReadableStreamDefaultController or ReadableByteStreamController) ReadableStreamController; + +callback UnderlyingSourceStartCallback = any (ReadableStreamController controller); +callback UnderlyingSourcePullCallback = Promise (ReadableStreamController controller); +callback UnderlyingSourceCancelCallback = Promise (optional any reason); + +enum ReadableStreamType { "bytes" }; + +interface mixin ReadableStreamGenericReader { + readonly attribute Promise closed; -[Exposed=(Window,Worker)] + Promise cancel(optional any reason); +}; + +[Exposed=(Window,Worker,Worklet)] interface ReadableStreamDefaultReader { - readonly attribute Promise closed; + constructor(ReadableStream stream); + + Promise read(); + undefined releaseLock(); +}; +ReadableStreamDefaultReader includes ReadableStreamGenericReader; - Promise cancel(optional any reason); - Promise read(); - void releaseLock(); +dictionary ReadableStreamDefaultReadResult { + any value; + boolean done; }; -[Exposed=(Window,Worker)] +[Exposed=(Window,Worker,Worklet)] interface ReadableStreamBYOBReader { - readonly attribute Promise closed; + constructor(ReadableStream stream); - Promise cancel(optional any reason); - Promise read(ArrayBufferView view); - void releaseLock(); + Promise read(ArrayBufferView view); + undefined releaseLock(); }; +ReadableStreamBYOBReader includes ReadableStreamGenericReader; -[Exposed=(Window,Worker)] +dictionary ReadableStreamBYOBReadResult { + ArrayBufferView value; + boolean done; +}; + +[Exposed=(Window,Worker,Worklet)] interface ReadableStreamDefaultController { - readonly attribute unrestricted double? desiredSize; + readonly attribute unrestricted double? desiredSize; - void close(); - void enqueue(any chunk); - void error(optional any error); + undefined close(); + undefined enqueue(optional any chunk); + undefined error(optional any e); }; -[Exposed=(Window,Worker)] +[Exposed=(Window,Worker,Worklet)] interface ReadableByteStreamController { - readonly attribute ReadableStreamBYOBRequest byobRequest; - readonly attribute unrestricted double? desiredSize; + readonly attribute ReadableStreamBYOBRequest? byobRequest; + readonly attribute unrestricted double? desiredSize; - void close(); - void enqueue(ArrayBufferView chunk); - void error(optional any error); + undefined close(); + undefined enqueue(ArrayBufferView chunk); + undefined error(optional any e); }; -[Exposed=(Window,Worker)] +[Exposed=(Window,Worker,Worklet)] interface ReadableStreamBYOBRequest { - readonly attribute ArrayBufferView view; + readonly attribute ArrayBufferView? view; - void respond(unsigned long bytesWritten); - void respondWithNewView(ArrayBufferView view); + undefined respond([EnforceRange] unsigned long long bytesWritten); + undefined respondWithNewView(ArrayBufferView view); }; -[Constructor(optional UnderlyingSink underlyingSink, optional QueuingStrategy strategy), - Exposed=(Window,Worker)] +[Exposed=(Window,Worker,Worklet), Transferable] interface WritableStream { - readonly attribute boolean locked; - Promise abort(optional any reason); - WritableStreamDefaultWriter getWriter(); -}; + constructor(optional object underlyingSink, optional QueuingStrategy strategy = {}); -callback WritableStreamDefaultControllerStartCallback = any (WritableStreamDefaultController controller); -callback WritableStreamDefaultControllerWriteCallback = any (any chunk, WritableStreamDefaultController controller); -callback WritableStreamDefaultControllerCloseCallback = any (); -callback WritableStreamErrorCallback = any (any reason); + readonly attribute boolean locked; -dictionary UnderlyingSink { - WritableStreamDefaultControllerStartCallback? start; - WritableStreamDefaultControllerWriteCallback? write; - WritableStreamDefaultControllerCloseCallback? close; - WritableStreamErrorCallback? abort; + Promise abort(optional any reason); + Promise close(); + WritableStreamDefaultWriter getWriter(); +}; - any type; +dictionary UnderlyingSink { + UnderlyingSinkStartCallback start; + UnderlyingSinkWriteCallback write; + UnderlyingSinkCloseCallback close; + UnderlyingSinkAbortCallback abort; + any type; }; -[Exposed=(Window,Worker)] +callback UnderlyingSinkStartCallback = any (WritableStreamDefaultController controller); +callback UnderlyingSinkWriteCallback = Promise (any chunk, WritableStreamDefaultController controller); +callback UnderlyingSinkCloseCallback = Promise (); +callback UnderlyingSinkAbortCallback = Promise (optional any reason); + +[Exposed=(Window,Worker,Worklet)] interface WritableStreamDefaultWriter { - readonly attribute Promise closed; - readonly attribute unrestricted double? desiredSize; - readonly attribute Promise ready; + constructor(WritableStream stream); + + readonly attribute Promise closed; + readonly attribute unrestricted double? desiredSize; + readonly attribute Promise ready; - Promise abort(optional any reason); - Promise close(); - void releaseLock(); - Promise write(any chunk); + Promise abort(optional any reason); + Promise close(); + undefined releaseLock(); + Promise write(optional any chunk); }; -[Exposed=(Window,Worker)] +[Exposed=(Window,Worker,Worklet)] interface WritableStreamDefaultController { - void error(optional any error); + undefined error(optional any e); }; -[Constructor(optional Transformer transformer, optional QueuingStrategy writableStrategy, optional QueuingStrategy readableStrategy), - Exposed=(Window,Worker)] +[Exposed=(Window,Worker,Worklet), Transferable] interface TransformStream { - readonly attribute ReadableStream readable; - readonly attribute WritableStream writable; -}; + constructor(optional object transformer, + optional QueuingStrategy writableStrategy = {}, + optional QueuingStrategy readableStrategy = {}); -callback TransformStreamDefaultControllerCallback = any (TransformStreamDefaultController controller); -callback TransformStreamDefaultControllerTransformCallback = any (any chunk, TransformStreamDefaultController controller); + readonly attribute ReadableStream readable; + readonly attribute WritableStream writable; +}; dictionary Transformer { - TransformStreamDefaultControllerCallback? start; - TransformStreamDefaultControllerTransformCallback? transform; - TransformStreamDefaultControllerCallback? flush; - - any readableType; - any writableType; + TransformerStartCallback start; + TransformerTransformCallback transform; + TransformerFlushCallback flush; + any readableType; + any writableType; }; -[Exposed=(Window,Worker)] +callback TransformerStartCallback = any (TransformStreamDefaultController controller); +callback TransformerFlushCallback = Promise (TransformStreamDefaultController controller); +callback TransformerTransformCallback = Promise (any chunk, TransformStreamDefaultController controller); + +[Exposed=(Window,Worker,Worklet)] interface TransformStreamDefaultController { - readonly attribute unrestricted double? desiredSize; + readonly attribute unrestricted double? desiredSize; - void enqueue(any chunk); - void error(optional any reason); - void terminate(); + undefined enqueue(optional any chunk); + undefined error(optional any reason); + undefined terminate(); }; -[Constructor(any options), - Exposed=(Window,Worker)] -interface ByteLengthQueuingStrategy: QueuingStrategy { - attribute unrestricted double highWaterMark; - double size(ArrayBufferView chunk); +dictionary QueuingStrategy { + unrestricted double highWaterMark; + QueuingStrategySize size; +}; + +callback QueuingStrategySize = unrestricted double (optional any chunk); + +dictionary QueuingStrategyInit { + required unrestricted double highWaterMark; }; -[Constructor(any options), - Exposed=(Window,Worker)] -interface CountQueuingStrategy: QueuingStrategy { - attribute unrestricted double highWaterMark; - double size(any chunk); +[Exposed=(Window,Worker,Worklet)] +interface ByteLengthQueuingStrategy { + constructor(QueuingStrategyInit init); + + readonly attribute unrestricted double highWaterMark; + readonly attribute Function size; +}; + +[Exposed=(Window,Worker,Worklet)] +interface CountQueuingStrategy { + constructor(QueuingStrategyInit init); + + readonly attribute unrestricted double highWaterMark; + readonly attribute Function size; }; diff --git a/inputfiles/overridingTypes.json b/inputfiles/overridingTypes.json index f77363efc..5452c66b3 100644 --- a/inputfiles/overridingTypes.json +++ b/inputfiles/overridingTypes.json @@ -214,7 +214,7 @@ "(event: Event | string, source?: string, lineno?: number, colno?: number, error?: Error): any" ] }, - "QueuingStrategySizeCallback": { + "QueuingStrategySize": { "type-parameters": [ { "name": "T", @@ -225,32 +225,37 @@ "(chunk: T): number" ] }, - "ReadableByteStreamControllerCallback": { + "UnderlyingSourceStartCallback": { + "type-parameters": [ + { + "name": "R" + } + ], "override-signatures": [ - "(controller: ReadableByteStreamController): void | PromiseLike" + "(controller: ReadableStreamController): void | PromiseLike" ] }, - "ReadableStreamDefaultControllerCallback": { + "UnderlyingSourcePullCallback": { "type-parameters": [ { "name": "R" } ], "override-signatures": [ - "(controller: ReadableStreamDefaultController): void | PromiseLike" + "(controller: ReadableStreamController): void | PromiseLike" ] }, - "ReadableStreamErrorCallback": { + "UnderlyingSourceCancelCallback": { "override-signatures": [ "(reason: any): void | PromiseLike" ] }, - "WritableStreamDefaultControllerStartCallback": { + "UnderlyingSinkStartCallback": { "override-signatures": [ "(controller: WritableStreamDefaultController): void | PromiseLike" ] }, - "WritableStreamDefaultControllerWriteCallback": { + "UnderlyingSinkWriteCallback": { "type-parameters": [ { "name": "W" @@ -260,12 +265,12 @@ "(chunk: W, controller: WritableStreamDefaultController): void | PromiseLike" ] }, - "WritableStreamDefaultControllerCloseCallback": { + "UnderlyingSinkCloseCallback": { "override-signatures": [ "(): void | PromiseLike" ] }, - "WritableStreamErrorCallback": { + "UnderlyingSinkAbortCallback": { "override-signatures": [ "(reason: any): void | PromiseLike" ] @@ -2215,8 +2220,24 @@ } ], "constructor": { + "signature": [ + { + "type": "ReadableStream", + "param": [ + { + "name": "underlyingSource", + "type": "UnderlyingSource", + "optional": 1 + }, + { + "name": "strategy", + "type": "QueuingStrategy", + "optional": 1 + } + ] + } + ], "override-signatures": [ - "new(underlyingSource: UnderlyingByteSource, strategy?: { highWaterMark?: number, size?: undefined }): ReadableStream", "new(underlyingSource?: UnderlyingSource, strategy?: QueuingStrategy): ReadableStream" ] }, @@ -2225,17 +2246,18 @@ "getReader": { "override-signatures": [ "getReader(options: { mode: \"byob\" }): ReadableStreamBYOBReader", - "getReader(): ReadableStreamDefaultReader" + "getReader(): ReadableStreamDefaultReader", + "getReader(options?: ReadableStreamGetReaderOptions): ReadableStreamReader" ] }, "pipeThrough": { "override-signatures": [ - "pipeThrough({ writable, readable }: { writable: WritableStream, readable: ReadableStream }, options?: PipeOptions): ReadableStream" + "pipeThrough(transform: ReadableWritablePair, options?: StreamPipeOptions): ReadableStream" ] }, "pipeTo": { "override-signatures": [ - "pipeTo(dest: WritableStream, options?: PipeOptions): Promise" + "pipeTo(dest: WritableStream, options?: StreamPipeOptions): Promise" ] }, "tee": { @@ -2246,30 +2268,12 @@ } } }, - "ReadableStreamReader": { - "override-exposed": "Window Worker", - "type-parameters": [ - { - "name": "R", - "default": "any" - } - ], - "methods": { - "method": { - "read": { - "override-signatures": [ - "read(): Promise>" - ] - } - } - } - }, "ReadableStreamBYOBReader": { "methods": { "method": { "read": { "override-signatures": [ - "read(view: T): Promise>" + "read(view: T): Promise>" ] } } @@ -2286,21 +2290,12 @@ "method": { "read": { "override-signatures": [ - "read(): Promise>" + "read(): Promise>" ] } } } }, - "ReadableByteStreamController": { - "properties": { - "property": { - "byobRequest": { - "override-type": "ReadableStreamBYOBRequest | undefined" - } - } - } - }, "ReadableStreamDefaultController": { "type-parameters": [ { @@ -2320,6 +2315,23 @@ }, "WritableStream": { "constructor": { + "signature": [ + { + "type": "WritableStream", + "param": [ + { + "name": "underlyingSink", + "type": "UnderlyingSink", + "optional": 1 + }, + { + "name": "strategy", + "type": "QueuingStrategy", + "optional": 1 + } + ] + } + ], "override-signatures": [ "new(underlyingSink?: UnderlyingSink, strategy?: QueuingStrategy): WritableStream" ] @@ -2379,6 +2391,28 @@ } }, "constructor": { + "signature": [ + { + "type": "TransformStream", + "param": [ + { + "name": "transformer", + "type": "Transformer", + "optional": 1 + }, + { + "name": "writableStrategy", + "type": "QueuingStrategy", + "optional": 1 + }, + { + "name": "readableStrategy", + "type": "QueuingStrategy", + "optional": 1 + } + ] + } + ], "override-signatures": [ "new(transformer?: Transformer, writableStrategy?: QueuingStrategy, readableStrategy?: QueuingStrategy): TransformStream" ] @@ -2403,23 +2437,25 @@ }, "ByteLengthQueuingStrategy": { "extends": "QueuingStrategy", - "constructor": { - "override-signatures": [ - "new(options: { highWaterMark: number }): ByteLengthQueuingStrategy" - ] + "properties": { + "property": { + "size": { + "name": "size", + "override-type": [ + "QueuingStrategySize" + ] + } + } } }, "CountQueuingStrategy": { - "constructor": { - "override-signatures": [ - "new(options: { highWaterMark: number }): CountQueuingStrategy" - ] - }, - "methods": { - "method": { + "extends": "QueuingStrategy", + "properties": { + "property": { "size": { - "override-signatures": [ - "size(chunk: any): 1" + "name": "size", + "override-type": [ + "QueuingStrategySize" ] } } @@ -2781,24 +2817,6 @@ "[property: string]: string | number | null | undefined" ] }, - "PipeOptions": { - "members": { - "member": { - "preventClose": { - "nullable": 0 - }, - "preventAbort": { - "nullable": 0 - }, - "preventCancel": { - "nullable": 0 - }, - "signal": { - "nullable": 0 - } - } - } - }, "PublicKeyCredentialCreationOptions": { "members": { "member": { @@ -2853,22 +2871,24 @@ "nullable": 0 }, "size": { - "override-type": "QueuingStrategySizeCallback", + "override-type": "QueuingStrategySize", "nullable": 0 } } } }, - "ReadableStreamReadDoneResult": { + "ReadableStreamBYOBReadResult": { "type-parameters": [ { - "name": "T" + "name": "T", + "extends": "ArrayBufferView", + "default": "ArrayBufferView" } ], "members": { "member": { "done": { - "override-type": "true" + "required": 1 }, "value": { "override-type": "T" @@ -2876,40 +2896,26 @@ } } }, - "ReadableStreamReadValueResult": { + "ReadableWritablePair": { "type-parameters": [ { - "name": "T" + "name": "R", + "default": "any" + }, + { + "name": "W", + "default": "any" } ], "members": { "member": { - "done": { - "override-type": "false" - }, - "value": { - "override-type": "T" - } - } - } - }, - "UnderlyingByteSource": { - "members": { - "member": { - "start": { - "nullable": 0 - }, - "pull": { - "nullable": 0 - }, - "cancel": { + "readable": { + "override-type": "ReadableStream", "nullable": 0 }, - "autoAllocateChunkSize": { + "writable": { + "override-type": "WritableStream", "nullable": 0 - }, - "type": { - "override-type": "\"bytes\"" } } } @@ -2924,18 +2930,15 @@ "members": { "member": { "start": { - "override-type": "ReadableStreamDefaultControllerCallback", + "override-type": "UnderlyingSourceStartCallback", "nullable": 0 }, "pull": { - "override-type": "ReadableStreamDefaultControllerCallback", + "override-type": "UnderlyingSourcePullCallback", "nullable": 0 }, "cancel": { "nullable": 0 - }, - "type": { - "override-type": "undefined" } } } @@ -2953,7 +2956,7 @@ "nullable": 0 }, "write": { - "override-type": "WritableStreamDefaultControllerWriteCallback", + "override-type": "UnderlyingSinkWriteCallback", "nullable": 0 }, "close": { @@ -3071,8 +3074,8 @@ "new-type": "BodyInit" }, { - "override-type": "ReadableStreamReadValueResult | ReadableStreamReadDoneResult", - "new-type": "ReadableStreamReadResult", + "override-type": "ReadableStreamDefaultController | ReadableByteStreamController", + "new-type": "ReadableStreamController", "type-parameters": [ { "name": "T" diff --git a/inputfiles/removedTypes.json b/inputfiles/removedTypes.json index 4c96cf08c..02bbeee02 100644 --- a/inputfiles/removedTypes.json +++ b/inputfiles/removedTypes.json @@ -246,6 +246,7 @@ "PasswordCredential": null, "Position": null, "PositionError": null, + "ReadableStreamReader": null, "RTCDataChannel": { "properties": { "property": { @@ -406,6 +407,7 @@ } }, "ObjectURLOptions": null, + "ReadableStreamDefaultReadResult": null, "RTCIceGatherOptions": { "members": { "member": { From 5b9448a35ec155de046a41857e43fbfee38327c4 Mon Sep 17 00:00:00 2001 From: Mattias Buelens Date: Tue, 28 Jul 2020 23:02:53 +0200 Subject: [PATCH 02/15] Add type parameter to ReadableStreamDefaultReader constructor --- inputfiles/overridingTypes.json | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/inputfiles/overridingTypes.json b/inputfiles/overridingTypes.json index 5452c66b3..cacdf49f1 100644 --- a/inputfiles/overridingTypes.json +++ b/inputfiles/overridingTypes.json @@ -2286,6 +2286,11 @@ "default": "any" } ], + "constructor": { + "override-signatures": [ + "new(stream: ReadableStream): ReadableStreamDefaultReader" + ] + }, "methods": { "method": { "read": { From 5217aef2da9560c34900cc93ae17f07561e160c4 Mon Sep 17 00:00:00 2001 From: Mattias Buelens Date: Tue, 28 Jul 2020 23:13:27 +0200 Subject: [PATCH 03/15] Add type parameter to WritableStreamDefaultWriter constructor --- inputfiles/overridingTypes.json | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/inputfiles/overridingTypes.json b/inputfiles/overridingTypes.json index cacdf49f1..0bb004866 100644 --- a/inputfiles/overridingTypes.json +++ b/inputfiles/overridingTypes.json @@ -2364,6 +2364,11 @@ "default": "any" } ], + "constructor": { + "override-signatures": [ + "new(stream: WritableStream): WritableStreamDefaultWriter" + ] + }, "methods": { "method": { "write": { From 6f3b76021b3e8339c1fb770f74c2ce8b44c8ef18 Mon Sep 17 00:00:00 2001 From: Mattias Buelens Date: Tue, 28 Jul 2020 23:08:28 +0200 Subject: [PATCH 04/15] Remove async iterator on ReadableStream for now --- inputfiles/removedTypes.json | 3 +++ 1 file changed, 3 insertions(+) diff --git a/inputfiles/removedTypes.json b/inputfiles/removedTypes.json index 02bbeee02..d65786ef1 100644 --- a/inputfiles/removedTypes.json +++ b/inputfiles/removedTypes.json @@ -246,6 +246,9 @@ "PasswordCredential": null, "Position": null, "PositionError": null, + "ReadableStream": { + "iterator": null + }, "ReadableStreamReader": null, "RTCDataChannel": { "properties": { From f12b48cb9eee18a78bbc312e0085feea9929553f Mon Sep 17 00:00:00 2001 From: Mattias Buelens Date: Tue, 28 Jul 2020 23:15:47 +0200 Subject: [PATCH 05/15] Remove support for "local" IDLs from idlfetcher --- src/idlfetcher.ts | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/idlfetcher.ts b/src/idlfetcher.ts index 05ea14340..146cac2e3 100644 --- a/src/idlfetcher.ts +++ b/src/idlfetcher.ts @@ -10,7 +10,6 @@ interface IDLSource { url: string; title: string; deprecated?: boolean; - local?: boolean; } const idlSelector = [ @@ -30,9 +29,6 @@ async function fetchIDLs(filter: string[]) { const idlSources = (require("../inputfiles/idlSources.json") as IDLSource[]) .filter(source => !filter.length || filter.includes(source.title)); await Promise.all(idlSources.map(async source => { - if (source.local) { - return; - } const { idl, comments } = await fetchIDL(source); fs.writeFileSync(path.join(__dirname, `../inputfiles/idl/${source.title}.widl`), idl + '\n'); if (comments) { From 42995a57dd001898861ddf9cdbf6140c63ef5945 Mon Sep 17 00:00:00 2001 From: Mattias Buelens Date: Tue, 28 Jul 2020 23:27:12 +0200 Subject: [PATCH 06/15] Fix Transformer callbacks --- inputfiles/overridingTypes.json | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/inputfiles/overridingTypes.json b/inputfiles/overridingTypes.json index 0bb004866..13e4ad2dc 100644 --- a/inputfiles/overridingTypes.json +++ b/inputfiles/overridingTypes.json @@ -275,7 +275,7 @@ "(reason: any): void | PromiseLike" ] }, - "TransformStreamDefaultControllerCallback": { + "TransformerFlushCallback": { "type-parameters": [ { "name": "O" @@ -285,7 +285,17 @@ "(controller: TransformStreamDefaultController): void | PromiseLike" ] }, - "TransformStreamDefaultControllerTransformCallback": { + "TransformerStartCallback": { + "type-parameters": [ + { + "name": "O" + } + ], + "override-signatures": [ + "(controller: TransformStreamDefaultController): void | PromiseLike" + ] + }, + "TransformerTransformCallback": { "type-parameters": [ { "name": "I" @@ -3004,15 +3014,15 @@ "members": { "member": { "start": { - "override-type": "TransformStreamDefaultControllerCallback", + "override-type": "TransformerStartCallback", "nullable": 0 }, "transform": { - "override-type": "TransformStreamDefaultControllerTransformCallback", + "override-type": "TransformerTransformCallback", "nullable": 0 }, "flush": { - "override-type": "TransformStreamDefaultControllerCallback", + "override-type": "TransformerFlushCallback", "nullable": 0 }, "readableType": { From 407dc4514fd6ba4212d6e371390a66de566dd9a0 Mon Sep 17 00:00:00 2001 From: Mattias Buelens Date: Wed, 29 Jul 2020 00:00:41 +0200 Subject: [PATCH 07/15] Move TextDecoder/EncoderStream modifications to overridingTypes --- inputfiles/addedTypes.json | 32 -------------------------------- inputfiles/overridingTypes.json | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+), 32 deletions(-) diff --git a/inputfiles/addedTypes.json b/inputfiles/addedTypes.json index 90acc4b9e..fd523f244 100644 --- a/inputfiles/addedTypes.json +++ b/inputfiles/addedTypes.json @@ -2166,38 +2166,6 @@ ] } }, - "TextDecoderStream": { - "properties": { - "property": { - "readable": { - "name": "readable", - "read-only": 1, - "override-type": "ReadableStream" - }, - "writable": { - "name": "writable", - "read-only": 1, - "override-type": "WritableStream" - } - } - } - }, - "TextEncoderStream": { - "properties": { - "property": { - "readable": { - "name": "readable", - "read-only": 1, - "override-type": "ReadableStream" - }, - "writable": { - "name": "writable", - "read-only": 1, - "override-type": "WritableStream" - } - } - } - }, "Attr": { "name": "Attr", "properties": { diff --git a/inputfiles/overridingTypes.json b/inputfiles/overridingTypes.json index 13e4ad2dc..b5de698e9 100644 --- a/inputfiles/overridingTypes.json +++ b/inputfiles/overridingTypes.json @@ -2481,6 +2481,38 @@ } } }, + "TextDecoderStream": { + "properties": { + "property": { + "readable": { + "name": "readable", + "read-only": 1, + "override-type": "ReadableStream" + }, + "writable": { + "name": "writable", + "read-only": 1, + "override-type": "WritableStream" + } + } + } + }, + "TextEncoderStream": { + "properties": { + "property": { + "readable": { + "name": "readable", + "read-only": 1, + "override-type": "ReadableStream" + }, + "writable": { + "name": "writable", + "read-only": 1, + "override-type": "WritableStream" + } + } + } + }, "Permissions": { "methods": { "method": { From 323609099e9be89eac024f229d8c3671073698d1 Mon Sep 17 00:00:00 2001 From: Mattias Buelens Date: Wed, 29 Jul 2020 00:06:50 +0200 Subject: [PATCH 08/15] Use "force-references" in constructor overrides --- inputfiles/overridingTypes.json | 80 ++++++++++----------------------- 1 file changed, 24 insertions(+), 56 deletions(-) diff --git a/inputfiles/overridingTypes.json b/inputfiles/overridingTypes.json index b5de698e9..b0d706612 100644 --- a/inputfiles/overridingTypes.json +++ b/inputfiles/overridingTypes.json @@ -2230,25 +2230,16 @@ } ], "constructor": { - "signature": [ - { - "type": "ReadableStream", - "param": [ - { - "name": "underlyingSource", - "type": "UnderlyingSource", - "optional": 1 - }, - { - "name": "strategy", - "type": "QueuingStrategy", - "optional": 1 - } - ] - } - ], "override-signatures": [ "new(underlyingSource?: UnderlyingSource, strategy?: QueuingStrategy): ReadableStream" + ], + "force-references": [ + { + "type": "UnderlyingSource" + }, + { + "type": "QueuingStrategy" + } ] }, "methods": { @@ -2330,25 +2321,16 @@ }, "WritableStream": { "constructor": { - "signature": [ - { - "type": "WritableStream", - "param": [ - { - "name": "underlyingSink", - "type": "UnderlyingSink", - "optional": 1 - }, - { - "name": "strategy", - "type": "QueuingStrategy", - "optional": 1 - } - ] - } - ], "override-signatures": [ "new(underlyingSink?: UnderlyingSink, strategy?: QueuingStrategy): WritableStream" + ], + "force-references": [ + { + "type": "UnderlyingSink" + }, + { + "type": "QueuingStrategy" + } ] }, "type-parameters": [ @@ -2411,30 +2393,16 @@ } }, "constructor": { - "signature": [ - { - "type": "TransformStream", - "param": [ - { - "name": "transformer", - "type": "Transformer", - "optional": 1 - }, - { - "name": "writableStrategy", - "type": "QueuingStrategy", - "optional": 1 - }, - { - "name": "readableStrategy", - "type": "QueuingStrategy", - "optional": 1 - } - ] - } - ], "override-signatures": [ "new(transformer?: Transformer, writableStrategy?: QueuingStrategy, readableStrategy?: QueuingStrategy): TransformStream" + ], + "force-references": [ + { + "type": "Transformer" + }, + { + "type": "QueuingStrategy" + } ] } }, From 77a265e5233230e80b64349c85772d7d9caca7ec Mon Sep 17 00:00:00 2001 From: Mattias Buelens Date: Sat, 26 Sep 2020 22:03:32 +0200 Subject: [PATCH 09/15] Remove obsolete nullable overrides --- inputfiles/overridingTypes.json | 42 +++++++-------------------------- 1 file changed, 9 insertions(+), 33 deletions(-) diff --git a/inputfiles/overridingTypes.json b/inputfiles/overridingTypes.json index b0d706612..02c3f7e1a 100644 --- a/inputfiles/overridingTypes.json +++ b/inputfiles/overridingTypes.json @@ -2887,12 +2887,8 @@ ], "members": { "member": { - "highWaterMark": { - "nullable": 0 - }, "size": { - "override-type": "QueuingStrategySize", - "nullable": 0 + "override-type": "QueuingStrategySize" } } } @@ -2930,12 +2926,10 @@ "members": { "member": { "readable": { - "override-type": "ReadableStream", - "nullable": 0 + "override-type": "ReadableStream" }, "writable": { - "override-type": "WritableStream", - "nullable": 0 + "override-type": "WritableStream" } } } @@ -2950,15 +2944,10 @@ "members": { "member": { "start": { - "override-type": "UnderlyingSourceStartCallback", - "nullable": 0 + "override-type": "UnderlyingSourceStartCallback" }, "pull": { - "override-type": "UnderlyingSourcePullCallback", - "nullable": 0 - }, - "cancel": { - "nullable": 0 + "override-type": "UnderlyingSourcePullCallback" } } } @@ -2972,18 +2961,8 @@ ], "members": { "member": { - "start": { - "nullable": 0 - }, "write": { - "override-type": "UnderlyingSinkWriteCallback", - "nullable": 0 - }, - "close": { - "nullable": 0 - }, - "abort": { - "nullable": 0 + "override-type": "UnderlyingSinkWriteCallback" }, "type": { "override-type": "undefined" @@ -3014,16 +2993,13 @@ "members": { "member": { "start": { - "override-type": "TransformerStartCallback", - "nullable": 0 + "override-type": "TransformerStartCallback" }, "transform": { - "override-type": "TransformerTransformCallback", - "nullable": 0 + "override-type": "TransformerTransformCallback" }, "flush": { - "override-type": "TransformerFlushCallback", - "nullable": 0 + "override-type": "TransformerFlushCallback" }, "readableType": { "override-type": "undefined" From 3e95eeeb8df6f5dd56f45a0841e5ad09c591ca77 Mon Sep 17 00:00:00 2001 From: Mattias Buelens Date: Sat, 26 Sep 2020 22:12:11 +0200 Subject: [PATCH 10/15] Update baselines --- baselines/dom.generated.d.ts | 214 +++++++++++++++++------------ baselines/webworker.generated.d.ts | 214 +++++++++++++++++------------ 2 files changed, 256 insertions(+), 172 deletions(-) diff --git a/baselines/dom.generated.d.ts b/baselines/dom.generated.d.ts index 2db5c6695..2d7042ca7 100644 --- a/baselines/dom.generated.d.ts +++ b/baselines/dom.generated.d.ts @@ -1023,13 +1023,6 @@ interface PermissionDescriptor { name: PermissionName; } -interface PipeOptions { - preventAbort?: boolean; - preventCancel?: boolean; - preventClose?: boolean; - signal?: AbortSignal; -} - interface PointerEventInit extends MouseEventInit { height?: number; isPrimary?: boolean; @@ -1138,7 +1131,16 @@ interface PushSubscriptionOptionsInit { interface QueuingStrategy { highWaterMark?: number; - size?: QueuingStrategySizeCallback; + size?: QueuingStrategySize; +} + +interface QueuingStrategyInit { + /** + * Creates a new ByteLengthQueuingStrategy with the provided high water mark. + * + * Note that the provided high water mark will not be validated ahead of time. Instead, if it is negative, NaN, or not a number, the resulting ByteLengthQueuingStrategy will cause the corresponding stream constructor to throw. + */ + highWaterMark: number; } interface RTCAnswerOptions extends RTCOfferAnswerOptions { @@ -1516,16 +1518,40 @@ interface RTCTransportStats extends RTCStats { selectedCandidatePairId?: string; } -interface ReadableStreamReadDoneResult { - done: true; +interface ReadableStreamBYOBReadResult { + done: boolean; value?: T; } -interface ReadableStreamReadValueResult { +interface ReadableStreamDefaultReadDoneResult { + done: true; + value?: undefined; +} + +interface ReadableStreamDefaultReadValueResult { done: false; value: T; } +interface ReadableStreamGetReaderOptions { + /** + * Creates a ReadableStreamBYOBReader and locks the stream to the new reader. + * + * This call behaves the same way as the no-argument variant, except that it only works on readable byte streams, i.e. streams which were constructed specifically with the ability to handle "bring your own buffer" reading. The returned BYOB reader provides the ability to directly read individual chunks from the stream via its read() method, into developer-supplied buffers, allowing more precise control over allocation. + */ + mode?: ReadableStreamReaderMode; +} + +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; +} + interface RegistrationOptions { scope?: string; type?: WorkerType; @@ -1746,6 +1772,30 @@ interface StoreSiteSpecificExceptionsInformation extends StoreExceptionsInformat arrayOfDomainStrings?: string[]; } +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. + * + * Piping a stream will lock it for the duration of the pipe, preventing any other consumer from acquiring a reader. + * + * Errors and closures of the source and destination streams propagate as follows: + * + * An error in this source readable stream will abort destination, unless preventAbort is truthy. The returned promise will be rejected with the source's error, or with any error that occurs during aborting the destination. + * + * An error in destination will cancel this source readable stream, unless preventCancel is truthy. The returned promise will be rejected with the destination's error, or with any error that occurs during canceling the source. + * + * When this source readable stream closes, destination will be closed, unless preventCancel is truthy. The returned promise will be fulfilled once this process completes, unless an error is encountered while closing the destination, in which case it will be rejected with that error. + * + * If destination starts out closed or closing, this source readable stream will be canceled, unless preventCancel is true. The returned promise will be rejected with an error indicating piping to a closed stream failed, or with any error that occurs during canceling the source. + * + * 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; + signal?: AbortSignal; +} + interface TextDecodeOptions { stream?: boolean; } @@ -1789,10 +1839,10 @@ interface TrackEventInit extends EventInit { } interface Transformer { - flush?: TransformStreamDefaultControllerCallback; + flush?: TransformerFlushCallback; readableType?: undefined; - start?: TransformStreamDefaultControllerCallback; - transform?: TransformStreamDefaultControllerTransformCallback; + start?: TransformerStartCallback; + transform?: TransformerTransformCallback; writableType?: undefined; } @@ -1812,27 +1862,20 @@ interface ULongRange { min?: number; } -interface UnderlyingByteSource { - autoAllocateChunkSize?: number; - cancel?: ReadableStreamErrorCallback; - pull?: ReadableByteStreamControllerCallback; - start?: ReadableByteStreamControllerCallback; - type: "bytes"; -} - interface UnderlyingSink { - abort?: WritableStreamErrorCallback; - close?: WritableStreamDefaultControllerCloseCallback; - start?: WritableStreamDefaultControllerStartCallback; + abort?: UnderlyingSinkAbortCallback; + close?: UnderlyingSinkCloseCallback; + start?: UnderlyingSinkStartCallback; type?: undefined; - write?: WritableStreamDefaultControllerWriteCallback; + write?: UnderlyingSinkWriteCallback; } interface UnderlyingSource { - cancel?: ReadableStreamErrorCallback; - pull?: ReadableStreamDefaultControllerCallback; - start?: ReadableStreamDefaultControllerCallback; - type?: undefined; + autoAllocateChunkSize?: number; + cancel?: UnderlyingSourceCancelCallback; + pull?: UnderlyingSourcePullCallback; + start?: UnderlyingSourceStartCallback; + type?: ReadableStreamType; } interface VRDisplayEventInit extends EventInit { @@ -2563,13 +2606,13 @@ declare var BroadcastChannel: { /** This Streams API interface provides a built-in byte length queuing strategy that can be used when constructing streams. */ interface ByteLengthQueuingStrategy extends QueuingStrategy { - highWaterMark: number; - size(chunk: ArrayBufferView): number; + readonly highWaterMark: number; + readonly size: QueuingStrategySize; } declare var ByteLengthQueuingStrategy: { prototype: ByteLengthQueuingStrategy; - new(options: { highWaterMark: number }): ByteLengthQueuingStrategy; + new(init: QueuingStrategyInit): ByteLengthQueuingStrategy; }; /** A CDATA section that can be used within XML to include extended portions of unescaped text. The symbols < and & don’t need escaping as they normally do when inside a CDATA section. */ @@ -3614,13 +3657,13 @@ declare var ConvolverNode: { /** This Streams API interface provides a built-in byte length queuing strategy that can be used when constructing streams. */ interface CountQueuingStrategy extends QueuingStrategy { - highWaterMark: number; - size(chunk: any): 1; + readonly highWaterMark: number; + readonly size: QueuingStrategySize; } declare var CountQueuingStrategy: { prototype: CountQueuingStrategy; - new(options: { highWaterMark: number }): CountQueuingStrategy; + new(init: QueuingStrategyInit): CountQueuingStrategy; }; interface Credential { @@ -12473,11 +12516,11 @@ declare var Range: { }; interface ReadableByteStreamController { - readonly byobRequest: ReadableStreamBYOBRequest | undefined; + readonly byobRequest: ReadableStreamBYOBRequest | null; readonly desiredSize: number | null; close(): void; enqueue(chunk: ArrayBufferView): void; - error(error?: any): void; + error(e?: any): void; } declare var ReadableByteStreamController: { @@ -12491,31 +12534,29 @@ interface ReadableStream { cancel(reason?: any): Promise; getReader(options: { mode: "byob" }): ReadableStreamBYOBReader; getReader(): ReadableStreamDefaultReader; - pipeThrough({ writable, readable }: { writable: WritableStream, readable: ReadableStream }, options?: PipeOptions): ReadableStream; - pipeTo(dest: WritableStream, options?: PipeOptions): Promise; + getReader(options?: ReadableStreamGetReaderOptions): ReadableStreamReader; + pipeThrough(transform: ReadableWritablePair, options?: StreamPipeOptions): ReadableStream; + pipeTo(dest: WritableStream, options?: StreamPipeOptions): Promise; tee(): [ReadableStream, ReadableStream]; } declare var ReadableStream: { prototype: ReadableStream; - new(underlyingSource: UnderlyingByteSource, strategy?: { highWaterMark?: number, size?: undefined }): ReadableStream; new(underlyingSource?: UnderlyingSource, strategy?: QueuingStrategy): ReadableStream; }; -interface ReadableStreamBYOBReader { - readonly closed: Promise; - cancel(reason?: any): Promise; - read(view: T): Promise>; +interface ReadableStreamBYOBReader extends ReadableStreamGenericReader { + read(view: T): Promise>; releaseLock(): void; } declare var ReadableStreamBYOBReader: { prototype: ReadableStreamBYOBReader; - new(): ReadableStreamBYOBReader; + new(stream: ReadableStream): ReadableStreamBYOBReader; }; interface ReadableStreamBYOBRequest { - readonly view: ArrayBufferView; + readonly view: ArrayBufferView | null; respond(bytesWritten: number): void; respondWithNewView(view: ArrayBufferView): void; } @@ -12529,7 +12570,7 @@ interface ReadableStreamDefaultController { readonly desiredSize: number | null; close(): void; enqueue(chunk: R): void; - error(error?: any): void; + error(e?: any): void; } declare var ReadableStreamDefaultController: { @@ -12537,29 +12578,21 @@ declare var ReadableStreamDefaultController: { new(): ReadableStreamDefaultController; }; -interface ReadableStreamDefaultReader { - readonly closed: Promise; - cancel(reason?: any): Promise; - read(): Promise>; +interface ReadableStreamDefaultReader extends ReadableStreamGenericReader { + read(): Promise>; releaseLock(): void; } declare var ReadableStreamDefaultReader: { prototype: ReadableStreamDefaultReader; - new(): ReadableStreamDefaultReader; + new(stream: ReadableStream): ReadableStreamDefaultReader; }; -interface ReadableStreamReader { - cancel(): Promise; - read(): Promise>; - releaseLock(): void; +interface ReadableStreamGenericReader { + readonly closed: Promise; + cancel(reason?: any): Promise; } -declare var ReadableStreamReader: { - prototype: ReadableStreamReader; - new(): ReadableStreamReader; -}; - /** This Fetch API interface represents a resource request. */ interface Request extends Body { /** @@ -18688,6 +18721,7 @@ declare var Worklet: { interface WritableStream { readonly locked: boolean; abort(reason?: any): Promise; + close(): Promise; getWriter(): WritableStreamDefaultWriter; } @@ -18698,7 +18732,7 @@ declare var WritableStream: { /** This Streams API interface represents a controller allowing control of a WritableStream's state. When constructing a WritableStream, the underlying sink is given a corresponding WritableStreamDefaultController instance to manipulate. */ interface WritableStreamDefaultController { - error(error?: any): void; + error(e?: any): void; } declare var WritableStreamDefaultController: { @@ -18708,9 +18742,9 @@ declare var WritableStreamDefaultController: { /** This Streams API interface is the object returned by WritableStream.getWriter() and once created locks the < writer to the WritableStream ensuring that no other streams can write to the underlying sink. */ interface WritableStreamDefaultWriter { - readonly closed: Promise; + readonly closed: Promise; readonly desiredSize: number | null; - readonly ready: Promise; + readonly ready: Promise; abort(reason?: any): Promise; close(): Promise; releaseLock(): void; @@ -18719,7 +18753,7 @@ interface WritableStreamDefaultWriter { declare var WritableStreamDefaultWriter: { prototype: WritableStreamDefaultWriter; - new(): WritableStreamDefaultWriter; + new(stream: WritableStream): WritableStreamDefaultWriter; }; /** An XML document. It inherits from the generic Document and does not add any specific methods or properties to it: nevertheless, several algorithms behave differently with the two types of documents. */ @@ -19231,7 +19265,7 @@ interface PositionErrorCallback { (positionError: GeolocationPositionError): void; } -interface QueuingStrategySizeCallback { +interface QueuingStrategySize { (chunk: T): number; } @@ -19247,46 +19281,50 @@ interface RTCStatsCallback { (report: RTCStatsReport): void; } -interface ReadableByteStreamControllerCallback { - (controller: ReadableByteStreamController): void | PromiseLike; -} - -interface ReadableStreamDefaultControllerCallback { - (controller: ReadableStreamDefaultController): void | PromiseLike; -} - -interface ReadableStreamErrorCallback { - (reason: any): void | PromiseLike; +interface TransformerFlushCallback { + (controller: TransformStreamDefaultController): void | PromiseLike; } -interface TransformStreamDefaultControllerCallback { +interface TransformerStartCallback { (controller: TransformStreamDefaultController): void | PromiseLike; } -interface TransformStreamDefaultControllerTransformCallback { +interface TransformerTransformCallback { (chunk: I, controller: TransformStreamDefaultController): void | PromiseLike; } -interface VoidFunction { - (): void; +interface UnderlyingSinkAbortCallback { + (reason: any): void | PromiseLike; } -interface WritableStreamDefaultControllerCloseCallback { +interface UnderlyingSinkCloseCallback { (): void | PromiseLike; } -interface WritableStreamDefaultControllerStartCallback { +interface UnderlyingSinkStartCallback { (controller: WritableStreamDefaultController): void | PromiseLike; } -interface WritableStreamDefaultControllerWriteCallback { +interface UnderlyingSinkWriteCallback { (chunk: W, controller: WritableStreamDefaultController): void | PromiseLike; } -interface WritableStreamErrorCallback { +interface UnderlyingSourceCancelCallback { (reason: any): void | PromiseLike; } +interface UnderlyingSourcePullCallback { + (controller: ReadableStreamController): void | PromiseLike; +} + +interface UnderlyingSourceStartCallback { + (controller: ReadableStreamController): void | PromiseLike; +} + +interface VoidFunction { + (): void; +} + interface HTMLElementTagNameMap { "a": HTMLAnchorElement; "abbr": HTMLElement; @@ -19936,7 +19974,8 @@ type ConstrainDouble = number | ConstrainDoubleRange; type ConstrainBoolean = boolean | ConstrainBooleanParameters; type ConstrainDOMString = string | string[] | ConstrainDOMStringParameters; type PerformanceEntryList = PerformanceEntry[]; -type ReadableStreamReadResult = ReadableStreamReadValueResult | ReadableStreamReadDoneResult; +type ReadableStreamReader = ReadableStreamDefaultReader | ReadableStreamBYOBReader; +type ReadableStreamController = ReadableStreamDefaultController | ReadableByteStreamController; type VibratePattern = number | number[]; type COSEAlgorithmIdentifier = number; type UvmEntry = number[]; @@ -19975,6 +20014,7 @@ type RTCTransport = RTCDtlsTransport | RTCSrtpSdesTransport; /** @deprecated */ type MouseWheelEvent = WheelEvent; type WindowProxy = Window; +type ReadableStreamDefaultReadResult = ReadableStreamDefaultReadValueResult | ReadableStreamDefaultReadDoneResult; type AlignSetting = "center" | "end" | "left" | "right" | "start"; type AnimationPlayState = "finished" | "idle" | "paused" | "running"; type AppendMode = "segments" | "sequence"; @@ -20083,6 +20123,8 @@ type RTCSignalingState = "closed" | "have-local-offer" | "have-local-pranswer" | type RTCStatsIceCandidatePairState = "cancelled" | "failed" | "frozen" | "inprogress" | "succeeded" | "waiting"; type RTCStatsIceCandidateType = "host" | "peerreflexive" | "relayed" | "serverreflexive"; type RTCStatsType = "candidatepair" | "datachannel" | "inboundrtp" | "localcandidate" | "outboundrtp" | "remotecandidate" | "session" | "track" | "transport"; +type ReadableStreamReaderMode = "byob"; +type ReadableStreamType = "bytes"; type ReadyState = "closed" | "ended" | "open"; type ReferrerPolicy = "" | "no-referrer" | "no-referrer-when-downgrade" | "origin" | "origin-when-cross-origin" | "same-origin" | "strict-origin" | "strict-origin-when-cross-origin" | "unsafe-url"; type RequestCache = "default" | "force-cache" | "no-cache" | "no-store" | "only-if-cached" | "reload"; diff --git a/baselines/webworker.generated.d.ts b/baselines/webworker.generated.d.ts index f24219da5..a5fe73629 100644 --- a/baselines/webworker.generated.d.ts +++ b/baselines/webworker.generated.d.ts @@ -334,13 +334,6 @@ interface PermissionDescriptor { name: PermissionName; } -interface PipeOptions { - preventAbort?: boolean; - preventCancel?: boolean; - preventClose?: boolean; - signal?: AbortSignal; -} - interface PostMessageOptions { transfer?: any[]; } @@ -383,19 +376,52 @@ interface PushSubscriptionOptionsInit { interface QueuingStrategy { highWaterMark?: number; - size?: QueuingStrategySizeCallback; + size?: QueuingStrategySize; } -interface ReadableStreamReadDoneResult { - done: true; +interface QueuingStrategyInit { + /** + * Creates a new ByteLengthQueuingStrategy with the provided high water mark. + * + * Note that the provided high water mark will not be validated ahead of time. Instead, if it is negative, NaN, or not a number, the resulting ByteLengthQueuingStrategy will cause the corresponding stream constructor to throw. + */ + highWaterMark: number; +} + +interface ReadableStreamBYOBReadResult { + done: boolean; value?: T; } -interface ReadableStreamReadValueResult { +interface ReadableStreamDefaultReadDoneResult { + done: true; + value?: undefined; +} + +interface ReadableStreamDefaultReadValueResult { done: false; value: T; } +interface ReadableStreamGetReaderOptions { + /** + * Creates a ReadableStreamBYOBReader and locks the stream to the new reader. + * + * This call behaves the same way as the no-argument variant, except that it only works on readable byte streams, i.e. streams which were constructed specifically with the ability to handle "bring your own buffer" reading. The returned BYOB reader provides the ability to directly read individual chunks from the stream via its read() method, into developer-supplied buffers, allowing more precise control over allocation. + */ + mode?: ReadableStreamReaderMode; +} + +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; +} + interface RegistrationOptions { scope?: string; type?: WorkerType; @@ -495,6 +521,30 @@ interface StorageEstimate { usage?: 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. + * + * Piping a stream will lock it for the duration of the pipe, preventing any other consumer from acquiring a reader. + * + * Errors and closures of the source and destination streams propagate as follows: + * + * An error in this source readable stream will abort destination, unless preventAbort is truthy. The returned promise will be rejected with the source's error, or with any error that occurs during aborting the destination. + * + * An error in destination will cancel this source readable stream, unless preventCancel is truthy. The returned promise will be rejected with the destination's error, or with any error that occurs during canceling the source. + * + * When this source readable stream closes, destination will be closed, unless preventCancel is truthy. The returned promise will be fulfilled once this process completes, unless an error is encountered while closing the destination, in which case it will be rejected with that error. + * + * If destination starts out closed or closing, this source readable stream will be canceled, unless preventCancel is true. The returned promise will be rejected with an error indicating piping to a closed stream failed, or with any error that occurs during canceling the source. + * + * 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; + signal?: AbortSignal; +} + interface SyncEventInit extends ExtendableEventInit { lastChance?: boolean; tag: string; @@ -515,34 +565,27 @@ interface TextEncoderEncodeIntoResult { } interface Transformer { - flush?: TransformStreamDefaultControllerCallback; + flush?: TransformerFlushCallback; readableType?: undefined; - start?: TransformStreamDefaultControllerCallback; - transform?: TransformStreamDefaultControllerTransformCallback; + start?: TransformerStartCallback; + transform?: TransformerTransformCallback; writableType?: undefined; } -interface UnderlyingByteSource { - autoAllocateChunkSize?: number; - cancel?: ReadableStreamErrorCallback; - pull?: ReadableByteStreamControllerCallback; - start?: ReadableByteStreamControllerCallback; - type: "bytes"; -} - interface UnderlyingSink { - abort?: WritableStreamErrorCallback; - close?: WritableStreamDefaultControllerCloseCallback; - start?: WritableStreamDefaultControllerStartCallback; + abort?: UnderlyingSinkAbortCallback; + close?: UnderlyingSinkCloseCallback; + start?: UnderlyingSinkStartCallback; type?: undefined; - write?: WritableStreamDefaultControllerWriteCallback; + write?: UnderlyingSinkWriteCallback; } interface UnderlyingSource { - cancel?: ReadableStreamErrorCallback; - pull?: ReadableStreamDefaultControllerCallback; - start?: ReadableStreamDefaultControllerCallback; - type?: undefined; + autoAllocateChunkSize?: number; + cancel?: UnderlyingSourceCancelCallback; + pull?: UnderlyingSourcePullCallback; + start?: UnderlyingSourceStartCallback; + type?: ReadableStreamType; } interface WebGLContextAttributes { @@ -701,13 +744,13 @@ declare var BroadcastChannel: { /** This Streams API interface provides a built-in byte length queuing strategy that can be used when constructing streams. */ interface ByteLengthQueuingStrategy extends QueuingStrategy { - highWaterMark: number; - size(chunk: ArrayBufferView): number; + readonly highWaterMark: number; + readonly size: QueuingStrategySize; } declare var ByteLengthQueuingStrategy: { prototype: ByteLengthQueuingStrategy; - new(options: { highWaterMark: number }): ByteLengthQueuingStrategy; + new(init: QueuingStrategyInit): ByteLengthQueuingStrategy; }; /** Provides a storage mechanism for Request / Response object pairs that are cached, for example as part of the ServiceWorker life cycle. Note that the Cache interface is exposed to windowed scopes as well as workers. You don't have to use it in conjunction with service workers, even though it is defined in the service worker spec. */ @@ -941,13 +984,13 @@ interface ConcatParams extends Algorithm { /** This Streams API interface provides a built-in byte length queuing strategy that can be used when constructing streams. */ interface CountQueuingStrategy extends QueuingStrategy { - highWaterMark: number; - size(chunk: any): 1; + readonly highWaterMark: number; + readonly size: QueuingStrategySize; } declare var CountQueuingStrategy: { prototype: CountQueuingStrategy; - new(options: { highWaterMark: number }): CountQueuingStrategy; + new(init: QueuingStrategyInit): CountQueuingStrategy; }; /** Basic cryptography features available in the current context. It allows access to a cryptographically strong random number generator and to cryptographic primitives. */ @@ -2708,11 +2751,11 @@ declare var PushSubscriptionOptions: { }; interface ReadableByteStreamController { - readonly byobRequest: ReadableStreamBYOBRequest | undefined; + readonly byobRequest: ReadableStreamBYOBRequest | null; readonly desiredSize: number | null; close(): void; enqueue(chunk: ArrayBufferView): void; - error(error?: any): void; + error(e?: any): void; } declare var ReadableByteStreamController: { @@ -2726,31 +2769,29 @@ interface ReadableStream { cancel(reason?: any): Promise; getReader(options: { mode: "byob" }): ReadableStreamBYOBReader; getReader(): ReadableStreamDefaultReader; - pipeThrough({ writable, readable }: { writable: WritableStream, readable: ReadableStream }, options?: PipeOptions): ReadableStream; - pipeTo(dest: WritableStream, options?: PipeOptions): Promise; + getReader(options?: ReadableStreamGetReaderOptions): ReadableStreamReader; + pipeThrough(transform: ReadableWritablePair, options?: StreamPipeOptions): ReadableStream; + pipeTo(dest: WritableStream, options?: StreamPipeOptions): Promise; tee(): [ReadableStream, ReadableStream]; } declare var ReadableStream: { prototype: ReadableStream; - new(underlyingSource: UnderlyingByteSource, strategy?: { highWaterMark?: number, size?: undefined }): ReadableStream; new(underlyingSource?: UnderlyingSource, strategy?: QueuingStrategy): ReadableStream; }; -interface ReadableStreamBYOBReader { - readonly closed: Promise; - cancel(reason?: any): Promise; - read(view: T): Promise>; +interface ReadableStreamBYOBReader extends ReadableStreamGenericReader { + read(view: T): Promise>; releaseLock(): void; } declare var ReadableStreamBYOBReader: { prototype: ReadableStreamBYOBReader; - new(): ReadableStreamBYOBReader; + new(stream: ReadableStream): ReadableStreamBYOBReader; }; interface ReadableStreamBYOBRequest { - readonly view: ArrayBufferView; + readonly view: ArrayBufferView | null; respond(bytesWritten: number): void; respondWithNewView(view: ArrayBufferView): void; } @@ -2764,7 +2805,7 @@ interface ReadableStreamDefaultController { readonly desiredSize: number | null; close(): void; enqueue(chunk: R): void; - error(error?: any): void; + error(e?: any): void; } declare var ReadableStreamDefaultController: { @@ -2772,29 +2813,21 @@ declare var ReadableStreamDefaultController: { new(): ReadableStreamDefaultController; }; -interface ReadableStreamDefaultReader { - readonly closed: Promise; - cancel(reason?: any): Promise; - read(): Promise>; +interface ReadableStreamDefaultReader extends ReadableStreamGenericReader { + read(): Promise>; releaseLock(): void; } declare var ReadableStreamDefaultReader: { prototype: ReadableStreamDefaultReader; - new(): ReadableStreamDefaultReader; + new(stream: ReadableStream): ReadableStreamDefaultReader; }; -interface ReadableStreamReader { - cancel(): Promise; - read(): Promise>; - releaseLock(): void; +interface ReadableStreamGenericReader { + readonly closed: Promise; + cancel(reason?: any): Promise; } -declare var ReadableStreamReader: { - prototype: ReadableStreamReader; - new(): ReadableStreamReader; -}; - /** This Fetch API interface represents a resource request. */ interface Request extends Body { /** @@ -5529,6 +5562,7 @@ declare var WorkerNavigator: { interface WritableStream { readonly locked: boolean; abort(reason?: any): Promise; + close(): Promise; getWriter(): WritableStreamDefaultWriter; } @@ -5539,7 +5573,7 @@ declare var WritableStream: { /** This Streams API interface represents a controller allowing control of a WritableStream's state. When constructing a WritableStream, the underlying sink is given a corresponding WritableStreamDefaultController instance to manipulate. */ interface WritableStreamDefaultController { - error(error?: any): void; + error(e?: any): void; } declare var WritableStreamDefaultController: { @@ -5549,9 +5583,9 @@ declare var WritableStreamDefaultController: { /** This Streams API interface is the object returned by WritableStream.getWriter() and once created locks the < writer to the WritableStream ensuring that no other streams can write to the underlying sink. */ interface WritableStreamDefaultWriter { - readonly closed: Promise; + readonly closed: Promise; readonly desiredSize: number | null; - readonly ready: Promise; + readonly ready: Promise; abort(reason?: any): Promise; close(): Promise; releaseLock(): void; @@ -5560,7 +5594,7 @@ interface WritableStreamDefaultWriter { declare var WritableStreamDefaultWriter: { prototype: WritableStreamDefaultWriter; - new(): WritableStreamDefaultWriter; + new(stream: WritableStream): WritableStreamDefaultWriter; }; interface XMLHttpRequestEventMap extends XMLHttpRequestEventTargetEventMap { @@ -5856,50 +5890,54 @@ interface PerformanceObserverCallback { (entries: PerformanceObserverEntryList, observer: PerformanceObserver): void; } -interface QueuingStrategySizeCallback { +interface QueuingStrategySize { (chunk: T): number; } -interface ReadableByteStreamControllerCallback { - (controller: ReadableByteStreamController): void | PromiseLike; -} - -interface ReadableStreamDefaultControllerCallback { - (controller: ReadableStreamDefaultController): void | PromiseLike; -} - -interface ReadableStreamErrorCallback { - (reason: any): void | PromiseLike; +interface TransformerFlushCallback { + (controller: TransformStreamDefaultController): void | PromiseLike; } -interface TransformStreamDefaultControllerCallback { +interface TransformerStartCallback { (controller: TransformStreamDefaultController): void | PromiseLike; } -interface TransformStreamDefaultControllerTransformCallback { +interface TransformerTransformCallback { (chunk: I, controller: TransformStreamDefaultController): void | PromiseLike; } -interface VoidFunction { - (): void; +interface UnderlyingSinkAbortCallback { + (reason: any): void | PromiseLike; } -interface WritableStreamDefaultControllerCloseCallback { +interface UnderlyingSinkCloseCallback { (): void | PromiseLike; } -interface WritableStreamDefaultControllerStartCallback { +interface UnderlyingSinkStartCallback { (controller: WritableStreamDefaultController): void | PromiseLike; } -interface WritableStreamDefaultControllerWriteCallback { +interface UnderlyingSinkWriteCallback { (chunk: W, controller: WritableStreamDefaultController): void | PromiseLike; } -interface WritableStreamErrorCallback { +interface UnderlyingSourceCancelCallback { (reason: any): void | PromiseLike; } +interface UnderlyingSourcePullCallback { + (controller: ReadableStreamController): void | PromiseLike; +} + +interface UnderlyingSourceStartCallback { + (controller: ReadableStreamController): void | PromiseLike; +} + +interface VoidFunction { + (): void; +} + /** * Returns dedicatedWorkerGlobal's name, i.e. the value given to the Worker constructor. Primarily useful for debugging. */ @@ -5977,7 +6015,8 @@ type OnErrorEventHandler = OnErrorEventHandlerNonNull | null; type TimerHandler = string | Function; type PerformanceEntryList = PerformanceEntry[]; type PushMessageDataInit = BufferSource | string; -type ReadableStreamReadResult = ReadableStreamReadValueResult | ReadableStreamReadDoneResult; +type ReadableStreamReader = ReadableStreamDefaultReader | ReadableStreamBYOBReader; +type ReadableStreamController = ReadableStreamDefaultController | ReadableByteStreamController; type VibratePattern = number | number[]; type AlgorithmIdentifier = string | Algorithm; type HashAlgorithmIdentifier = AlgorithmIdentifier; @@ -6004,6 +6043,7 @@ type DOMTimeStamp = number; type FormDataEntryValue = File | string; type IDBValidKey = number | string | Date | BufferSource | IDBArrayKey; type Transferable = ArrayBuffer | MessagePort | ImageBitmap | OffscreenCanvas; +type ReadableStreamDefaultReadResult = ReadableStreamDefaultReadValueResult | ReadableStreamDefaultReadDoneResult; type BinaryType = "arraybuffer" | "blob"; type CanvasDirection = "inherit" | "ltr" | "rtl"; type CanvasFillRule = "evenodd" | "nonzero"; @@ -6031,6 +6071,8 @@ type PermissionState = "denied" | "granted" | "prompt"; type PremultiplyAlpha = "default" | "none" | "premultiply"; type PushEncryptionKeyName = "auth" | "p256dh"; type PushPermissionState = "denied" | "granted" | "prompt"; +type ReadableStreamReaderMode = "byob"; +type ReadableStreamType = "bytes"; type ReferrerPolicy = "" | "no-referrer" | "no-referrer-when-downgrade" | "origin" | "origin-when-cross-origin" | "same-origin" | "strict-origin" | "strict-origin-when-cross-origin" | "unsafe-url"; type RequestCache = "default" | "force-cache" | "no-cache" | "no-store" | "only-if-cached" | "reload"; type RequestCredentials = "include" | "omit" | "same-origin"; From 990b7aa091f6ed59a7b73dd41647f1e35d8a1176 Mon Sep 17 00:00:00 2001 From: Mattias Buelens Date: Thu, 10 Sep 2020 23:22:24 +0200 Subject: [PATCH 11/15] Remove WritableStream.close --- inputfiles/removedTypes.json | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/inputfiles/removedTypes.json b/inputfiles/removedTypes.json index d65786ef1..fb1c188cb 100644 --- a/inputfiles/removedTypes.json +++ b/inputfiles/removedTypes.json @@ -388,6 +388,13 @@ "WindowConsole" ] }, + "WritableStream": { + "methods": { + "method": { + "close": null + } + } + }, "XPathNSResolver": null } }, From 3e6fcae3f4d050d7b44e6a256e522c9184b69514 Mon Sep 17 00:00:00 2001 From: Mattias Buelens Date: Tue, 28 Jul 2020 22:58:38 +0200 Subject: [PATCH 12/15] Remove types for readable byte streams --- inputfiles/addedTypes.json | 5 +---- inputfiles/overridingTypes.json | 39 +++++---------------------------- inputfiles/removedTypes.json | 14 ++++++++++++ 3 files changed, 20 insertions(+), 38 deletions(-) diff --git a/inputfiles/addedTypes.json b/inputfiles/addedTypes.json index fd523f244..50946b01c 100644 --- a/inputfiles/addedTypes.json +++ b/inputfiles/addedTypes.json @@ -2452,12 +2452,9 @@ "type": [ { "type": "ReadableStreamDefaultReader" - }, - { - "type": "ReadableStreamBYOBReader" } ], - "override-type": "ReadableStreamDefaultReader | ReadableStreamBYOBReader" + "override-type": "ReadableStreamDefaultReader" } ] } diff --git a/inputfiles/overridingTypes.json b/inputfiles/overridingTypes.json index 02c3f7e1a..98ec807ec 100644 --- a/inputfiles/overridingTypes.json +++ b/inputfiles/overridingTypes.json @@ -2246,9 +2246,7 @@ "method": { "getReader": { "override-signatures": [ - "getReader(options: { mode: \"byob\" }): ReadableStreamBYOBReader", - "getReader(): ReadableStreamDefaultReader", - "getReader(options?: ReadableStreamGetReaderOptions): ReadableStreamReader" + "getReader(): ReadableStreamDefaultReader" ] }, "pipeThrough": { @@ -2269,17 +2267,6 @@ } } }, - "ReadableStreamBYOBReader": { - "methods": { - "method": { - "read": { - "override-signatures": [ - "read(view: T): Promise>" - ] - } - } - } - }, "ReadableStreamDefaultReader": { "type-parameters": [ { @@ -2893,25 +2880,6 @@ } } }, - "ReadableStreamBYOBReadResult": { - "type-parameters": [ - { - "name": "T", - "extends": "ArrayBufferView", - "default": "ArrayBufferView" - } - ], - "members": { - "member": { - "done": { - "required": 1 - }, - "value": { - "override-type": "T" - } - } - } - }, "ReadableWritablePair": { "type-parameters": [ { @@ -2948,6 +2916,9 @@ }, "pull": { "override-type": "UnderlyingSourcePullCallback" + }, + "type": { + "override-type": "undefined" } } } @@ -3070,7 +3041,7 @@ "new-type": "BodyInit" }, { - "override-type": "ReadableStreamDefaultController | ReadableByteStreamController", + "override-type": "ReadableStreamDefaultController", "new-type": "ReadableStreamController", "type-parameters": [ { diff --git a/inputfiles/removedTypes.json b/inputfiles/removedTypes.json index fb1c188cb..bf8284db9 100644 --- a/inputfiles/removedTypes.json +++ b/inputfiles/removedTypes.json @@ -59,6 +59,8 @@ "enums": { "enum": { "ClientType": null, + "ReadableStreamReaderMode": null, + "ReadableStreamType": null, "RequestType": null } }, @@ -246,9 +248,12 @@ "PasswordCredential": null, "Position": null, "PositionError": null, + "ReadableByteStreamController": null, "ReadableStream": { "iterator": null }, + "ReadableStreamBYOBReader": null, + "ReadableStreamBYOBRequest": null, "ReadableStreamReader": null, "RTCDataChannel": { "properties": { @@ -417,13 +422,22 @@ } }, "ObjectURLOptions": null, + "ReadableStreamBYOBReadResult": null, "ReadableStreamDefaultReadResult": null, + "ReadableStreamGetReaderOptions": null, "RTCIceGatherOptions": { "members": { "member": { "portRange": null } } + }, + "UnderlyingSource": { + "members": { + "member": { + "autoAllocateChunkSize": null + } + } } } }, From 7aa6a4b9ec51b53a04885c5202aa8e2b0e40661c Mon Sep 17 00:00:00 2001 From: Mattias Buelens Date: Tue, 29 Sep 2020 21:35:23 +0200 Subject: [PATCH 13/15] Update baselines --- baselines/dom.generated.d.ts | 60 ++---------------------------- baselines/webworker.generated.d.ts | 60 ++---------------------------- 2 files changed, 6 insertions(+), 114 deletions(-) diff --git a/baselines/dom.generated.d.ts b/baselines/dom.generated.d.ts index 2d7042ca7..5f04ad46c 100644 --- a/baselines/dom.generated.d.ts +++ b/baselines/dom.generated.d.ts @@ -1518,11 +1518,6 @@ interface RTCTransportStats extends RTCStats { selectedCandidatePairId?: string; } -interface ReadableStreamBYOBReadResult { - done: boolean; - value?: T; -} - interface ReadableStreamDefaultReadDoneResult { done: true; value?: undefined; @@ -1533,15 +1528,6 @@ interface ReadableStreamDefaultReadValueResult { value: T; } -interface ReadableStreamGetReaderOptions { - /** - * Creates a ReadableStreamBYOBReader and locks the stream to the new reader. - * - * This call behaves the same way as the no-argument variant, except that it only works on readable byte streams, i.e. streams which were constructed specifically with the ability to handle "bring your own buffer" reading. The returned BYOB reader provides the ability to directly read individual chunks from the stream via its read() method, into developer-supplied buffers, allowing more precise control over allocation. - */ - mode?: ReadableStreamReaderMode; -} - interface ReadableWritablePair { readable: ReadableStream; /** @@ -1871,11 +1857,10 @@ interface UnderlyingSink { } interface UnderlyingSource { - autoAllocateChunkSize?: number; cancel?: UnderlyingSourceCancelCallback; pull?: UnderlyingSourcePullCallback; start?: UnderlyingSourceStartCallback; - type?: ReadableStreamType; + type?: undefined; } interface VRDisplayEventInit extends EventInit { @@ -12515,26 +12500,11 @@ declare var Range: { toString(): string; }; -interface ReadableByteStreamController { - readonly byobRequest: ReadableStreamBYOBRequest | null; - readonly desiredSize: number | null; - close(): void; - enqueue(chunk: ArrayBufferView): void; - error(e?: any): void; -} - -declare var ReadableByteStreamController: { - prototype: ReadableByteStreamController; - new(): ReadableByteStreamController; -}; - /** This Streams API interface represents a readable stream of byte data. The Fetch API offers a concrete instance of a ReadableStream through the body property of a Response object. */ interface ReadableStream { readonly locked: boolean; cancel(reason?: any): Promise; - getReader(options: { mode: "byob" }): ReadableStreamBYOBReader; getReader(): ReadableStreamDefaultReader; - getReader(options?: ReadableStreamGetReaderOptions): ReadableStreamReader; pipeThrough(transform: ReadableWritablePair, options?: StreamPipeOptions): ReadableStream; pipeTo(dest: WritableStream, options?: StreamPipeOptions): Promise; tee(): [ReadableStream, ReadableStream]; @@ -12545,27 +12515,6 @@ declare var ReadableStream: { new(underlyingSource?: UnderlyingSource, strategy?: QueuingStrategy): ReadableStream; }; -interface ReadableStreamBYOBReader extends ReadableStreamGenericReader { - read(view: T): Promise>; - releaseLock(): void; -} - -declare var ReadableStreamBYOBReader: { - prototype: ReadableStreamBYOBReader; - new(stream: ReadableStream): ReadableStreamBYOBReader; -}; - -interface ReadableStreamBYOBRequest { - readonly view: ArrayBufferView | null; - respond(bytesWritten: number): void; - respondWithNewView(view: ArrayBufferView): void; -} - -declare var ReadableStreamBYOBRequest: { - prototype: ReadableStreamBYOBRequest; - new(): ReadableStreamBYOBRequest; -}; - interface ReadableStreamDefaultController { readonly desiredSize: number | null; close(): void; @@ -18721,7 +18670,6 @@ declare var Worklet: { interface WritableStream { readonly locked: boolean; abort(reason?: any): Promise; - close(): Promise; getWriter(): WritableStreamDefaultWriter; } @@ -19974,8 +19922,8 @@ type ConstrainDouble = number | ConstrainDoubleRange; type ConstrainBoolean = boolean | ConstrainBooleanParameters; type ConstrainDOMString = string | string[] | ConstrainDOMStringParameters; type PerformanceEntryList = PerformanceEntry[]; -type ReadableStreamReader = ReadableStreamDefaultReader | ReadableStreamBYOBReader; -type ReadableStreamController = ReadableStreamDefaultController | ReadableByteStreamController; +type ReadableStreamReader = ReadableStreamDefaultReader; +type ReadableStreamController = ReadableStreamDefaultController; type VibratePattern = number | number[]; type COSEAlgorithmIdentifier = number; type UvmEntry = number[]; @@ -20123,8 +20071,6 @@ type RTCSignalingState = "closed" | "have-local-offer" | "have-local-pranswer" | type RTCStatsIceCandidatePairState = "cancelled" | "failed" | "frozen" | "inprogress" | "succeeded" | "waiting"; type RTCStatsIceCandidateType = "host" | "peerreflexive" | "relayed" | "serverreflexive"; type RTCStatsType = "candidatepair" | "datachannel" | "inboundrtp" | "localcandidate" | "outboundrtp" | "remotecandidate" | "session" | "track" | "transport"; -type ReadableStreamReaderMode = "byob"; -type ReadableStreamType = "bytes"; type ReadyState = "closed" | "ended" | "open"; type ReferrerPolicy = "" | "no-referrer" | "no-referrer-when-downgrade" | "origin" | "origin-when-cross-origin" | "same-origin" | "strict-origin" | "strict-origin-when-cross-origin" | "unsafe-url"; type RequestCache = "default" | "force-cache" | "no-cache" | "no-store" | "only-if-cached" | "reload"; diff --git a/baselines/webworker.generated.d.ts b/baselines/webworker.generated.d.ts index a5fe73629..eacfdc4eb 100644 --- a/baselines/webworker.generated.d.ts +++ b/baselines/webworker.generated.d.ts @@ -388,11 +388,6 @@ interface QueuingStrategyInit { highWaterMark: number; } -interface ReadableStreamBYOBReadResult { - done: boolean; - value?: T; -} - interface ReadableStreamDefaultReadDoneResult { done: true; value?: undefined; @@ -403,15 +398,6 @@ interface ReadableStreamDefaultReadValueResult { value: T; } -interface ReadableStreamGetReaderOptions { - /** - * Creates a ReadableStreamBYOBReader and locks the stream to the new reader. - * - * This call behaves the same way as the no-argument variant, except that it only works on readable byte streams, i.e. streams which were constructed specifically with the ability to handle "bring your own buffer" reading. The returned BYOB reader provides the ability to directly read individual chunks from the stream via its read() method, into developer-supplied buffers, allowing more precise control over allocation. - */ - mode?: ReadableStreamReaderMode; -} - interface ReadableWritablePair { readable: ReadableStream; /** @@ -581,11 +567,10 @@ interface UnderlyingSink { } interface UnderlyingSource { - autoAllocateChunkSize?: number; cancel?: UnderlyingSourceCancelCallback; pull?: UnderlyingSourcePullCallback; start?: UnderlyingSourceStartCallback; - type?: ReadableStreamType; + type?: undefined; } interface WebGLContextAttributes { @@ -2750,26 +2735,11 @@ declare var PushSubscriptionOptions: { new(): PushSubscriptionOptions; }; -interface ReadableByteStreamController { - readonly byobRequest: ReadableStreamBYOBRequest | null; - readonly desiredSize: number | null; - close(): void; - enqueue(chunk: ArrayBufferView): void; - error(e?: any): void; -} - -declare var ReadableByteStreamController: { - prototype: ReadableByteStreamController; - new(): ReadableByteStreamController; -}; - /** This Streams API interface represents a readable stream of byte data. The Fetch API offers a concrete instance of a ReadableStream through the body property of a Response object. */ interface ReadableStream { readonly locked: boolean; cancel(reason?: any): Promise; - getReader(options: { mode: "byob" }): ReadableStreamBYOBReader; getReader(): ReadableStreamDefaultReader; - getReader(options?: ReadableStreamGetReaderOptions): ReadableStreamReader; pipeThrough(transform: ReadableWritablePair, options?: StreamPipeOptions): ReadableStream; pipeTo(dest: WritableStream, options?: StreamPipeOptions): Promise; tee(): [ReadableStream, ReadableStream]; @@ -2780,27 +2750,6 @@ declare var ReadableStream: { new(underlyingSource?: UnderlyingSource, strategy?: QueuingStrategy): ReadableStream; }; -interface ReadableStreamBYOBReader extends ReadableStreamGenericReader { - read(view: T): Promise>; - releaseLock(): void; -} - -declare var ReadableStreamBYOBReader: { - prototype: ReadableStreamBYOBReader; - new(stream: ReadableStream): ReadableStreamBYOBReader; -}; - -interface ReadableStreamBYOBRequest { - readonly view: ArrayBufferView | null; - respond(bytesWritten: number): void; - respondWithNewView(view: ArrayBufferView): void; -} - -declare var ReadableStreamBYOBRequest: { - prototype: ReadableStreamBYOBRequest; - new(): ReadableStreamBYOBRequest; -}; - interface ReadableStreamDefaultController { readonly desiredSize: number | null; close(): void; @@ -5562,7 +5511,6 @@ declare var WorkerNavigator: { interface WritableStream { readonly locked: boolean; abort(reason?: any): Promise; - close(): Promise; getWriter(): WritableStreamDefaultWriter; } @@ -6015,8 +5963,8 @@ type OnErrorEventHandler = OnErrorEventHandlerNonNull | null; type TimerHandler = string | Function; type PerformanceEntryList = PerformanceEntry[]; type PushMessageDataInit = BufferSource | string; -type ReadableStreamReader = ReadableStreamDefaultReader | ReadableStreamBYOBReader; -type ReadableStreamController = ReadableStreamDefaultController | ReadableByteStreamController; +type ReadableStreamReader = ReadableStreamDefaultReader; +type ReadableStreamController = ReadableStreamDefaultController; type VibratePattern = number | number[]; type AlgorithmIdentifier = string | Algorithm; type HashAlgorithmIdentifier = AlgorithmIdentifier; @@ -6071,8 +6019,6 @@ type PermissionState = "denied" | "granted" | "prompt"; type PremultiplyAlpha = "default" | "none" | "premultiply"; type PushEncryptionKeyName = "auth" | "p256dh"; type PushPermissionState = "denied" | "granted" | "prompt"; -type ReadableStreamReaderMode = "byob"; -type ReadableStreamType = "bytes"; type ReferrerPolicy = "" | "no-referrer" | "no-referrer-when-downgrade" | "origin" | "origin-when-cross-origin" | "same-origin" | "strict-origin" | "strict-origin-when-cross-origin" | "unsafe-url"; type RequestCache = "default" | "force-cache" | "no-cache" | "no-store" | "only-if-cached" | "reload"; type RequestCredentials = "include" | "omit" | "same-origin"; From a398906a1cc05702e2ff87d052ff8c85a980c4f6 Mon Sep 17 00:00:00 2001 From: Mattias Buelens Date: Tue, 29 Sep 2020 22:24:08 +0200 Subject: [PATCH 14/15] Update Streams and Encoding IDL --- inputfiles/idl/Encoding.commentmap.json | 8 ++++---- inputfiles/idl/Encoding.widl | 5 ----- inputfiles/idl/Streams.commentmap.json | 2 +- inputfiles/idl/Streams.widl | 5 +++++ 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/inputfiles/idl/Encoding.commentmap.json b/inputfiles/idl/Encoding.commentmap.json index 39a14c10b..030bbf382 100644 --- a/inputfiles/idl/Encoding.commentmap.json +++ b/inputfiles/idl/Encoding.commentmap.json @@ -1,13 +1,13 @@ { "textdecoder": "Returns a new TextDecoder object.\n\nIf label is either not a label or is a label for replacement, throws a RangeError.", "textdecodercommon-encoding": "Returns encoding's name, lowercased.", - "textdecodercommon-fatal": "Returns true if error mode is \"fatal\", and false otherwise.", - "textdecodercommon-ignorebom": "Returns true if ignore BOM flag is set, and false otherwise.", - "textdecoder-decode": "Returns the result of running encoding's decoder. The method can be invoked zero or more times with options's stream set to true, and then once without options's stream (or set to false), to process a fragmented stream. If the invocation without options's stream (or set to false) has no input, it's clearest to omit both arguments.\n\n```\nvar string = \"\", decoder = new TextDecoder(encoding), buffer;\nwhile(buffer = next_chunk()) {\n string += decoder.decode(buffer, {stream:true});\n}\nstring += decoder.decode(); // end-of-stream\n```\n\nIf the error mode is \"fatal\" and encoding's decoder returns error, throws a TypeError.", + "textdecodercommon-fatal": "Returns true if error mode is \"fatal\", otherwise false.", + "textdecodercommon-ignorebom": "Returns the value of ignore BOM.", + "textdecoder-decode": "Returns the result of running encoding's decoder. The method can be invoked zero or more times with options's stream set to true, and then once without options's stream (or set to false), to process a fragmented input. If the invocation without options's stream (or set to false) has no input, it's clearest to omit both arguments.\n\n```\nvar string = \"\", decoder = new TextDecoder(encoding), buffer;\nwhile(buffer = next_chunk()) {\n string += decoder.decode(buffer, {stream:true});\n}\nstring += decoder.decode(); // end-of-queue\n```\n\nIf the error mode is \"fatal\" and encoding's decoder returns error, throws a TypeError.", "textencoder": "Returns a new TextEncoder object.", "textencodercommon-encoding": "Returns \"utf-8\".", "textencoder-encode": "Returns the result of running UTF-8's encoder.", - "textencoder-encodeinto": "Runs the UTF-8 encoder on source, stores the result of that operation into destination, and returns the progress made as a dictionary whereby read is the number of converted code units of source and written is the number of bytes modified in destination.", + "textencoder-encodeinto": "Runs the UTF-8 encoder on source, stores the result of that operation into destination, and returns the progress made as an object wherein read is the number of converted code units of source and written is the number of bytes modified in destination.", "textdecoderstream": "Returns a new TextDecoderStream object.\n\nIf label is either not a label or is a label for replacement, throws a RangeError.", "generictransformstream-readable": "Returns a readable stream whose chunks are strings resulting from running encoding's decoder on the chunks written to writable.", "generictransformstream-writable": "Returns a writable stream which accepts [AllowShared] BufferSource chunks and runs them through encoding's decoder before making them available to readable.\n\nTypically this will be used via the pipeThrough() method on a ReadableStream source.\n\n```\nvar decoder = new TextDecoderStream(encoding);\nbyteReadable\n .pipeThrough(decoder)\n .pipeTo(textWritable);\n```\n\nIf the error mode is \"fatal\" and encoding's decoder returns error, both readable and writable will be errored with a TypeError.", diff --git a/inputfiles/idl/Encoding.widl b/inputfiles/idl/Encoding.widl index 651226b9a..ee872355e 100644 --- a/inputfiles/idl/Encoding.widl +++ b/inputfiles/idl/Encoding.widl @@ -39,11 +39,6 @@ interface TextEncoder { }; TextEncoder includes TextEncoderCommon; -interface mixin GenericTransformStream { - readonly attribute ReadableStream readable; - readonly attribute WritableStream writable; -}; - [Exposed=(Window,Worker)] interface TextDecoderStream { constructor(optional DOMString label = "utf-8", optional TextDecoderOptions options = {}); diff --git a/inputfiles/idl/Streams.commentmap.json b/inputfiles/idl/Streams.commentmap.json index 47dc90aaa..4ac8f33d9 100644 --- a/inputfiles/idl/Streams.commentmap.json +++ b/inputfiles/idl/Streams.commentmap.json @@ -1,7 +1,7 @@ { "readablestreamgetreaderoptions-mode": "Creates a ReadableStreamBYOBReader and locks the stream to the new reader.\n\nThis call behaves the same way as the no-argument variant, except that it only works on readable byte streams, i.e. streams which were constructed specifically with the ability to handle \"bring your own buffer\" reading. The returned BYOB reader provides the ability to directly read individual chunks from the stream via its read() method, into developer-supplied buffers, allowing more precise control over allocation.", "readablewritablepair-writable": "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.\n\nPiping a stream will lock it for the duration of the pipe, preventing any other consumer from acquiring a reader.", - "streampipeoptions-preventclose": "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.\n\nPiping a stream will lock it for the duration of the pipe, preventing any other consumer from acquiring a reader.\n\nErrors and closures of the source and destination streams propagate as follows:\n\nAn error in this source readable stream will abort destination, unless preventAbort is truthy. The returned promise will be rejected with the source's error, or with any error that occurs during aborting the destination.\n\nAn error in destination will cancel this source readable stream, unless preventCancel is truthy. The returned promise will be rejected with the destination's error, or with any error that occurs during canceling the source.\n\nWhen this source readable stream closes, destination will be closed, unless preventCancel is truthy. The returned promise will be fulfilled once this process completes, unless an error is encountered while closing the destination, in which case it will be rejected with that error.\n\nIf destination starts out closed or closing, this source readable stream will be canceled, unless preventCancel is true. The returned promise will be rejected with an error indicating piping to a closed stream failed, or with any error that occurs during canceling the source.\n\nThe 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.", + "streampipeoptions-preventclose": "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.\n\nPiping a stream will lock it for the duration of the pipe, preventing any other consumer from acquiring a reader.\n\nErrors and closures of the source and destination streams propagate as follows:\n\nAn error in this source readable stream will abort destination, unless preventAbort is truthy. The returned promise will be rejected with the source's error, or with any error that occurs during aborting the destination.\n\nAn error in destination will cancel this source readable stream, unless preventCancel is truthy. The returned promise will be rejected with the destination's error, or with any error that occurs during canceling the source.\n\nWhen this source readable stream closes, destination will be closed, unless preventClose is truthy. The returned promise will be fulfilled once this process completes, unless an error is encountered while closing the destination, in which case it will be rejected with that error.\n\nIf destination starts out closed or closing, this source readable stream will be canceled, unless preventCancel is true. The returned promise will be rejected with an error indicating piping to a closed stream failed, or with any error that occurs during canceling the source.\n\nThe 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.", "readablestreamiteratoroptions-preventcancel": "Asynchronously iterates over the chunks in the stream's internal queue.\n\nAsynchronously iterating over the stream will lock it, preventing any other consumer from acquiring a reader. The lock will be released if the async iterator's return() method is called, e.g. by breaking out of the loop.\n\nBy default, calling the async iterator's return() method will also cancel the stream. To prevent this, use the stream's values() method, passing true for the preventCancel option.", "queuingstrategyinit-highwatermark": "Creates a new ByteLengthQueuingStrategy with the provided high water mark.\n\nNote that the provided high water mark will not be validated ahead of time. Instead, if it is negative, NaN, or not a number, the resulting ByteLengthQueuingStrategy will cause the corresponding stream constructor to throw." } diff --git a/inputfiles/idl/Streams.widl b/inputfiles/idl/Streams.widl index 315071d03..57db5b017 100644 --- a/inputfiles/idl/Streams.widl +++ b/inputfiles/idl/Streams.widl @@ -214,3 +214,8 @@ interface CountQueuingStrategy { readonly attribute unrestricted double highWaterMark; readonly attribute Function size; }; + +interface mixin GenericTransformStream { + readonly attribute ReadableStream readable; + readonly attribute WritableStream writable; +}; From 2caa900fb0b785f5e0b99aefc250f20873d0a962 Mon Sep 17 00:00:00 2001 From: Mattias Buelens Date: Tue, 29 Sep 2020 22:24:18 +0200 Subject: [PATCH 15/15] Update baselines --- baselines/dom.generated.d.ts | 29 ++++++----------------------- baselines/webworker.generated.d.ts | 29 ++++++----------------------- 2 files changed, 12 insertions(+), 46 deletions(-) diff --git a/baselines/dom.generated.d.ts b/baselines/dom.generated.d.ts index 5f04ad46c..cc84fafd7 100644 --- a/baselines/dom.generated.d.ts +++ b/baselines/dom.generated.d.ts @@ -1772,7 +1772,7 @@ interface StreamPipeOptions { * * An error in destination will cancel this source readable stream, unless preventCancel is truthy. The returned promise will be rejected with the destination's error, or with any error that occurs during canceling the source. * - * When this source readable stream closes, destination will be closed, unless preventCancel is truthy. The returned promise will be fulfilled once this process completes, unless an error is encountered while closing the destination, in which case it will be rejected with that error. + * When this source readable stream closes, destination will be closed, unless preventClose is truthy. The returned promise will be fulfilled once this process completes, unless an error is encountered while closing the destination, in which case it will be rejected with that error. * * If destination starts out closed or closing, this source readable stream will be canceled, unless preventCancel is true. The returned promise will be rejected with an error indicating piping to a closed stream failed, or with any error that occurs during canceling the source. * @@ -5639,24 +5639,7 @@ declare var GamepadPose: { }; interface GenericTransformStream { - /** - * Returns a readable stream whose chunks are strings resulting from running encoding's decoder on the chunks written to writable. - */ readonly readable: ReadableStream; - /** - * Returns a writable stream which accepts [AllowShared] BufferSource chunks and runs them through encoding's decoder before making them available to readable. - * - * Typically this will be used via the pipeThrough() method on a ReadableStream source. - * - * ``` - * var decoder = new TextDecoderStream(encoding); - * byteReadable - * .pipeThrough(decoder) - * .pipeTo(textWritable); - * ``` - * - * If the error mode is "fatal" and encoding's decoder returns error, both readable and writable will be errored with a TypeError. - */ readonly writable: WritableStream; } @@ -15449,14 +15432,14 @@ declare var Text: { /** A decoder for a specific method, that is a specific character encoding, like utf-8, iso-8859-2, koi8, cp1261, gbk, etc. A decoder takes a stream of bytes as input and emits a stream of code points. For a more scalable, non-native library, see StringView – a C-like representation of strings based on typed arrays. */ interface TextDecoder extends TextDecoderCommon { /** - * Returns the result of running encoding's decoder. The method can be invoked zero or more times with options's stream set to true, and then once without options's stream (or set to false), to process a fragmented stream. If the invocation without options's stream (or set to false) has no input, it's clearest to omit both arguments. + * Returns the result of running encoding's decoder. The method can be invoked zero or more times with options's stream set to true, and then once without options's stream (or set to false), to process a fragmented input. If the invocation without options's stream (or set to false) has no input, it's clearest to omit both arguments. * * ``` * var string = "", decoder = new TextDecoder(encoding), buffer; * while(buffer = next_chunk()) { * string += decoder.decode(buffer, {stream:true}); * } - * string += decoder.decode(); // end-of-stream + * string += decoder.decode(); // end-of-queue * ``` * * If the error mode is "fatal" and encoding's decoder returns error, throws a TypeError. @@ -15475,11 +15458,11 @@ interface TextDecoderCommon { */ readonly encoding: string; /** - * Returns true if error mode is "fatal", and false otherwise. + * Returns true if error mode is "fatal", otherwise false. */ readonly fatal: boolean; /** - * Returns true if ignore BOM flag is set, and false otherwise. + * Returns the value of ignore BOM. */ readonly ignoreBOM: boolean; } @@ -15501,7 +15484,7 @@ interface TextEncoder extends TextEncoderCommon { */ encode(input?: string): Uint8Array; /** - * Runs the UTF-8 encoder on source, stores the result of that operation into destination, and returns the progress made as a dictionary whereby read is the number of converted code units of source and written is the number of bytes modified in destination. + * Runs the UTF-8 encoder on source, stores the result of that operation into destination, and returns the progress made as an object wherein read is the number of converted code units of source and written is the number of bytes modified in destination. */ encodeInto(source: string, destination: Uint8Array): TextEncoderEncodeIntoResult; } diff --git a/baselines/webworker.generated.d.ts b/baselines/webworker.generated.d.ts index eacfdc4eb..0d538c2af 100644 --- a/baselines/webworker.generated.d.ts +++ b/baselines/webworker.generated.d.ts @@ -521,7 +521,7 @@ interface StreamPipeOptions { * * An error in destination will cancel this source readable stream, unless preventCancel is truthy. The returned promise will be rejected with the destination's error, or with any error that occurs during canceling the source. * - * When this source readable stream closes, destination will be closed, unless preventCancel is truthy. The returned promise will be fulfilled once this process completes, unless an error is encountered while closing the destination, in which case it will be rejected with that error. + * When this source readable stream closes, destination will be closed, unless preventClose is truthy. The returned promise will be fulfilled once this process completes, unless an error is encountered while closing the destination, in which case it will be rejected with that error. * * If destination starts out closed or closing, this source readable stream will be canceled, unless preventCancel is true. The returned promise will be rejected with an error indicating piping to a closed stream failed, or with any error that occurs during canceling the source. * @@ -1652,24 +1652,7 @@ declare var FormData: { }; interface GenericTransformStream { - /** - * Returns a readable stream whose chunks are strings resulting from running encoding's decoder on the chunks written to writable. - */ readonly readable: ReadableStream; - /** - * Returns a writable stream which accepts [AllowShared] BufferSource chunks and runs them through encoding's decoder before making them available to readable. - * - * Typically this will be used via the pipeThrough() method on a ReadableStream source. - * - * ``` - * var decoder = new TextDecoderStream(encoding); - * byteReadable - * .pipeThrough(decoder) - * .pipeTo(textWritable); - * ``` - * - * If the error mode is "fatal" and encoding's decoder returns error, both readable and writable will be errored with a TypeError. - */ readonly writable: WritableStream; } @@ -3090,14 +3073,14 @@ declare var SyncManager: { /** A decoder for a specific method, that is a specific character encoding, like utf-8, iso-8859-2, koi8, cp1261, gbk, etc. A decoder takes a stream of bytes as input and emits a stream of code points. For a more scalable, non-native library, see StringView – a C-like representation of strings based on typed arrays. */ interface TextDecoder extends TextDecoderCommon { /** - * Returns the result of running encoding's decoder. The method can be invoked zero or more times with options's stream set to true, and then once without options's stream (or set to false), to process a fragmented stream. If the invocation without options's stream (or set to false) has no input, it's clearest to omit both arguments. + * Returns the result of running encoding's decoder. The method can be invoked zero or more times with options's stream set to true, and then once without options's stream (or set to false), to process a fragmented input. If the invocation without options's stream (or set to false) has no input, it's clearest to omit both arguments. * * ``` * var string = "", decoder = new TextDecoder(encoding), buffer; * while(buffer = next_chunk()) { * string += decoder.decode(buffer, {stream:true}); * } - * string += decoder.decode(); // end-of-stream + * string += decoder.decode(); // end-of-queue * ``` * * If the error mode is "fatal" and encoding's decoder returns error, throws a TypeError. @@ -3116,11 +3099,11 @@ interface TextDecoderCommon { */ readonly encoding: string; /** - * Returns true if error mode is "fatal", and false otherwise. + * Returns true if error mode is "fatal", otherwise false. */ readonly fatal: boolean; /** - * Returns true if ignore BOM flag is set, and false otherwise. + * Returns the value of ignore BOM. */ readonly ignoreBOM: boolean; } @@ -3142,7 +3125,7 @@ interface TextEncoder extends TextEncoderCommon { */ encode(input?: string): Uint8Array; /** - * Runs the UTF-8 encoder on source, stores the result of that operation into destination, and returns the progress made as a dictionary whereby read is the number of converted code units of source and written is the number of bytes modified in destination. + * Runs the UTF-8 encoder on source, stores the result of that operation into destination, and returns the progress made as an object wherein read is the number of converted code units of source and written is the number of bytes modified in destination. */ encodeInto(source: string, destination: Uint8Array): TextEncoderEncodeIntoResult; }