mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-26 01:35:08 +02:00
LibWeb: Do not spin the event loop awaiting text track state changes
The text track processing model would previously spin forever waiting for the track URL to change. It would then recursively invoke itself to handle the new URL, again entering the spin loop. This meant that tracks could easily cause event loop hangs. We now have an observer system to be notified when the track state changes instead. This lets us exit the processing model and move on.
This commit is contained in:
Notes:
github-actions[bot]
2025-06-12 16:26:50 +00:00
Author: https://github.com/trflynn89 Commit: https://github.com/LadybirdBrowser/ladybird/commit/de34143a4ef Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/5068 Reviewed-by: https://github.com/tcl3
@@ -7,8 +7,8 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <LibWeb/Forward.h>
|
||||
#include <LibWeb/HTML/HTMLElement.h>
|
||||
#include <LibWeb/HTML/TextTrack.h>
|
||||
|
||||
namespace Web::HTML {
|
||||
|
||||
@@ -33,8 +33,9 @@ private:
|
||||
void set_track_url(String);
|
||||
|
||||
void start_the_track_processing_model();
|
||||
void start_the_track_processing_model_parallel_steps(JS::Realm& realm);
|
||||
void start_the_track_processing_model_parallel_steps();
|
||||
|
||||
void track_became_ready();
|
||||
void track_failed_to_load();
|
||||
|
||||
// ^DOM::Element
|
||||
@@ -42,6 +43,7 @@ private:
|
||||
virtual void inserted() override;
|
||||
|
||||
GC::Ptr<TextTrack> m_track;
|
||||
GC::Ptr<TextTrackObserver> m_track_observer;
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/media.html#track-url
|
||||
String m_track_url {};
|
||||
@@ -50,6 +52,7 @@ private:
|
||||
GC::Ptr<Fetch::Infrastructure::FetchController> m_fetch_controller;
|
||||
|
||||
bool m_loading { false };
|
||||
bool m_awaiting_track_url_change { false };
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user