1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-14 11:44:58 +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

@ -462,13 +462,13 @@ void HTMLParser::handle_initial(HTMLToken& token)
}
if (token.is_comment()) {
auto comment = realm().heap().allocate<DOM::Comment>(realm(), document(), token.comment());
auto comment = realm().heap().allocate<DOM::Comment>(realm(), document(), token.comment()).release_allocated_value_but_fixme_should_propagate_errors();
MUST(document().append_child(*comment));
return;
}
if (token.is_doctype()) {
auto doctype = realm().heap().allocate<DOM::DocumentType>(realm(), document());
auto doctype = realm().heap().allocate<DOM::DocumentType>(realm(), document()).release_allocated_value_but_fixme_should_propagate_errors();
doctype->set_name(token.doctype_data().name);
doctype->set_public_id(token.doctype_data().public_identifier);
doctype->set_system_id(token.doctype_data().system_identifier);
@ -497,7 +497,7 @@ void HTMLParser::handle_before_html(HTMLToken& token)
// -> A comment token
if (token.is_comment()) {
// Insert a comment as the last child of the Document object.
auto comment = realm().heap().allocate<DOM::Comment>(realm(), document(), token.comment());
auto comment = realm().heap().allocate<DOM::Comment>(realm(), document(), token.comment()).release_allocated_value_but_fixme_should_propagate_errors();
MUST(document().append_child(*comment));
return;
}
@ -759,7 +759,7 @@ AnythingElse:
void HTMLParser::insert_comment(HTMLToken& token)
{
auto adjusted_insertion_location = find_appropriate_place_for_inserting_node();
adjusted_insertion_location.parent->insert_before(realm().heap().allocate<DOM::Comment>(realm(), document(), token.comment()), adjusted_insertion_location.insert_before_sibling);
adjusted_insertion_location.parent->insert_before(realm().heap().allocate<DOM::Comment>(realm(), document(), token.comment()).release_allocated_value_but_fixme_should_propagate_errors(), adjusted_insertion_location.insert_before_sibling);
}
void HTMLParser::handle_in_head(HTMLToken& token)
@ -945,7 +945,7 @@ DOM::Text* HTMLParser::find_character_insertion_node()
return nullptr;
if (adjusted_insertion_location.parent->last_child() && adjusted_insertion_location.parent->last_child()->is_text())
return verify_cast<DOM::Text>(adjusted_insertion_location.parent->last_child());
auto new_text_node = realm().heap().allocate<DOM::Text>(realm(), document(), "");
auto new_text_node = realm().heap().allocate<DOM::Text>(realm(), document(), "").release_allocated_value_but_fixme_should_propagate_errors();
MUST(adjusted_insertion_location.parent->append_child(*new_text_node));
return new_text_node;
}
@ -1071,7 +1071,7 @@ void HTMLParser::handle_after_body(HTMLToken& token)
if (token.is_comment()) {
auto& insertion_location = m_stack_of_open_elements.first();
MUST(insertion_location.append_child(realm().heap().allocate<DOM::Comment>(realm(), document(), token.comment())));
MUST(insertion_location.append_child(realm().heap().allocate<DOM::Comment>(realm(), document(), token.comment()).release_allocated_value_but_fixme_should_propagate_errors()));
return;
}
@ -1107,7 +1107,7 @@ void HTMLParser::handle_after_body(HTMLToken& token)
void HTMLParser::handle_after_after_body(HTMLToken& token)
{
if (token.is_comment()) {
auto comment = realm().heap().allocate<DOM::Comment>(realm(), document(), token.comment());
auto comment = realm().heap().allocate<DOM::Comment>(realm(), document(), token.comment()).release_allocated_value_but_fixme_should_propagate_errors();
MUST(document().append_child(*comment));
return;
}
@ -3181,7 +3181,7 @@ void HTMLParser::handle_after_frameset(HTMLToken& token)
void HTMLParser::handle_after_after_frameset(HTMLToken& token)
{
if (token.is_comment()) {
auto comment = document().heap().allocate<DOM::Comment>(document().realm(), document(), token.comment());
auto comment = document().heap().allocate<DOM::Comment>(document().realm(), document(), token.comment()).release_allocated_value_but_fixme_should_propagate_errors();
MUST(document().append_child(comment));
return;
}