From c113c092eeb1235c2099f0186087bd85e3e3f8c6 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Thu, 23 Sep 2021 18:43:00 +0200 Subject: [PATCH] LibWeb: Make HTML::EventLoop::process() a no-op if there are no tasks --- Userland/Libraries/LibWeb/HTML/EventLoop/EventLoop.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Userland/Libraries/LibWeb/HTML/EventLoop/EventLoop.cpp b/Userland/Libraries/LibWeb/HTML/EventLoop/EventLoop.cpp index 556f842ca8..5da9f66f05 100644 --- a/Userland/Libraries/LibWeb/HTML/EventLoop/EventLoop.cpp +++ b/Userland/Libraries/LibWeb/HTML/EventLoop/EventLoop.cpp @@ -91,6 +91,9 @@ void EventLoop::process() // 1. Let taskQueue be one of the event loop's task queues, chosen in an implementation-defined manner, with the constraint that the chosen task queue must contain at least one runnable task. If there is no such task queue, then jump to the microtasks step below. auto& task_queue = m_task_queue; + if (task_queue.is_empty()) + return; + // 2. Let oldestTask be the first runnable task in taskQueue, and remove it from taskQueue. auto oldest_task = task_queue.take_first_runnable();