LibWeb: Always return task's ID after adding to a queue (or not)

Now that we don't always honor requests to add tasks to a queue, we
can't rely on "last added task" as the place to find the task's ID.
Fortunately we can just get it from the task itself.
This commit is contained in:
Andreas Kling
2025-12-27 15:14:06 +01:00
committed by Andreas Kling
parent 418a243c04
commit ade167ed33
Notes: github-actions[bot] 2025-12-27 15:42:06 +00:00
3 changed files with 5 additions and 5 deletions

View File

@@ -559,7 +559,7 @@ TaskID queue_a_task(HTML::Task::Source source, GC::Ptr<EventLoop> event_loop, GC
// 9. Append task to queue.
queue.add(task);
return queue.last_added_task()->id();
return task->id();
}
// https://html.spec.whatwg.org/multipage/webappapis.html#queue-a-global-task
@@ -595,7 +595,7 @@ void queue_a_microtask(DOM::Document const* document, GC::Ref<GC::Function<void(
// FIXME: 7. Set microtask's script evaluation environment settings object set to an empty set.
// 8. Enqueue microtask on event loop's microtask queue.
event_loop.microtask_queue().enqueue(microtask);
(void)event_loop.microtask_queue().enqueue(microtask);
}
void perform_a_microtask_checkpoint()