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:
Martin Robinson 2023-01-11 10:10:17 +01:00
parent 9a03911abf
commit 6defd7011b
7 changed files with 34 additions and 21 deletions

View file

@ -253,6 +253,7 @@ impl LoadKeyGenerator {
}
}
#[derive(Debug)]
enum LoadResult {
Loaded(Image),
PlaceholderLoaded(Arc<Image>),
@ -339,6 +340,7 @@ struct ImageCacheStore {
impl ImageCacheStore {
// Change state of a url from pending -> loaded.
fn complete_load(&mut self, key: LoadKey, mut load_result: LoadResult) {
debug!("Completed decoding for {:?}", load_result);
let pending_load = match self.pending_loads.remove(&key) {
Some(load) => load,
None => return,