-
Notifications
You must be signed in to change notification settings - Fork 439
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update Streams to official WebIDL #890
Merged
+601
−600
Merged
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
41465f6
Use official WebIDL for Streams
MattiasBuelens 5b9448a
Add type parameter to ReadableStreamDefaultReader constructor
MattiasBuelens 5217aef
Add type parameter to WritableStreamDefaultWriter constructor
MattiasBuelens 6f3b760
Remove async iterator on ReadableStream for now
MattiasBuelens f12b48c
Remove support for "local" IDLs from idlfetcher
MattiasBuelens 42995a5
Fix Transformer callbacks
MattiasBuelens 407dc45
Move TextDecoder/EncoderStream modifications to overridingTypes
MattiasBuelens 3236090
Use "force-references" in constructor overrides
MattiasBuelens 77a265e
Remove obsolete nullable overrides
MattiasBuelens 3e95eee
Update baselines
MattiasBuelens 990b7aa
Remove WritableStream.close
MattiasBuelens 3e6fcae
Remove types for readable byte streams
MattiasBuelens 7aa6a4b
Update baselines
MattiasBuelens a398906
Update Streams and Encoding IDL
MattiasBuelens 2caa900
Update baselines
MattiasBuelens File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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." | ||
} | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,186 +1,221 @@ | ||
[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<void> cancel(optional any reason); | ||
ReadableStreamBYOBReader getReader(any options); | ||
ReadableStreamDefaultReader getReader(); | ||
any pipeThrough(any pair, optional PipeOptions options); | ||
Promise<void> 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<undefined> cancel(optional any reason); | ||
ReadableStreamReader getReader(optional ReadableStreamGetReaderOptions options = {}); | ||
ReadableStream pipeThrough(ReadableWritablePair transform, optional StreamPipeOptions options = {}); | ||
Promise<undefined> pipeTo(WritableStream destination, optional StreamPipeOptions options = {}); | ||
sequence<ReadableStream> tee(); | ||
|
||
async iterable<any>(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<undefined> (ReadableStreamController controller); | ||
callback UnderlyingSourceCancelCallback = Promise<undefined> (optional any reason); | ||
|
||
enum ReadableStreamType { "bytes" }; | ||
|
||
interface mixin ReadableStreamGenericReader { | ||
readonly attribute Promise<undefined> closed; | ||
|
||
[Exposed=(Window,Worker)] | ||
Promise<undefined> cancel(optional any reason); | ||
}; | ||
|
||
[Exposed=(Window,Worker,Worklet)] | ||
interface ReadableStreamDefaultReader { | ||
readonly attribute Promise<void> closed; | ||
constructor(ReadableStream stream); | ||
|
||
Promise<void> cancel(optional any reason); | ||
Promise<ReadableStreamReadResult> read(); | ||
void releaseLock(); | ||
Promise<ReadableStreamDefaultReadResult> read(); | ||
undefined releaseLock(); | ||
}; | ||
ReadableStreamDefaultReader includes ReadableStreamGenericReader; | ||
|
||
[Exposed=(Window,Worker)] | ||
dictionary ReadableStreamDefaultReadResult { | ||
any value; | ||
boolean done; | ||
}; | ||
|
||
[Exposed=(Window,Worker,Worklet)] | ||
interface ReadableStreamBYOBReader { | ||
readonly attribute Promise<void> closed; | ||
constructor(ReadableStream stream); | ||
|
||
Promise<void> cancel(optional any reason); | ||
Promise<ReadableStreamReadResult> read(ArrayBufferView view); | ||
void releaseLock(); | ||
Promise<ReadableStreamBYOBReadResult> 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<void> 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<undefined> abort(optional any reason); | ||
Promise<undefined> 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<undefined> (any chunk, WritableStreamDefaultController controller); | ||
callback UnderlyingSinkCloseCallback = Promise<undefined> (); | ||
callback UnderlyingSinkAbortCallback = Promise<undefined> (optional any reason); | ||
|
||
[Exposed=(Window,Worker,Worklet)] | ||
interface WritableStreamDefaultWriter { | ||
readonly attribute Promise<void> closed; | ||
readonly attribute unrestricted double? desiredSize; | ||
readonly attribute Promise<void> ready; | ||
constructor(WritableStream stream); | ||
|
||
readonly attribute Promise<undefined> closed; | ||
readonly attribute unrestricted double? desiredSize; | ||
readonly attribute Promise<undefined> ready; | ||
|
||
Promise<void> abort(optional any reason); | ||
Promise<void> close(); | ||
void releaseLock(); | ||
Promise<void> write(any chunk); | ||
Promise<undefined> abort(optional any reason); | ||
Promise<undefined> close(); | ||
undefined releaseLock(); | ||
Promise<undefined> 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<undefined> (TransformStreamDefaultController controller); | ||
callback TransformerTransformCallback = Promise<undefined> (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; | ||
}; | ||
|
||
[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; | ||
}; | ||
|
||
[Constructor(any options), | ||
Exposed=(Window,Worker)] | ||
interface CountQueuingStrategy: QueuingStrategy { | ||
attribute unrestricted double highWaterMark; | ||
double size(any chunk); | ||
interface mixin GenericTransformStream { | ||
readonly attribute ReadableStream readable; | ||
readonly attribute WritableStream writable; | ||
}; |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This comment map is very broken. The Streams standard does have comments, but it doesn't look like
idlfetcher
understands the comment style.Do we want to fix
idlfetcher
to handle the comment style of the Streams standard? Or do we want to (somehow) disable comment maps for Streams, and leave them undocumented for now?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comment generator currently has some issues on other specs too, we probably want to fix it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm trying a couple of things to improve it.
Expect a separate PR soon.See PR #894. 😁