Skip to content

Commit

Permalink
Reject decode when src and srcset are missing
Browse files Browse the repository at this point in the history
Signed-off-by: Bentaimia Haddadi <haddadi.taym@gmail.com>
  • Loading branch information
Taym95 committed Jun 9, 2024
1 parent 652fb3a commit 1b57ab9
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions components/script/dom/htmlimageelement.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1173,6 +1173,7 @@ impl HTMLImageElement {
// Step 2 for <https://html.spec.whatwg.org/multipage/#dom-img-decode>
fn react_to_decode_image_sync_steps(&self) {
let document = document_from_node(self);
let elem = self.upcast::<Element>();
// Step 2.1 of <https://html.spec.whatwg.org/multipage/#dom-img-decode>
if !document.is_fully_active() ||
matches!(self.current_request.borrow().state, State::Broken)
Expand All @@ -1183,6 +1184,10 @@ impl HTMLImageElement {
State::CompletelyAvailable
) {
self.resolve_image_decode_promises();
} else if !elem.has_attribute(&local_name!("src")) &&
!elem.has_attribute(&local_name!("srcset"))
{
self.reject_image_decode_promises();
}
}

Expand Down

0 comments on commit 1b57ab9

Please sign in to comment.