Skip to content

Commit

Permalink
Ensure that any image tasks queued before a cached image is available…
Browse files Browse the repository at this point in the history
… are ignored.
  • Loading branch information
jdm committed Nov 30, 2018
1 parent 097c85e commit 896a2de
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion components/script/dom/htmlimageelement.rs
Expand Up @@ -964,14 +964,17 @@ impl HTMLImageElement {
CanRequestImages::No,
);
if let Ok(ImageOrMetadataAvailable::ImageAvailable(image, url)) = response {
// Cancel any outstanding tasks that were queued before the src was
// set on this element.
self.generation.set(self.generation.get() + 1);
// Step 6.3
let metadata = ImageMetadata {
height: image.height,
width: image.width,
};
// Step 6.3.2 abort requests
self.abort_request(State::CompletelyAvailable, ImageRequestPhase::Current);
self.abort_request(State::CompletelyAvailable, ImageRequestPhase::Pending);
self.abort_request(State::Unavailable, ImageRequestPhase::Pending);
let mut current_request = self.current_request.borrow_mut();
current_request.final_url = Some(url);
current_request.image = Some(image.clone());
Expand Down

0 comments on commit 896a2de

Please sign in to comment.