1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 13:38:11 +00:00

LibJS+Everywhere: Propagate Cell::initialize errors from Heap::allocate

Callers that are already in a fallible context will now TRY to allocate
cells. Callers in infallible contexts get a FIXME.
This commit is contained in:
Timothy Flynn 2023-01-28 13:39:44 -05:00 committed by Linus Groh
parent 109b190a19
commit b75b7f0c0d
178 changed files with 565 additions and 565 deletions

View file

@ -77,10 +77,10 @@ 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).release_allocated_value_but_fixme_should_propagate_errors();
// 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 = realm.heap().allocate<Headers>(realm, realm, response->header_list()).release_allocated_value_but_fixme_should_propagate_errors();
response_object->m_headers->set_guard(guard);
// 4. Return responseObject.
@ -136,14 +136,14 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<Response>> Response::construct_impl(JS::Rea
auto& vm = realm.vm();
// Referred to as 'this' in the spec.
auto response_object = realm.heap().allocate<Response>(realm, realm, Infrastructure::Response::create(vm));
auto response_object = MUST_OR_THROW_OOM(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
// cannot exist with a null Infrastructure::Response.
// 2. Set thiss headers to a new Headers object with thiss relevant Realm, whose header list is thiss responses header list and guard is "response".
response_object->m_headers = realm.heap().allocate<Headers>(realm, realm, response_object->response()->header_list());
response_object->m_headers = MUST_OR_THROW_OOM(realm.heap().allocate<Headers>(realm, realm, response_object->response()->header_list()));
response_object->m_headers->set_guard(Headers::Guard::Response);
// 3. Let bodyWithType be null.