htmlimageelement: Reject decode promises on the current request mutation (#37828)

Follow the HTML specification and reject the pending image decode
promises
on any current request mutation.
https://html.spec.whatwg.org/multipage/#updating-the-image-data (step
18)
https://html.spec.whatwg.org/multipage/#dom-img-decode (step 3)

Fulfill and reject image decode promises by queueing
a global tasks on the DOM manipulation task source.

Testing: Improvements in the following tests
- html/semantics/embedded-content/the-img-element/decode/*

Signed-off-by: Andrei Volykhin <andrei.volykhin@gmail.com>
This commit is contained in:
Andrei Volykhin 2025-07-02 12:29:47 +03:00 committed by GitHub
parent 45fb0bac82
commit 4cbadde144
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 58 additions and 48 deletions

View file

@ -97,6 +97,7 @@ pub(crate) fn throw_dom_exception(
Error::NotReadable => DOMErrorName::NotReadableError,
Error::Operation => DOMErrorName::OperationError,
Error::NotAllowed => DOMErrorName::NotAllowedError,
Error::Encoding => DOMErrorName::EncodingError,
Error::Type(message) => unsafe {
assert!(!JS_IsExceptionPending(*cx));
throw_type_error(*cx, &message);