mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-27 02:05:07 +02:00
LibJS: Stop propagating small OOM errors from the Error object
This commit is contained in:
Notes:
sideshowbarker
2024-07-16 21:34:08 +09:00
Author: https://github.com/trflynn89 Commit: https://github.com/SerenityOS/serenity/commit/54d1f4e234 Pull-request: https://github.com/SerenityOS/serenity/pull/20972 Reviewed-by: https://github.com/awesomekling
@@ -76,13 +76,7 @@ void ReadLoopReadRequest::on_chunk(JS::Value chunk)
|
||||
{
|
||||
// 1. If chunk is not a Uint8Array object, call failureSteps with a TypeError and abort these steps.
|
||||
if (!chunk.is_object() || !is<JS::Uint8Array>(chunk.as_object())) {
|
||||
auto exception = JS::TypeError::create(m_realm, "Chunk data is not Uint8Array"sv);
|
||||
if (exception.is_error()) {
|
||||
m_failure_steps(*exception.release_error().value());
|
||||
return;
|
||||
}
|
||||
|
||||
m_failure_steps(exception.value());
|
||||
m_failure_steps(JS::TypeError::create(m_realm, "Chunk data is not Uint8Array"sv));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -162,7 +156,7 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<JS::Promise>> ReadableStreamDefaultReader::
|
||||
|
||||
// 1. If this.[[stream]] is undefined, return a promise rejected with a TypeError exception.
|
||||
if (!m_stream) {
|
||||
auto exception = MUST_OR_THROW_OOM(JS::TypeError::create(realm, "Cannot read from an empty stream"sv));
|
||||
auto exception = JS::TypeError::create(realm, "Cannot read from an empty stream"sv);
|
||||
auto promise_capability = WebIDL::create_rejected_promise(realm, exception);
|
||||
return JS::NonnullGCPtr { verify_cast<JS::Promise>(*promise_capability->promise()) };
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user