LibWeb: Implement EventSource for server-sent events

EventSource allows opening a persistent HTTP connection to a server over
which events are continuously streamed.

Unfortunately, our test infrastructure does not allow for automating any
tests of this feature yet. It only works with HTTP connections.
This commit is contained in:
Timothy Flynn 2024-04-05 13:33:41 -04:00 committed by Andreas Kling
commit eb3b8f8ee4
Notes: sideshowbarker 2024-07-16 16:23:32 +09:00
12 changed files with 619 additions and 1 deletions

View file

@ -64,6 +64,10 @@ public:
void queue_the_performance_observer_task();
void register_event_source(Badge<EventSource>, JS::NonnullGCPtr<EventSource>);
void unregister_event_source(Badge<EventSource>, JS::NonnullGCPtr<EventSource>);
void forcibly_close_all_event_sources();
void run_steps_after_a_timeout(i32 timeout, Function<void()> completion_step);
[[nodiscard]] JS::NonnullGCPtr<HighResolutionTime::Performance> performance();
@ -103,6 +107,8 @@ private:
// NOTE: See the PerformanceEntryTuple struct above for the map's value tuple.
OrderedHashMap<FlyString, PerformanceTimeline::PerformanceEntryTuple> m_performance_entry_buffer_map;
HashTable<JS::NonnullGCPtr<EventSource>> m_registered_event_sources;
JS::GCPtr<HighResolutionTime::Performance> m_performance;
JS::GCPtr<IndexedDB::IDBFactory> m_indexed_db;