mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-12-08 06:09:58 +00:00
LibWeb: Move mutation observers from IntrusiveList to GC::RootVector
We need to prevent these mutation observers from being garbage collected, and since they are only part of SimilarOriginWindowAgent and themselves as part of the intrusive list, nobody is visiting them. Make the list of pending mutation observers a GC::RootVector so we keep them alive until they have been processed in the microtask. Restores 1400+ WPT subtest passes in `dom/nodes/Element-classlist.html`.
This commit is contained in:
parent
150828af98
commit
e281e3a274
Notes:
github-actions[bot]
2025-11-24 12:46:48 +00:00
Author: https://github.com/gmta
Commit: e281e3a274
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/6917
Reviewed-by: https://github.com/AtkinsSJ ✅
4 changed files with 6 additions and 19 deletions
|
|
@ -1,5 +1,6 @@
|
|||
/*
|
||||
* Copyright (c) 2025, Shannon Booth <shannon@serenityos.org>
|
||||
* Copyright (c) 2025, Jelle Raaijmakers <jelle@ladybird.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
|
@ -29,7 +30,7 @@ struct SimilarOriginWindowAgent : public Agent {
|
|||
|
||||
// https://dom.spec.whatwg.org/#mutation-observer-list
|
||||
// Each similar-origin window agent also has pending mutation observers (a set of zero or more MutationObserver objects), which is initially empty.
|
||||
DOM::MutationObserver::List pending_mutation_observers;
|
||||
GC::RootVector<GC::Ref<DOM::MutationObserver>> pending_mutation_observers;
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/custom-elements.html#custom-element-reactions-stack
|
||||
// Each similar-origin window agent has a custom element reactions stack, which is initially empty.
|
||||
|
|
@ -45,8 +46,9 @@ struct SimilarOriginWindowAgent : public Agent {
|
|||
Vector<GC::Root<DOM::Element>> const& current_element_queue() const { return custom_element_reactions_stack.element_queue_stack.last(); }
|
||||
|
||||
private:
|
||||
explicit SimilarOriginWindowAgent(CanBlock can_block)
|
||||
SimilarOriginWindowAgent(GC::Heap& heap, CanBlock can_block)
|
||||
: Agent(can_block)
|
||||
, pending_mutation_observers(heap)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue