diff options
author | Timothy Flynn <trflynn89@pm.me> | 2023-01-07 12:14:54 -0500 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2023-01-08 12:13:15 +0100 |
commit | d8044c5358ab8440286f39c3d1efe2c5f39bc115 (patch) | |
tree | eb966d631ff464f284844b863230fe56fec7ad3c /Userland/Libraries/LibWeb/Fetch/Request.cpp | |
parent | ba97f6a0d3516a19306137bed8df7310bacabfb5 (diff) | |
download | serenity-d8044c5358ab8440286f39c3d1efe2c5f39bc115.zip |
LibJS+LibWeb: Move the macro to convert ENOMEM to an exception to LibJS
Move the macro to LibJS and change it to return a throw completion
instead of a WebIDL exception. This will let us use this macro within
LibJS to handle OOM conditions.
Diffstat (limited to 'Userland/Libraries/LibWeb/Fetch/Request.cpp')
-rw-r--r-- | Userland/Libraries/LibWeb/Fetch/Request.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/Userland/Libraries/LibWeb/Fetch/Request.cpp b/Userland/Libraries/LibWeb/Fetch/Request.cpp index 5ae2acdfd4..47b7a0fc22 100644 --- a/Userland/Libraries/LibWeb/Fetch/Request.cpp +++ b/Userland/Libraries/LibWeb/Fetch/Request.cpp @@ -5,6 +5,7 @@ */ #include <AK/URLParser.h> +#include <LibJS/Runtime/Completion.h> #include <LibWeb/Bindings/Intrinsics.h> #include <LibWeb/Bindings/RequestPrototype.h> #include <LibWeb/DOM/AbortSignal.h> @@ -174,13 +175,13 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<Request>> Request::construct_impl(JS::Realm // method // request’s method. - request->set_method(TRY_OR_RETURN_OOM(realm, ByteBuffer::copy(input_request->method()))); + request->set_method(TRY_OR_THROW_OOM(vm, ByteBuffer::copy(input_request->method()))); // header list // A copy of request’s header list. auto header_list_copy = Infrastructure::HeaderList::create(vm); for (auto& header : *input_request->header_list()) - TRY_OR_RETURN_OOM(realm, header_list_copy->append(header)); + TRY_OR_THROW_OOM(vm, header_list_copy->append(header)); request->set_header_list(header_list_copy); // unsafe-request flag @@ -365,7 +366,7 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<Request>> Request::construct_impl(JS::Realm return WebIDL::SimpleException { WebIDL::SimpleExceptionType::TypeError, "Method must not be one of CONNECT, TRACE, or TRACK"sv }; // 3. Normalize method. - method = TRY_OR_RETURN_OOM(realm, Infrastructure::normalize_method(method.bytes())); + method = TRY_OR_THROW_OOM(vm, Infrastructure::normalize_method(method.bytes())); // 4. Set request’s method to method. request->set_method(MUST(ByteBuffer::copy(method.bytes()))); |