mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-27 02:05:07 +02:00
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.
This commit is contained in:
committed by
Andreas Kling
parent
71ba774083
commit
c8baa6e179
Notes:
github-actions[bot]
2026-03-19 20:25:47 +00:00
Author: https://github.com/gmta Commit: https://github.com/LadybirdBrowser/ladybird/commit/c8baa6e179a Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/8513
@@ -51,15 +51,7 @@ void Task::execute()
|
||||
bool Task::is_runnable() const
|
||||
{
|
||||
// A task is runnable if its document is either null or fully active.
|
||||
if (!m_document)
|
||||
return true;
|
||||
|
||||
// AD-HOC: If the document has been destroyed, we'll consider the task runnable.
|
||||
// Otherwise it would get stuck here forever, since a destroyed document never becomes fully active again.
|
||||
if (m_document->has_been_destroyed())
|
||||
return true;
|
||||
|
||||
return m_document->is_fully_active();
|
||||
return !m_document || m_document->is_fully_active();
|
||||
}
|
||||
|
||||
DOM::Document const* Task::document() const
|
||||
|
||||
Reference in New Issue
Block a user