mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-02-22 15:44:45 +00:00
LibWeb: Forbid interleaving execution of HTML tasks with same source
From HTML spec https://html.spec.whatwg.org/#definitions-3 "... Note that in this setup, the processing model still enforces that the user agent would never process events from any one task source out of order." I can't come up with an example that is fixed by this change. However, debugging a bug caused by violating this assumption from the spec is likely to be very painful.
This commit is contained in:
committed by
Andreas Kling
parent
ba633882bf
commit
664611bae4
@@ -39,7 +39,10 @@ JS::GCPtr<Task> TaskQueue::take_first_runnable()
|
||||
return nullptr;
|
||||
|
||||
for (size_t i = 0; i < m_tasks.size(); ++i) {
|
||||
if (m_tasks[i]->is_runnable())
|
||||
auto const& task = m_tasks[i];
|
||||
if (m_event_loop->is_task_source_blocked(task->source()))
|
||||
continue;
|
||||
if (task->is_runnable())
|
||||
return m_tasks.take(i);
|
||||
}
|
||||
return nullptr;
|
||||
@@ -51,6 +54,8 @@ bool TaskQueue::has_runnable_tasks() const
|
||||
return false;
|
||||
|
||||
for (auto& task : m_tasks) {
|
||||
if (m_event_loop->is_task_source_blocked(task->source()))
|
||||
continue;
|
||||
if (task->is_runnable())
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user