mirror of
https://github.com/RGBCube/serenity
synced 2025-06-01 03:08:13 +00:00
LibWeb: Make factory method of DOM::DocumentType fallible
This commit is contained in:
parent
5f552ddc5c
commit
c4d559bd37
3 changed files with 4 additions and 4 deletions
|
@ -114,7 +114,7 @@ JS::NonnullGCPtr<Document> DOMImplementation::create_html_document(DeprecatedStr
|
|||
WebIDL::ExceptionOr<JS::NonnullGCPtr<DocumentType>> DOMImplementation::create_document_type(DeprecatedString const& qualified_name, DeprecatedString const& public_id, DeprecatedString const& system_id)
|
||||
{
|
||||
TRY(Document::validate_qualified_name(realm(), qualified_name));
|
||||
auto document_type = DocumentType::create(document());
|
||||
auto document_type = TRY(DocumentType::create(document()));
|
||||
document_type->set_name(qualified_name);
|
||||
document_type->set_public_id(public_id);
|
||||
document_type->set_system_id(system_id);
|
||||
|
|
|
@ -9,9 +9,9 @@
|
|||
|
||||
namespace Web::DOM {
|
||||
|
||||
JS::NonnullGCPtr<DocumentType> DocumentType::create(Document& document)
|
||||
WebIDL::ExceptionOr<JS::NonnullGCPtr<DocumentType>> DocumentType::create(Document& document)
|
||||
{
|
||||
return document.heap().allocate<DocumentType>(document.realm(), document).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
return MUST_OR_THROW_OOM(document.heap().allocate<DocumentType>(document.realm(), document));
|
||||
}
|
||||
|
||||
DocumentType::DocumentType(Document& document)
|
||||
|
|
|
@ -18,7 +18,7 @@ class DocumentType final
|
|||
WEB_PLATFORM_OBJECT(DocumentType, Node);
|
||||
|
||||
public:
|
||||
static JS::NonnullGCPtr<DocumentType> create(Document&);
|
||||
static WebIDL::ExceptionOr<JS::NonnullGCPtr<DocumentType>> create(Document&);
|
||||
|
||||
virtual ~DocumentType() override = default;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue