diff options
author | Martin Robinson <mrobinson@igalia.com> | 2023-01-11 10:10:17 +0100 |
---|---|---|
committer | Martin Robinson <mrobinson@igalia.com> | 2023-01-11 12:27:27 +0100 |
commit | 6defd7011be4871e9a72740e1f6abdf36383bf1f (patch) | |
tree | def270c041163eb2e2562e4a000291c89fed27d4 /components/script/dom/htmlmediaelement.rs | |
parent | 9a03911abfbbec21801b90c3ba9e5632ce403dde (diff) | |
download | servo-6defd7011be4871e9a72740e1f6abdf36383bf1f.tar.gz servo-6defd7011be4871e9a72740e1f6abdf36383bf1f.zip |
Fix intermittency when loading poster images
Wait until a poster image is cached to in order to unblock document load. If
not, the document may continue loading before the image is ready to use,
leading to intermittency in test output. Now load is unblocked when
getting the ImageResponse from the cache, which allows the code to
properly unblock the load when the entire load fails or succeeds.
This reveals several false passes in the `object-view-box` test suite
which were very flaky.
Fixes #29204.
Fixes #29188.
Fixes #29179.
Signed-off-by: Martin Robinson <mrobinson@igalia.com>
Diffstat (limited to 'components/script/dom/htmlmediaelement.rs')
-rw-r--r-- | components/script/dom/htmlmediaelement.rs | 26 |
1 files changed, 11 insertions, 15 deletions
diff --git a/components/script/dom/htmlmediaelement.rs b/components/script/dom/htmlmediaelement.rs index fcb38aa1427..f5043cac0ea 100644 --- a/components/script/dom/htmlmediaelement.rs +++ b/components/script/dom/htmlmediaelement.rs @@ -76,7 +76,6 @@ use ipc_channel::ipc; use ipc_channel::router::ROUTER; use media::{glplayer_channel, GLPlayerMsg, GLPlayerMsgForward, WindowGLContext}; use net_traits::image::base::Image; -use net_traits::image_cache::ImageResponse; use net_traits::request::Destination; use net_traits::{CoreResourceMsg, FetchChannels, FetchMetadata, FetchResponseListener, Metadata}; use net_traits::{NetworkError, ResourceFetchTiming, ResourceTimingType}; @@ -1306,25 +1305,22 @@ impl HTMLMediaElement { } /// https://html.spec.whatwg.org/multipage/#poster-frame - pub fn process_poster_response(&self, image: ImageResponse) { + pub fn process_poster_image_loaded(&self, image: Arc<Image>) { if !self.show_poster.get() { return; } // Step 6. - if let ImageResponse::Loaded(image, _) = image { - self.video_renderer - .lock() - .unwrap() - .render_poster_frame(image); - self.upcast::<Node>().dirty(NodeDamage::OtherNodeDamage); - if pref!(media.testing.enabled) { - let window = window_from_node(self); - let task_source = window.task_manager().media_element_task_source(); - task_source.queue_simple_event(self.upcast(), atom!("postershown"), &window); - } else { - return; - } + self.video_renderer + .lock() + .unwrap() + .render_poster_frame(image); + self.upcast::<Node>().dirty(NodeDamage::OtherNodeDamage); + + if pref!(media.testing.enabled) { + let window = window_from_node(self); + let task_source = window.task_manager().media_element_task_source(); + task_source.queue_simple_event(self.upcast(), atom!("postershown"), &window); } } |