mirror of
https://github.com/servo/servo.git
synced 2025-08-03 20:50:07 +01:00
Reject decode when src and srcset are missing
Signed-off-by: Bentaimia Haddadi <haddadi.taym@gmail.com>
This commit is contained in:
parent
aae04c6699
commit
c117c01b0e
1 changed files with 5 additions and 0 deletions
|
@ -1173,6 +1173,7 @@ impl HTMLImageElement {
|
||||||
// Step 2 for <https://html.spec.whatwg.org/multipage/#dom-img-decode>
|
// Step 2 for <https://html.spec.whatwg.org/multipage/#dom-img-decode>
|
||||||
fn react_to_decode_image_sync_steps(&self) {
|
fn react_to_decode_image_sync_steps(&self) {
|
||||||
let document = document_from_node(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>
|
// Step 2.1 of <https://html.spec.whatwg.org/multipage/#dom-img-decode>
|
||||||
if !document.is_fully_active() ||
|
if !document.is_fully_active() ||
|
||||||
matches!(self.current_request.borrow().state, State::Broken)
|
matches!(self.current_request.borrow().state, State::Broken)
|
||||||
|
@ -1183,6 +1184,10 @@ impl HTMLImageElement {
|
||||||
State::CompletelyAvailable
|
State::CompletelyAvailable
|
||||||
) {
|
) {
|
||||||
self.resolve_image_decode_promises();
|
self.resolve_image_decode_promises();
|
||||||
|
} else if !elem.has_attribute(&local_name!("src")) &&
|
||||||
|
!elem.has_attribute(&local_name!("srcset"))
|
||||||
|
{
|
||||||
|
self.reject_image_decode_promises();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue