1
0
Fork 0
mirror of https://github.com/LadybirdBrowser/ladybird.git synced 2025-06-10 18:10:56 +09: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:
Andreas Kling 2022-10-17 10:46:11 +02:00
parent 68452c749a
commit 6e0f80fbe0
Notes: sideshowbarker 2024-07-18 04:38:32 +09:00
8 changed files with 71 additions and 35 deletions

View file

@ -340,6 +340,8 @@ void Document::visit_edges(Cell::Visitor& visitor)
visitor.visit(m_all);
visitor.visit(m_selection);
visitor.visit(m_parser);
for (auto& script : m_scripts_to_execute_when_parsing_has_finished)
visitor.visit(script.ptr());
for (auto& script : m_scripts_to_execute_as_soon_as_possible)
@ -2149,7 +2151,7 @@ void Document::abort()
}
// https://html.spec.whatwg.org/multipage/dom.html#active-parser
RefPtr<HTML::HTMLParser> Document::active_parser()
JS::GCPtr<HTML::HTMLParser> Document::active_parser()
{
if (!m_parser)
return nullptr;