1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 06:47:35 +00:00

LibJS: Convert Heap::allocate{,_without_realm}() to NonnullGCPtr

This commit is contained in:
Linus Groh 2022-12-14 17:40:33 +00:00 committed by Tim Flynn
parent 2a66fc6cae
commit 22089436ed
161 changed files with 367 additions and 370 deletions

View file

@ -34,7 +34,7 @@ WebIDL::ExceptionOr<Body> Body::clone() const
// FIXME: 1. Let « out1, out2 » be the result of teeing bodys stream.
// FIXME: 2. Set bodys stream to out1.
auto* out2 = vm.heap().allocate<Streams::ReadableStream>(realm, realm);
auto out2 = vm.heap().allocate<Streams::ReadableStream>(realm, realm);
// 3. Return a body whose stream is out2 and other members are copied from body.
return Body { JS::make_handle(out2), m_source, m_length };

View file

@ -48,7 +48,7 @@ ErrorOr<Header> Header::from_string_pair(StringView name, StringView value)
JS::NonnullGCPtr<HeaderList> HeaderList::create(JS::VM& vm)
{
return { *vm.heap().allocate_without_realm<HeaderList>() };
return vm.heap().allocate_without_realm<HeaderList>();
}
// https://fetch.spec.whatwg.org/#header-list-contains

View file

@ -28,7 +28,7 @@ void Request::visit_edges(JS::Cell::Visitor& visitor)
JS::NonnullGCPtr<Request> Request::create(JS::VM& vm)
{
return { *vm.heap().allocate_without_realm<Request>(HeaderList::create(vm)) };
return vm.heap().allocate_without_realm<Request>(HeaderList::create(vm));
}
// https://fetch.spec.whatwg.org/#concept-request-url

View file

@ -29,7 +29,7 @@ void Response::visit_edges(JS::Cell::Visitor& visitor)
JS::NonnullGCPtr<Response> Response::create(JS::VM& vm)
{
return { *vm.heap().allocate_without_realm<Response>(HeaderList::create(vm)) };
return vm.heap().allocate_without_realm<Response>(HeaderList::create(vm));
}
// https://fetch.spec.whatwg.org/#ref-for-concept-network-error%E2%91%A3
@ -193,7 +193,7 @@ ErrorOr<JS::NonnullGCPtr<BasicFilteredResponse>> BasicFilteredResponse::create(J
TRY(header_list->append(header));
}
return { *vm.heap().allocate_without_realm<BasicFilteredResponse>(internal_response, header_list) };
return vm.heap().allocate_without_realm<BasicFilteredResponse>(internal_response, header_list);
}
BasicFilteredResponse::BasicFilteredResponse(JS::NonnullGCPtr<Response> internal_response, JS::NonnullGCPtr<HeaderList> header_list)
@ -223,7 +223,7 @@ ErrorOr<JS::NonnullGCPtr<CORSFilteredResponse>> CORSFilteredResponse::create(JS:
TRY(header_list->append(header));
}
return { *vm.heap().allocate_without_realm<CORSFilteredResponse>(internal_response, header_list) };
return vm.heap().allocate_without_realm<CORSFilteredResponse>(internal_response, header_list);
}
CORSFilteredResponse::CORSFilteredResponse(JS::NonnullGCPtr<Response> internal_response, JS::NonnullGCPtr<HeaderList> header_list)
@ -242,7 +242,7 @@ JS::NonnullGCPtr<OpaqueFilteredResponse> OpaqueFilteredResponse::create(JS::VM&
{
// An opaque filtered response is a filtered response whose type is "opaque", URL list is the empty list,
// status is 0, status message is the empty byte sequence, header list is empty, and body is null.
return { *vm.heap().allocate_without_realm<OpaqueFilteredResponse>(internal_response, HeaderList::create(vm)) };
return vm.heap().allocate_without_realm<OpaqueFilteredResponse>(internal_response, HeaderList::create(vm));
}
OpaqueFilteredResponse::OpaqueFilteredResponse(JS::NonnullGCPtr<Response> internal_response, JS::NonnullGCPtr<HeaderList> header_list)
@ -261,7 +261,7 @@ JS::NonnullGCPtr<OpaqueRedirectFilteredResponse> OpaqueRedirectFilteredResponse:
{
// An opaque-redirect filtered response is a filtered response whose type is "opaqueredirect",
// status is 0, status message is the empty byte sequence, header list is empty, and body is null.
return { *vm.heap().allocate_without_realm<OpaqueRedirectFilteredResponse>(internal_response, HeaderList::create(vm)) };
return vm.heap().allocate_without_realm<OpaqueRedirectFilteredResponse>(internal_response, HeaderList::create(vm));
}
OpaqueRedirectFilteredResponse::OpaqueRedirectFilteredResponse(JS::NonnullGCPtr<Response> internal_response, JS::NonnullGCPtr<HeaderList> header_list)