mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-25 19:04:58 +00:00
LibWeb: Fix Document construction mishap in <template> element
Ref-counted objects must not be stack allocated. Make DOM::Document's constructor private to avoid this issue. (I wish we could mark classes as heap-only..)
This commit is contained in:
@@ -63,7 +63,7 @@ static RefPtr<DOM::Document> create_markdown_document(const ByteBuffer& data, co
|
||||
|
||||
static RefPtr<DOM::Document> create_text_document(const ByteBuffer& data, const URL& url)
|
||||
{
|
||||
auto document = adopt(*new DOM::Document(url));
|
||||
auto document = DOM::Document::create(url);
|
||||
|
||||
auto html_element = document->create_element("html");
|
||||
document->append_child(html_element);
|
||||
@@ -88,7 +88,7 @@ static RefPtr<DOM::Document> create_text_document(const ByteBuffer& data, const
|
||||
|
||||
static RefPtr<DOM::Document> create_image_document(const ByteBuffer& data, const URL& url)
|
||||
{
|
||||
auto document = adopt(*new DOM::Document(url));
|
||||
auto document = DOM::Document::create(url);
|
||||
|
||||
auto image_decoder = Gfx::ImageDecoder::create(data.data(), data.size());
|
||||
auto bitmap = image_decoder->bitmap();
|
||||
|
||||
Reference in New Issue
Block a user