diff --git a/components/script/dom/htmlimageelement.rs b/components/script/dom/htmlimageelement.rs index 9404b20a3c1..22bdc942083 100644 --- a/components/script/dom/htmlimageelement.rs +++ b/components/script/dom/htmlimageelement.rs @@ -1190,6 +1190,7 @@ impl HTMLImageElement { for promise in self.image_decode_promises.borrow().iter() { promise.resolve_native(&()); } + self.image_decode_promises.borrow_mut().clear(); } fn reject_image_decode_promises(&self) { @@ -1200,6 +1201,7 @@ impl HTMLImageElement { DOMErrorName::EncodingError, )); } + self.image_decode_promises.borrow_mut().clear(); } /// Step 15 for @@ -1333,6 +1335,10 @@ impl HTMLImageElement { image.SetHeight(h); } + // run update_the_image_data when the element is created. + // https://html.spec.whatwg.org/multipage/#when-to-obtain-images + image.update_the_image_data(); + Ok(image) } pub fn areas(&self) -> Option>> {