Commit graph

11 commits

Author SHA1 Message Date
Jelle Raaijmakers
a5000d07c0 LibWeb: Prevent running permanently unrunnable tasks in EventLoop
In `::spin_processing_tasks_with_source_until()`, we would first take a
set of tasks based on a filter, and then run them one by one. If there
was more than one task matched and put in that vector, they could
interfere with each other's runnability by making later tasks
permanently unrunnable.

The `::take_tasks_matching()` API is a footgun - remove it in favor of
an API that takes tasks one by one, performing the runnability check
just in time.
2026-03-26 18:48:27 +01:00
Jelle Raaijmakers
f5d76ec2d0 LibWeb: Simplify TaskQueue::remove_tasks_matching()
No functional changes.
2026-03-26 18:48:27 +01:00
Jelle Raaijmakers
624d514f47 LibWeb: Remove tasks for destroyed documents when filtering on tasks
In TaskQueue::take_tasks_matching(), we were not discarding tasks for
destroyed documents as we now do in ::take_first_runnable() since commit
c8baa6e179.

This fixes some occurrences of missing browsing contexts / active
documents in TraversableNavigable::destroy_top_level_traversable().
2026-03-22 14:26:50 -05:00
Jelle Raaijmakers
eb293197f7 LibWeb: Simplify TaskQueue::has_rendering_tasks()
No functional changes.
2026-03-22 14:26:50 -05:00
Jelle Raaijmakers
c8baa6e179 LibWeb: Remove tasks for destroyed documents instead of running them
Previously, destroyed-document tasks were forced to be runnable to
prevent them from leaking in the task queue. Instead, discard them
during task selection so their callbacks never run with stale state.

This used to cause issues with a couple of `spin_until()`s in the past,
but since we've removed some of them that had to do with the document
lifecycle, let's see if we can stick closer to the spec now.
2026-03-19 15:24:46 -05:00
Andreas Kling
418a243c04 LibWeb: Don't run tasks in documents that haven't been BC associated
Documents that have never been associated with a browsing context will
never become "fully active" so we shouldn't schedule tasks in them since
they'll never run.
2025-12-27 16:40:34 +01:00
Andreas Kling
7bc07662be LibWeb: Ignore HTML tasks enqueued in document used for fragment parsing
The inert temporary documents used for fragment parsing will never
become "fully active" and so any tasks associated with them will never
run. To avoid memory leaks, we now simply ignore any attempts to enqueue
tasks associated with such documents.
2025-12-27 16:40:34 +01:00
Aliaksandr Kalenik
4ca330adef LibWeb: Don't take rendering task from queue while running rendering
If event loop is already executing rendering task, we should not start
the next rendering task until the current one is finished.

Fixes https://github.com/LadybirdBrowser/ladybird/issues/3717
2025-02-27 17:33:32 +01:00
Andreas Kling
3bfb0534be LibGC: Rename MarkedVector => RootVector
Let's try to make it a bit more clear that this is a Vector of GC roots.
2024-12-26 19:10:44 +01:00
Shannon Booth
f87041bf3a LibGC+Everywhere: Factor out a LibGC from LibJS
Resulting in a massive rename across almost everywhere! Alongside the
namespace change, we now have the following names:

 * JS::NonnullGCPtr -> GC::Ref
 * JS::GCPtr -> GC::Ptr
 * JS::HeapFunction -> GC::Function
 * JS::CellImpl -> GC::Cell
 * JS::Handle -> GC::Root
2024-11-15 14:49:20 +01:00
Timothy Flynn
93712b24bf Everywhere: Hoist the Libraries folder to the top-level 2024-11-10 12:50:45 +01:00
Renamed from Userland/Libraries/LibWeb/HTML/EventLoop/TaskQueue.cpp (Browse further)