LibWeb: Make HTML::Task IDs a sequential, distinct numeric type

This also fixes a bug where task IDs were being deallocated from the
wrong IDAllocator. I don't know if it was actually possible to cause any
real trouble with that mistake, nor do I know how to write a test for
it, but this makes the bug go away.
This commit is contained in:
Andreas Kling 2024-08-04 17:10:49 +02:00 committed by Andreas Kling
parent 0e1256e5a4
commit 08d60d7521
Notes: github-actions[bot] 2024-08-05 07:12:59 +00:00
12 changed files with 33 additions and 29 deletions

View file

@ -16,6 +16,7 @@
#include <LibJS/SafeFunction.h>
#include <LibWeb/Fetch/Infrastructure/FetchTimingInfo.h>
#include <LibWeb/Forward.h>
#include <LibWeb/HTML/EventLoop/Task.h>
namespace Web::Fetch::Infrastructure {
@ -50,7 +51,7 @@ public:
void stop_fetch();
u64 next_fetch_task_id() { return m_next_fetch_task_id++; }
void fetch_task_queued(u64 fetch_task_id, int event_id);
void fetch_task_queued(u64 fetch_task_id, HTML::TaskID event_id);
void fetch_task_complete(u64 fetch_task_id);
private:
@ -84,7 +85,7 @@ private:
JS::GCPtr<FetchParams> m_fetch_params;
HashMap<u64, int> m_ongoing_fetch_tasks;
HashMap<u64, HTML::TaskID> m_ongoing_fetch_tasks;
u64 m_next_fetch_task_id { 0 };
};