Timothy Flynn
dce05dd273
LibWeb: Revert using a vector to store each chunk in ReadLoopReadRequest
...
This reverts commit 12cfa08a09
.
2024-05-01 21:46:45 +02:00
Timothy Flynn
6a170e7337
LibWeb: Use the ad-hoc read-all-chunks AO in ReadableStreamPipeTo
2024-05-01 21:46:45 +02:00
Timothy Flynn
572a7bb313
LibWeb: Remove exceptional return types from infallible stream AOs
2024-04-30 08:14:12 +02:00
Timothy Flynn
c29916775e
LibWeb: Mark stream AOs as infallible as required by the spec
...
There were several instances where the spec marks an AO invocation as
infallible, but we were propagating WebIDL::ExceptionOr. These mostly
cannot throw due to knowledge about the values they are provided. By
unwinding these, we can remove a decent amount of exception handling.
2024-04-30 08:14:12 +02:00
Timothy Flynn
9d5e538247
LibWeb: Mark writable stream abort steps as infallible
...
These don't throw. We can remove a decent amount of exception handling
by marking them infallible.
2024-04-30 08:14:12 +02:00
Timothy Flynn
fc070c8cbd
LibWeb: Mark readable stream cancel/pull/release steps as infallible
...
These don't throw. We can remove a decent amount of exception handling
by marking them infallible.
2024-04-30 08:14:12 +02:00
Timothy Flynn
13021a0fb9
LibWeb: Remove small OOM error propagation from stream AOs
2024-04-30 08:14:12 +02:00
Timothy Flynn
bbe6b84bd6
LibWeb: Mark most stream callbacks as infallible
...
There are a number of script-provided stream callbacks for various
stream operations, such as `start`, `pull`, `cancel`, etc. Out of all of
these, only the `start` callback can actually throw. And when it does,
the exception is realized immediately in the corresponding stream
constructor.
All other callbacks have spec text of the form:
Throwing an exception is treated the same as returning a rejected
promise.
And indeed this is internally handled by the streams spec. Thus all of
those callbacks can be specified as returning only a promise, rather
than a WebIDL::ExceptionOr<Promise>.
2024-04-30 08:14:12 +02:00
Timothy Flynn
ffb48ccd81
LibWeb: Ensure TransformStream's transform/flush callbacks do not throw
...
Unlike what the comments here currently indicate, these callbacks do
only return a Promise, and thus cannot throw.
2024-04-30 08:14:12 +02:00
Timothy Flynn
60ea803b2a
LibWeb: Fix typo in mass copy-pasted comment in stream AOs
2024-04-30 08:14:12 +02:00
Kenneth Myhra
d5c7959c45
LibWeb: Let queue_a_microtask() take a JS::HeapFunction
...
This changes the signature of queue_a_microtask() from AK:Function to
JS::HeapFunction to be more clear to the user of the functions that this
is what is used internally.
2024-04-14 17:22:26 +02:00
Kenneth Myhra
559d983fa1
LibWeb: Implement AO readable_stream_pipe_to()
...
This is currently a naive implementation of readable_stream_pipe_to()
which will need some further iterations before it is par with the spec.
2024-04-07 07:01:52 +02:00
Andreas Kling
ffac32d20e
LibWeb: Use JS::HeapFunction for WebIDL promise reaction steps
...
Switching away from SafeFunction immediately backfired here, as we're
dealing with two layers of captures, not one.
Let's do the correct fix, which is to use HeapFunction. This makes the
API and its behavior explicit, and keeps captures alive as long as the
HeapFunction is alive.
Fixes #23819 .
2024-04-03 18:14:33 +02:00
Timothy Flynn
b6501adef8
LibWeb: Use the proper in-flight request to check if a stream is closing
2024-04-01 21:11:01 +02:00
Timothy Flynn
6981ddfe13
LibWeb: Implement the ReadableByteStreamTee half of ReadableStreamTee
2024-01-29 07:21:59 +01:00
Timothy Flynn
d7612969e0
LibWeb: Invoke the correct Streams BYOB AOs when in a closed state
2024-01-29 07:21:59 +01:00
Timothy Flynn
ed1076d9ca
LibWeb: Implement the ReadableByteStreamControllerRespondWithNewView AO
2024-01-29 07:21:59 +01:00
Timothy Flynn
5e5b42730c
LibWeb: Implement the CloneAsUint8Array AO
2024-01-29 07:21:59 +01:00
Timothy Flynn
debfe996d7
LibWeb: Implement the ReadableStreamDefaultTee half of ReadableStreamTee
2024-01-29 07:21:59 +01:00
Timothy Flynn
d8413774df
LibWeb: Expose the ReadableStream tee
IDL interface
...
This just sets up the plumbing to the underlying ReadableStreamTee AO,
which as of this commit, will just throw a NotImplemented exception.
2024-01-29 07:21:59 +01:00
Timothy Flynn
5ccd1ff1bf
LibWeb: Implement the StructuredClone AO
2024-01-29 07:21:59 +01:00
Shannon Booth
eaf9a56c10
LibWeb: Actually clear stream controller algorithms when needed
...
Now that these algorithms are a HeapFunction as opposed to SafeFunction,
the problem mentioned in the FIXME is no longer applicable as these
functions are GC-allocated like everything else.
2024-01-27 21:40:25 -05:00
Shannon Booth
5f484d200a
LibWeb: Port Stream algorithms from JS::SafeFunction to JS::HeapFunction
2024-01-27 21:40:25 -05:00
Timothy Flynn
c8c3866101
LibWeb: Implement the CreateReadableByteStream AO
2024-01-27 16:01:56 +01:00
Timothy Flynn
9258d7b98a
LibJS+LibWeb: Implement resizable ArrayBuffer support for TypedArray
...
This is (part of) a normative change in the ECMA-262 spec. See:
a9ae96e
2023-12-26 11:16:10 +01:00
Shannon Booth
08be5deb3f
LibWeb: Implement AO ReadableByteStreamControllerRespond
2023-12-03 20:26:14 +01:00
Shannon Booth
2ab933e534
LibWeb: Implement AO ReadableByteStreamControllerRespondInternal
2023-12-03 20:26:14 +01:00
Shannon Booth
426cbd8ed3
LibWeb: Implement AO ReadableByteStreamControllerRespondInClosedState
2023-12-03 20:26:14 +01:00
Shannon Booth
be2195cb8c
LibWeb: Implement AO ReadableByteStreamControllerRespondInReadableState
2023-12-03 20:26:14 +01:00
Shannon Booth
0245be70d8
LibWeb: Implement Streams AO CanTransferArrayBuffer
2023-12-03 20:26:14 +01:00
Shannon Booth
9d0700e770
LibWeb: Fix IDL getter for ReadableByteStreamController byobRequest
...
We were previously only returning the controllers current
[[byobRequest]] instead of taking into account pending pull intos.
Rename the getter function which would return the controllers
[[byobRequest]] slot to `raw_byob_request` to differentiate it from
the IDL getter.
This also leaves a FIXME for a spec step which we are also not currently
implementing correctly.
2023-12-03 20:26:14 +01:00
Shannon Booth
b2a0a41503
LibWeb: Use TypedArrayBase::kind for pull into constructor lookup
2023-12-03 20:26:14 +01:00
Shannon Booth
673329e1bd
LibWeb: Use ArrayBufferView for ReadableStreamBYOBReader
...
Which means that we now have support for DataViews.
Using the ArrayBufferView class also seems to make this read a whole
bunch nicer as well.
2023-11-24 08:43:35 +01:00
Shannon Booth
dcb7bb4a92
LibWeb: Support BYOB readers in ReadableByteStreamControllerEnqueue
2023-11-19 18:53:17 +01:00
Shannon Booth
9662872b20
LibWeb: Implement AO ReadableStreamByobReaderRead
...
We've finally implemented enough of the Streams AOs so that we are close
to actually performing read operations with BYOB readers.
2023-11-19 18:53:17 +01:00
Shannon Booth
3d37cb0753
LibWeb: Partially implement ReadableByteStreamControllerPullInto
...
This implementation does not handle DataViews at the moment, but should
handle all of the typed arrays.
2023-11-19 18:53:17 +01:00
Shannon Booth
1443715775
LibWeb: Add ReadableBSControllerProcessPullIntoDescriptorsUsingQueue
2023-11-19 18:53:17 +01:00
Shannon Booth
737dc6ce4e
LibWeb: Add ReadableByteStreamControllerFillPullIntoDescriptorFromQueue
2023-11-19 18:53:17 +01:00
Shannon Booth
aca63fd947
LibWeb: Implement ReadableByteStreamControllerCommitPullIntoDescriptor
2023-11-19 18:53:17 +01:00
Shannon Booth
cdcc1ebbba
LibWeb: Implement ReadableByteStreamControllerFillHeadPullIntoDescriptor
2023-11-19 18:53:17 +01:00
Shannon Booth
26e393fbbc
LibWeb: Implement ReadableByteStreamControllerConvertPullIntoDescriptor
2023-11-19 18:53:17 +01:00
Shannon Booth
25f8b80eab
LibWeb: Use move on ByteBuffer in TransferArrayBuffer
2023-11-19 18:53:17 +01:00
Shannon Booth
446a78f30e
LibWeb: Implement Streams AO ReadableStreamAddReadIntoRequest
...
This is effectively identical to ReadableStreamAddReadRequest besides
from the fact that it takes a ReadIntoRequest instead of a ReadRequest,
and is instead intended to be used for BYOB readers.
2023-11-19 18:53:17 +01:00
Shannon Booth
f27e76b0b7
LibWeb: Make ReadableStreamAddReadRequest take a NonnullGCPtr
...
Make it more obvious in the function signature that this function will
be taking a GC ref to a ReadRequest by appending it to the
ReadableStreams pending read requests.
2023-11-19 18:53:17 +01:00
Shannon Booth
5ef41dca53
LibWeb: Implement Streams AO ReadableStreamFulfillReadIntoRequest
2023-11-19 18:53:17 +01:00
Shannon Booth
acda17ccc4
LibWeb/Streams: Handle BYOB reader in ReadableStreamError
2023-09-24 20:10:50 -06:00
Timothy Flynn
54d1f4e234
LibJS: Stop propagating small OOM errors from the Error object
2023-09-09 13:03:25 -04:00
Shannon Booth
b06d80e6fd
LibWeb: Implement ReadableStreamBYOBReaderRelease Streams AO
2023-08-31 19:28:56 +02:00
Shannon Booth
8ce4f5597c
LibWeb: Implement ReadableStreamBYOBReaderErrorReadIntoRequests AO
2023-08-31 19:28:56 +02:00
Shannon Booth
e08072ac2b
LibWeb: Explicitly clear read requests for default stream reader
...
Expecting the list to be cleared from the move() is quite strange and
not particularly clear. Explicitly clear the requests instead.
2023-08-31 19:28:56 +02:00