mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-05-18 00:52:57 +00:00
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:
parent
12adaac08d
commit
cad2d2c85b
Notes:
sideshowbarker
2024-07-17 08:35:21 +09:00
Author: https://github.com/kalenikaliaksandr
Commit: cad2d2c85b
Pull-request: https://github.com/SerenityOS/serenity/pull/21243
Reviewed-by: https://github.com/awesomekling
4 changed files with 24 additions and 6 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue