mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-16 05:51:55 +00:00
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>.
This commit is contained in:
parent
ffb48ccd81
commit
bbe6b84bd6
Notes:
sideshowbarker
2024-07-17 03:19:14 +09:00
Author: https://github.com/trflynn89
Commit: bbe6b84bd6
Pull-request: https://github.com/SerenityOS/serenity/pull/24165
Reviewed-by: https://github.com/kennethmyhra ✅
Reviewed-by: https://github.com/shannonbooth ✅
6 changed files with 106 additions and 112 deletions
|
@ -101,7 +101,7 @@ WebIDL::ExceptionOr<void> ReadableStreamDefaultController::pull_steps(Web::Strea
|
|||
}
|
||||
// 3. Otherwise, perform ! ReadableStreamDefaultControllerCallPullIfNeeded(this).
|
||||
else {
|
||||
TRY(readable_stream_default_controller_can_pull_if_needed(*this));
|
||||
readable_stream_default_controller_can_pull_if_needed(*this);
|
||||
}
|
||||
|
||||
// 4. Perform readRequest’s chunk steps, given chunk.
|
||||
|
@ -113,7 +113,7 @@ WebIDL::ExceptionOr<void> ReadableStreamDefaultController::pull_steps(Web::Strea
|
|||
readable_stream_add_read_request(stream, read_request);
|
||||
|
||||
// 2. Perform ! ReadableStreamDefaultControllerCallPullIfNeeded(this).
|
||||
TRY(readable_stream_default_controller_can_pull_if_needed(*this));
|
||||
readable_stream_default_controller_can_pull_if_needed(*this);
|
||||
}
|
||||
|
||||
return {};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue