1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 16:07:47 +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

@ -69,14 +69,14 @@ JS::NonnullGCPtr<Response> Response::create(JS::Realm& realm, JS::NonnullGCPtr<I
{
// 1. Let responseObject be a new Response object with realm.
// 2. Set responseObjects response to response.
auto* response_object = realm.heap().allocate<Response>(realm, realm, response);
auto response_object = realm.heap().allocate<Response>(realm, realm, response);
// 3. Set responseObjects headers to a new Headers object with realm, whose headers list is responses headers list and guard is guard.
response_object->m_headers = realm.heap().allocate<Headers>(realm, realm, response->header_list());
response_object->m_headers->set_guard(guard);
// 4. Return responseObject.
return JS::NonnullGCPtr { *response_object };
return response_object;
}
// https://fetch.spec.whatwg.org/#initialize-a-response
@ -126,7 +126,7 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<Response>> Response::construct_impl(JS::Rea
auto& vm = realm.vm();
// Referred to as 'this' in the spec.
auto response_object = JS::NonnullGCPtr { *realm.heap().allocate<Response>(realm, realm, Infrastructure::Response::create(vm)) };
auto response_object = realm.heap().allocate<Response>(realm, realm, Infrastructure::Response::create(vm));
// 1. Set thiss response to a new response.
// NOTE: This is done at the beginning as the 'this' value Response object