mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-10 13:00:29 +03:00
LibWeb: Make factory method of DOM::DocumentType fallible
This commit is contained in:
parent
5f552ddc5c
commit
c4d559bd37
Notes:
sideshowbarker
2024-07-17 10:08:28 +09:00
Author: https://github.com/kennethmyhra Commit: https://github.com/SerenityOS/serenity/commit/c4d559bd37 Pull-request: https://github.com/SerenityOS/serenity/pull/17491 Reviewed-by: https://github.com/linusg ✅
@ -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…
Reference in New Issue
Block a user