1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 23:17:46 +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:
Andreas Kling 2021-12-09 12:51:05 +01:00
parent e1287a9a45
commit d368b08698
4 changed files with 22 additions and 14 deletions

View file

@ -22,7 +22,6 @@
#include <LibWeb/CSS/StyleComputer.h>
#include <LibWeb/CSS/StyleSheetList.h>
#include <LibWeb/Cookie/Cookie.h>
#include <LibWeb/DOM/DOMImplementation.h>
#include <LibWeb/DOM/ExceptionOr.h>
#include <LibWeb/DOM/NonElementParentNode.h>
#include <LibWeb/DOM/ParentNode.h>
@ -264,7 +263,7 @@ public:
void completely_finish_loading();
const NonnullRefPtr<DOMImplementation> implementation() const { return m_implementation; }
NonnullRefPtr<DOMImplementation> implementation() const;
RefPtr<HTML::HTMLScriptElement> current_script() const { return m_current_script; }
void set_current_script(Badge<HTML::HTMLScriptElement>, RefPtr<HTML::HTMLScriptElement> script) { m_current_script = move(script); }
@ -376,7 +375,7 @@ private:
bool m_ready_for_post_load_tasks { false };
NonnullRefPtr<DOMImplementation> m_implementation;
NonnullOwnPtr<DOMImplementation> m_implementation;
RefPtr<HTML::HTMLScriptElement> m_current_script;
bool m_should_invalidate_styles_on_attribute_changes { true };