1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 23:58:11 +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:
Andreas Kling 2020-10-23 08:31:26 +02:00
parent 691b105885
commit 46c15276e9
7 changed files with 11 additions and 9 deletions

View file

@ -57,7 +57,7 @@ class Document
public:
using WrapperType = Bindings::DocumentWrapper;
explicit Document(const URL& = {});
static NonnullRefPtr<Document> create(const URL& url = {}) { return adopt(*new Document(url)); }
virtual ~Document() override;
void set_url(const URL& url) { m_url = url; }
@ -192,6 +192,8 @@ public:
Window& window() { return *m_window; }
private:
explicit Document(const URL&);
virtual RefPtr<LayoutNode> create_layout_node(const CSS::StyleProperties* parent_style) override;
void tear_down_layout_tree();