mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 01:27:34 +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
|
@ -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;
|
||||
|
|
|
@ -428,7 +428,7 @@ public:
|
|||
void unload(bool recursive_flag = false, Optional<DocumentUnloadTimingInfo> = {});
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/dom.html#active-parser
|
||||
RefPtr<HTML::HTMLParser> active_parser();
|
||||
JS::GCPtr<HTML::HTMLParser> active_parser();
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/dom.html#load-timing-info
|
||||
DocumentLoadTimingInfo& load_timing_info() { return m_load_timing_info; }
|
||||
|
@ -478,7 +478,7 @@ private:
|
|||
RefPtr<Platform::Timer> m_style_update_timer;
|
||||
RefPtr<Platform::Timer> m_layout_update_timer;
|
||||
|
||||
RefPtr<HTML::HTMLParser> m_parser;
|
||||
JS::GCPtr<HTML::HTMLParser> m_parser;
|
||||
bool m_active_parser_was_aborted { false };
|
||||
|
||||
String m_source;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue