From 781fda5b6d76c71367ac5a7272a68780a2a59630 Mon Sep 17 00:00:00 2001 From: Bentaimia Haddadi Date: Wed, 7 Feb 2024 11:47:48 +0100 Subject: [PATCH] Temp --- components/script/dom/htmlimageelement.rs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/components/script/dom/htmlimageelement.rs b/components/script/dom/htmlimageelement.rs index ae525c10fa4..79c8fffc411 100644 --- a/components/script/dom/htmlimageelement.rs +++ b/components/script/dom/htmlimageelement.rs @@ -1616,12 +1616,19 @@ impl HTMLImageElementMethods for HTMLImageElement { // Step 2 let document = document_from_node(self); - if !document.is_fully_active() { + let ready = match self.current_request.borrow().state { + State::Unavailable => false, + State::PartiallyAvailable => false, + State::CompletelyAvailable => true, + State::Broken => false, + }; + + if document.is_fully_active() && ready && self.current_request.borrow().image.is_some() { promise.reject_native(&DOMException::new( &self.global(), DOMErrorName::EncodingError, )); - } else if self.current_request.borrow().image.is_some() { + } else { promise.resolve_native(&()); }