LibWeb: Use JS::HeapFunction for DocumentObserver callbacks

If GC-allocated object wants to own a function it should use
HeapFunction because using SafeFunction will almost always lead to a
leak.
This commit is contained in:
Aliaksandr Kalenik 2023-09-27 17:23:48 +02:00 committed by Andreas Kling
parent 12adaac08d
commit cad2d2c85b
Notes: sideshowbarker 2024-07-17 08:35:21 +09:00
4 changed files with 24 additions and 6 deletions

View file

@ -34,9 +34,9 @@ void SVGUseElement::initialize(JS::Realm& realm)
set_shadow_root(shadow_root);
m_document_observer = realm.heap().allocate<DOM::DocumentObserver>(realm, realm, document());
m_document_observer->document_completely_loaded = [this]() {
m_document_observer->set_document_completely_loaded([this]() {
clone_element_tree_as_our_shadow_tree(referenced_element());
};
});
}
void SVGUseElement::visit_edges(Cell::Visitor& visitor)