Explorar o código

LibWeb/DOM: Conserve references to pending animations

This fixes a crash in:
 - css/css-animations/CSSAnimation-effect.tentative.html
Lucas CHOLLET hai 7 meses
pai
achega
906b7bf4e3
Modificáronse 1 ficheiros con 4 adicións e 1 borrados
  1. 4 1
      Libraries/LibWeb/DOM/Document.cpp

+ 4 - 1
Libraries/LibWeb/DOM/Document.cpp

@@ -4736,8 +4736,11 @@ void Document::update_animations_and_send_events(Optional<double> const& timesta
     HTML::perform_a_microtask_checkpoint();
 
     // 4. Let events to dispatch be a copy of doc’s pending animation event queue.
+    auto events_to_dispatch = GC::ConservativeVector<Document::PendingAnimationEvent> { vm().heap() };
+    events_to_dispatch.extend(m_pending_animation_event_queue);
+
     // 5. Clear doc’s pending animation event queue.
-    auto events_to_dispatch = move(m_pending_animation_event_queue);
+    m_pending_animation_event_queue.clear();
 
     // 6. Perform a stable sort of the animation events in events to dispatch as follows:
     auto sort_events_by_composite_order = [](auto const& a, auto const& b) {