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:
Jelle Raaijmakers 2025-11-24 09:56:05 +01:00 committed by Sam Atkins
parent 150828af98
commit e281e3a274
Notes: github-actions[bot] 2025-11-24 12:46:48 +00:00
4 changed files with 6 additions and 19 deletions

View file

@ -14,7 +14,7 @@ namespace Web::HTML {
NonnullOwnPtr<SimilarOriginWindowAgent> SimilarOriginWindowAgent::create(GC::Heap& heap)
{
// See 'creating an agent' step in: https://html.spec.whatwg.org/multipage/webappapis.html#obtain-similar-origin-window-agent
auto agent = adopt_own(*new SimilarOriginWindowAgent(CanBlock::No));
auto agent = adopt_own(*new SimilarOriginWindowAgent(heap, CanBlock::No));
agent->event_loop = heap.allocate<HTML::EventLoop>(HTML::EventLoop::Type::Window);
return agent;
}