Commit graph

72 commits

Author SHA1 Message Date
Andreas Kling
97ebfd9f0f LibJS: Make Value::to_string_without_side_effects() infallible
Work towards #20449.
2023-08-09 17:09:16 +02:00
Andreas Kling
c084269e5f LibJS: Make PrimitiveString::utf8_string() infallible
Work towards #20449.
2023-08-09 17:09:16 +02:00
Daniel Bertalan
9feb1ce39f LibJS+LibWeb: Apply the Rule of Zero to {Nonnull,}GCPtr<T>
The compiler-generated copy constructor and copy assignment operator
already do the right thing (which is to simply copy the underlying
pointer).

The [Itanium C++ ABI][1] treats any class with non-trivial copy/move
constructors and destructors as non-trivial for the purposes of calls --
even if they are functionally identical to the compiler-generated ones.
If a class is non-trivial, it cannot be passed or returned in registers,
only via an invisible reference, which is worse for codegen. This commit
makes `{Nonnull,}GCPtr` trivial.

As the compiler can be sure that capturing a `GCPtr` by value has no
side effects, a few `-Wunused-lambda-capture` warnings had to be
addressed in LibWeb.

GCC seems to have a bug that prevents `ExceptionOr<Variant<GCPtr<T>>>`
from being implicitly constructed from `GCPtr<T>` after this change. A
non-invasive workaround is to explicitly construct the inner Variant
type.

[1]: https://itanium-cxx-abi.github.io/cxx-abi/abi.html#non-trivial
2023-08-07 22:20:03 -04:00
Shannon Booth
2b46e6f664 Everywhere: Update copyrights with my new serenityos.org e-mail :^) 2023-07-15 16:21:29 +02:00
Kenneth Myhra
7117cb7a35 LibWeb: Add set_up_transform_stream_default_controller_from_transformer 2023-07-15 11:59:39 +02:00
Kenneth Myhra
f7c532d093 LibWeb: Add AO set_up_transform_stream_default_controller() 2023-07-15 11:59:39 +02:00
Kenneth Myhra
86455bbb74 LibWeb: Add AO initialize_transform_stream() 2023-07-15 11:59:39 +02:00
Kenneth Myhra
a52f9970bc LibWeb: Add AO create_readable_stream() 2023-07-15 11:59:39 +02:00
Kenneth Myhra
8e6b386ff7 LibWeb: Add AO initialize_readable_stream() 2023-07-15 11:59:39 +02:00
Kenneth Myhra
f91c150cfc LibWeb: Add AO transform_stream_default_source_pull_algorithm() 2023-07-15 11:59:39 +02:00
Kenneth Myhra
894f1e9d62 LibWeb: Add AO create_writable_stream() 2023-07-15 11:59:39 +02:00
Kenneth Myhra
7d8f24c227 LibWeb: Add AO initialize_writable_stream() 2023-07-15 11:59:39 +02:00
Kenneth Myhra
641b9edd89 LibWeb: Add AO transform_stream_default_sink_close_algorithm() 2023-07-15 11:59:39 +02:00
Kenneth Myhra
48921add86 LibWeb: Add AO transform_stream_default_sink_abort_algorithm() 2023-07-15 11:59:39 +02:00
Kenneth Myhra
18aa588968 LibWeb: Add AO transform_stream_default_sink_write_algorithm() 2023-07-15 11:59:39 +02:00
Kenneth Myhra
11c0600729 LibWeb: Add AO transform_stream_default_controller_perform_transform() 2023-07-15 11:59:39 +02:00
Kenneth Myhra
e1740938fc LibWeb: Add AO transform_stream_default_controller_terminate() 2023-07-15 11:59:39 +02:00
Kenneth Myhra
e028918a64 LibWeb: Add AO transform_stream_default_controller_enqueue() 2023-07-15 11:59:39 +02:00
Kenneth Myhra
d2236e5ca5 LibWeb: Add AO readable_stream_default_controller_has_backpressure() 2023-07-15 11:59:39 +02:00
Kenneth Myhra
9efcc01387 LibWeb: Add AO transform_stream_default_controller_error() 2023-07-15 11:59:39 +02:00
Kenneth Myhra
69fb6f15f9 LibWeb: Add AO transform_stream_error() 2023-07-15 11:59:39 +02:00
Kenneth Myhra
ad73c03ea3 LibWeb: Add AO transform_stream_error_writable_and_unblock_write() 2023-07-15 11:59:39 +02:00
Kenneth Myhra
91f58eb220 LibWeb: Add AO transform_stream_set_backpressure() 2023-07-15 11:59:39 +02:00
Kenneth Myhra
d8d0e8a6ea LibWeb: Add AO transform_stream_default_controller_clear_algorithms() 2023-07-15 11:59:39 +02:00
Shannon Booth
729f4838c2 LibWeb: Implement the Streams AcquireReadableStreamBYOBReader AO
Co-Authored-By: Matthew Olsson <mattco@serenityos.org>
2023-07-05 23:33:20 +01:00
Shannon Booth
9ccadf61a2 LibWeb: Implement the Streams SetUpReadableStreamBYOBReader AO
Co-Authored-By: Matthew Olsson <mattco@serenityos.org>
2023-07-05 23:33:20 +01:00
Shannon Booth
33f6e5d516 LibWeb: Implement Streams AO ExtractSizeAlgorithm(strategy) 2023-06-22 06:58:23 +02:00
Shannon Booth
060c130c82 LibWeb: Implement SetUpReadableByteStreamControllerFromUnderlyingSource 2023-06-22 06:58:23 +02:00
Shannon Booth
9ea597016a LibWeb: Implement Streams AO ExtractHighWaterMark(strategy, defaultHWM) 2023-06-22 06:58:23 +02:00
Shannon Booth
94883866f5 LibWeb: Implement Web::Streams::readable_stream_enqueue AO
This AO will be used in the Web::FileAPI::Blob::get_stream()
implementation to enqueue all data in the blob to the stream.

There are still plenty of cases to handle, but this appears to be enough
for the basic case of reading all chunks from a readable stream until it
is done.
2023-06-14 06:27:04 +02:00
Shannon Booth
b7b5b5763e LibWeb: Add support to set up stream with byte reading support
This is used by Blobs to set up their stream in their get stream
algorithm.
2023-06-14 06:27:04 +02:00
Matthew Olsson
22e97332fc LibWeb: Throw the correct object when enqueuing to a readable stream 2023-05-27 13:55:14 +02:00
Matthew Olsson
4c8015c1f6 LibWeb: Do not clear stream algorithms (and add corresponding FIXMEs) 2023-05-27 13:55:14 +02:00
Matthew Olsson
dd65d60069 LibWeb: Use doubles for Stream's high_water_mark and queue_total_size
This matches the IDL types
2023-05-27 13:55:14 +02:00
Matthew Olsson
5d48ade508 LibWeb: Use TRY() to convert invoke_callback result to an ExceptionOr
Otherwise, the JS::Completion is always interpretted as an error by
ExceptionOr.
2023-05-27 13:55:14 +02:00
Matthew Olsson
e5ff777b48 LibWeb: Capture stack values by copy in async lambdas in Stream AOs 2023-05-27 13:55:14 +02:00
Matthew Olsson
c9be755367 LibWeb: Implement ReadableByteStreamController.close() 2023-04-27 07:57:53 +02:00
Matthew Olsson
ef3810d03d LibWeb: Add missing AOs for ReadableByteStreamController.[[PullSteps]] 2023-04-27 07:57:53 +02:00
Matthew Olsson
b57b3c54cc LibWeb: Add ReadableStreamBYOBReader to ReadableStreamReader type 2023-04-27 07:57:53 +02:00
Matthew Olsson
bb9d51fd84 LibWeb: Make StartAlgorithm return a Value instead of a Promise 2023-04-17 10:27:40 +02:00
Matthew Olsson
bad541a0d4 LibWeb: Remove outdated FIXMEs around WebIDL::invoke_callback usages 2023-04-17 10:27:40 +02:00
Matthew Olsson
c40109628d LibWeb: Properly reject abrupt completion in clean_up_on_return 2023-04-17 10:27:40 +02:00
Linus Groh
0abdffc33d LibWeb/Streams: Rename one instance of 'e' to 'exception'
This is what we call it everywhere else.
2023-04-14 16:35:17 +02:00
Linus Groh
6b35cca65b LibWeb/Streams: Add FIXMEs to incorrect invoke_callback() invocations 2023-04-14 16:35:17 +02:00
Linus Groh
1c165b67ef LibWeb/Streams: Use MUST_OR_THROW_OOM() when creating JS exceptions
This cannot throw unless we OOM.
2023-04-14 16:35:17 +02:00
Linus Groh
d192f44523 LibWeb/Streams: Make most algorithms return a NonnullGCPtr
Only the 'start algorithm' ever returns undefined (as a null GCPtr), so
let's type the others more strictly.
2023-04-14 16:35:17 +02:00
Matthew Olsson
db1be40b13 LibWeb: Propogate OOM errors from readable_stream_reader_generic_cancel 2023-04-14 13:03:34 +02:00
Matthew Olsson
f9d6a161e8 LibWeb: Add ByteStreamController to ReadableStreamController type 2023-04-14 13:03:34 +02:00
Matthew Olsson
51abecc8bc LibWeb: Mostly implement ReadableByteStreamController.[[PullSteps]] 2023-04-14 13:03:34 +02:00
Matthew Olsson
c97f6b7701 LibWeb: Implement ReadableByteStreamController.[[CancelSteps]] 2023-04-14 13:03:34 +02:00