mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-26 11:20:03 +00:00
LibHTML: Make parse_html_document() return a RefPtr
Parsing might not always succeed, so let's have a way to signal errors.
This commit is contained in:
@@ -318,13 +318,13 @@ RefPtr<DocumentFragment> parse_html_fragment(Document& document, const StringVie
|
||||
return fragment;
|
||||
}
|
||||
|
||||
NonnullRefPtr<Document> parse_html_document(const StringView& html, const URL& url)
|
||||
RefPtr<Document> parse_html_document(const StringView& html, const URL& url)
|
||||
{
|
||||
auto document = adopt(*new Document);
|
||||
document->set_url(url);
|
||||
|
||||
bool success = parse_html_document(html, *document, *document);
|
||||
ASSERT(success);
|
||||
if (!parse_html_document(html, *document, *document))
|
||||
return nullptr;
|
||||
|
||||
document->fixup();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user