1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 04:47: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:
Andreas Kling 2022-10-17 10:46:11 +02:00
parent 68452c749a
commit 6e0f80fbe0
8 changed files with 71 additions and 35 deletions

View file

@ -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;