1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 09:58:11 +00:00

LibWeb: Make History GC-allocated

This commit is contained in:
Andreas Kling 2022-09-02 13:50:24 +02:00
parent abfb73f2e7
commit 16fbb91aa1
7 changed files with 40 additions and 25 deletions

View file

@ -281,7 +281,6 @@ Document::Document(HTML::Window& window, const AK::URL& url)
, m_style_computer(make<CSS::StyleComputer>(*this))
, m_url(url)
, m_window(window)
, m_history(HTML::History::create(*this))
{
set_prototype(&window.ensure_web_prototype<Bindings::DocumentPrototype>("Document"));
@ -315,6 +314,7 @@ void Document::visit_edges(Cell::Visitor& visitor)
visitor.visit(m_current_script.ptr());
visitor.visit(m_associated_inert_template_document.ptr());
visitor.visit(m_pending_parsing_blocking_script.ptr());
visitor.visit(m_history.ptr());
for (auto& script : m_scripts_to_execute_when_parsing_has_finished)
visitor.visit(script.ptr());
@ -1812,4 +1812,11 @@ CSS::StyleSheetList const& Document::style_sheets() const
return const_cast<Document*>(this)->style_sheets();
}
JS::NonnullGCPtr<HTML::History> Document::history()
{
if (!m_history)
m_history = HTML::History::create(window(), *this);
return *m_history;
}
}