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
198527
HTMLImageElement.decode() method doesn't work for SVG files
https://bugs.webkit.org/show_bug.cgi?id=198527
Summary
HTMLImageElement.decode() method doesn't work for SVG files
Frederic Junod
Reported
2019-06-04 06:30:41 PDT
The HTMLImageElement.decode() method never resolves when the src references a SVG image. To reproduce the issue: ``` const img = new Image(); img.src = '
https://unpkg.com/@mapbox/maki@4.0.0/icons/fuel-15.svg
'; img.decode() .then(() => { console.log('loaded'); }) .catch(() => { console.log('error'); }); ``` Expected behavior: `loaded` is displayed in the console. (this is the case on Chromium and Firefox)
Attachments
decode-svg
(297 bytes, text/html)
2019-06-06 12:25 PDT
,
Said Abou-Hallawa
no flags
Details
View All
Add attachment
proposed patch, testcase, etc.
Radar WebKit Bug Importer
Comment 1
2019-06-06 10:22:37 PDT
<
rdar://problem/51488679
>
Said Abou-Hallawa
Comment 2
2019-06-06 12:25:24 PDT
Created
attachment 371520
[details]
decode-svg
Said Abou-Hallawa
Comment 3
2019-06-06 12:26:08 PDT
What is the meaning of decoding an SVG image? And why do you expect the decode() promise to be resolved rather than being rejected? The specs
https://html.spec.whatwg.org/multipage/embedded-content.html#dom-img-decode
says: 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. Since the SVG image cannot be decoded, the promise is rejected. Open the attached test case.
Frederic Junod
Comment 4
2019-06-06 13:03:03 PDT
I understand that an SVG image doesn't needs to be decoded but the promise could nevertheless be resolved. Context: the decode function is used in the OpenLayers library [1] to load and decode images in any format See also:
https://chromium-review.googlesource.com/c/chromium/src/+/585220/
[1]
https://github.com/openlayers/openlayers/blob/v6.0.0-beta.9/src/ol/Image.js#L160-L175
Simon Fraser (smfr)
Comment 5
2019-06-06 15:39:08 PDT
The spec is explicit about vector images: "If decoding does not need to be performed for this image (for example because it is a vector graphic), resolve promise with undefined."
Said Abou-Hallawa
Comment 6
2019-11-13 13:49:05 PST
This was fixed in
r249367
and
r249594
. *** 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