mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
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>
This commit is contained in:
parent
9a03911abf
commit
6defd7011b
7 changed files with 34 additions and 21 deletions
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue