aboutsummaryrefslogtreecommitdiffstats
path: root/components/layout/fragment.rs
diff options
context:
space:
mode:
authorBastien Orivel <eijebong@bananium.fr>2020-05-08 15:36:55 +0200
committerBastien Orivel <eijebong@bananium.fr>2020-05-08 19:15:24 +0200
commitbdbfde9ec0b5e80af0f63777b4cf2b31f5209f92 (patch)
tree530ee29432f48dfbbfecf618f3235d518e2ae471 /components/layout/fragment.rs
parent8249be38c9561f80b611610431a3e97531f67683 (diff)
downloadservo-bdbfde9ec0b5e80af0f63777b4cf2b31f5209f92.tar.gz
servo-bdbfde9ec0b5e80af0f63777b4cf2b31f5209f92.zip
Don't send a load event when a loaded image is actually the placeholder
The image cache returns an `ImageCacheResult::ImageAvailable `the second time you try getting the placeholder. This means that in some cases, the loading of an image would fail, then the same image would get fetched from the cache, the placeholder would be loaded from that but would be seen as a normal image, firing a load event. This made the tests in `fetch/cross-origin-resource-policy/image-loads.html` fail depending on their order.
Diffstat (limited to 'components/layout/fragment.rs')
-rw-r--r--components/layout/fragment.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/components/layout/fragment.rs b/components/layout/fragment.rs
index 289dc3f3094..062db9c0a7e 100644
--- a/components/layout/fragment.rs
+++ b/components/layout/fragment.rs
@@ -431,8 +431,8 @@ impl ImageFragmentInfo {
layout_context
.get_or_request_image_or_meta(node.opaque(), url, UsePlaceholder::Yes)
.map(|result| match result {
- ImageOrMetadataAvailable::ImageAvailable(i, _) => {
- ImageOrMetadata::Image(i)
+ ImageOrMetadataAvailable::ImageAvailable { image, .. } => {
+ ImageOrMetadata::Image(image)
},
ImageOrMetadataAvailable::MetadataAvailable(m) => {
ImageOrMetadata::Metadata(m)