mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 04:17:35 +00:00
LibWeb: Make the HTMLParser GC-allocated
This prevents a reference cycle between a HTMLParser opened via document.open() and the document. It was one of many things keeping some documents alive indefinitely.
This commit is contained in:
parent
68452c749a
commit
6e0f80fbe0
8 changed files with 71 additions and 35 deletions
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2020, Andreas Kling <kling@serenityos.org>
|
||||
* Copyright (c) 2020-2022, Andreas Kling <kling@serenityos.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
@ -20,7 +20,7 @@ public:
|
|||
struct Entry {
|
||||
bool is_marker() const { return !element; }
|
||||
|
||||
JS::Handle<DOM::Element> element;
|
||||
JS::GCPtr<DOM::Element> element;
|
||||
};
|
||||
|
||||
bool is_empty() const { return m_entries.is_empty(); }
|
||||
|
@ -43,6 +43,8 @@ public:
|
|||
|
||||
Optional<size_t> find_index(DOM::Element const&) const;
|
||||
|
||||
void visit_edges(JS::Cell::Visitor&);
|
||||
|
||||
private:
|
||||
Vector<Entry> m_entries;
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue