1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 14:37:46 +00:00

LibWeb: Make factory method of DOM::Text fallible

This commit is contained in:
Kenneth Myhra 2023-02-15 07:47:47 +01:00 committed by Linus Groh
parent 2411dadc35
commit 200d22c650
2 changed files with 3 additions and 3 deletions

View file

@ -39,11 +39,11 @@ void Text::visit_edges(Cell::Visitor& visitor)
}
// https://dom.spec.whatwg.org/#dom-text-text
JS::NonnullGCPtr<Text> Text::construct_impl(JS::Realm& realm, DeprecatedString const& data)
WebIDL::ExceptionOr<JS::NonnullGCPtr<Text>> Text::construct_impl(JS::Realm& realm, DeprecatedString const& data)
{
// The new Text(data) constructor steps are to set thiss data to data and thiss node document to current global objects associated Document.
auto& window = verify_cast<HTML::Window>(HTML::current_global_object());
return realm.heap().allocate<Text>(realm, window.associated_document(), data).release_allocated_value_but_fixme_should_propagate_errors();
return MUST_OR_THROW_OOM(realm.heap().allocate<Text>(realm, window.associated_document(), data));
}
void Text::set_owner_input_element(Badge<HTML::HTMLInputElement>, HTML::HTMLInputElement& input_element)