mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 17:47:44 +00:00
LibWeb: Make DOMImplementation forward its ref count to DOM::Document
This allows document.implementation to keep the underlying document alive for as long as we need it (for example, if someone holds on to a DOMImplementation JS wrapper after the document is GC'd.)
This commit is contained in:
parent
e1287a9a45
commit
d368b08698
4 changed files with 22 additions and 14 deletions
|
@ -22,6 +22,7 @@
|
|||
#include <LibWeb/DOM/Comment.h>
|
||||
#include <LibWeb/DOM/CustomEvent.h>
|
||||
#include <LibWeb/DOM/DOMException.h>
|
||||
#include <LibWeb/DOM/DOMImplementation.h>
|
||||
#include <LibWeb/DOM/Document.h>
|
||||
#include <LibWeb/DOM/DocumentFragment.h>
|
||||
#include <LibWeb/DOM/DocumentType.h>
|
||||
|
@ -71,7 +72,7 @@ Document::Document(const AK::URL& url)
|
|||
, m_style_sheets(CSS::StyleSheetList::create(*this))
|
||||
, m_url(url)
|
||||
, m_window(Window::create_with_document(*this))
|
||||
, m_implementation(DOMImplementation::create(*this))
|
||||
, m_implementation(DOMImplementation::create({}, *this))
|
||||
, m_history(HTML::History::create(*this))
|
||||
{
|
||||
HTML::main_thread_event_loop().register_document({}, *this);
|
||||
|
@ -1136,4 +1137,9 @@ void Document::evaluate_media_queries_and_report_changes()
|
|||
}
|
||||
}
|
||||
|
||||
NonnullRefPtr<DOMImplementation> Document::implementation() const
|
||||
{
|
||||
return *m_implementation;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue