WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED DUPLICATE of
bug 201243
188347
Calling .decode() on Image instance referencing an SVG throws an EncodingError
https://bugs.webkit.org/show_bug.cgi?id=188347
Summary
Calling .decode() on Image instance referencing an SVG throws an EncodingError
Marcel Miranda
Reported
2018-08-06 07:47:25 PDT
Calling the decode method on an Image instance referencing a SVG file throws an EncodingError exception I've created a small reproducible environment here:
https://codesandbox.io/s/xl6mq18704
Code to replicate ``` function loadImage(src, onLoad) { var image = new window.Image(); image.onload = function(e) { image.decode().then(() => onLoad(e)); }; image.src = src; return image; } loadImage('
https://xl6mq18704.codesandbox.io/img/refresh.svg
', (e) => document.body.appendChild(e.target)) ```
Attachments
Add attachment
proposed patch, testcase, etc.
Said Abou-Hallawa
Comment 1
2018-08-06 09:38:28 PDT
According to the specs
https://html.spec.whatwg.org/multipage/embedded-content.html#the-img-element
, the description of the decode() method is the following: image . decode() This method causes the user agent to decode the image in parallel, returning a promise that fulfills when decoding is complete. The promise will be rejected with an "EncodingError" DOMException if the image cannot be decoded. Image encoding is the process of compressing the image pixels data into a specialized format for efficient transmission or storage. Image decoding is the opposite process -- the conversion of an encoded format back into the original pixels data format. It is clear that The SVG image is not represented in pixels format and it is not saved in compressed format, unless it is a base-64 data URL. But the decoding of the base-64 data URL is different from the HTMLImageElement.deocde() and it is done implicitly as part of loading the SVG image sub-resource. So I think there is no bug here.
Simon Fraser (smfr)
Comment 2
2018-08-06 11:14:51 PDT
I think SVG should fall into the "If decoding does not need to be performed for this image (for example because it is a vector graphic), resolve promise with undefined." case, not the exception throwing case.
Said Abou-Hallawa
Comment 3
2019-09-01 13:14:40 PDT
*** This bug has been marked as a duplicate of
bug 201243
***
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug