You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I noticed this while working with a library that generated a SVG, but due to misconfiguration, it added another root element to the SVG, and noticed it'd always crash the process.
However, if svg has an extra root element, for example '<svg></svg><p></p>', it'll then produce an uncatchable error (panic?) without a message and doesn't call the onerror callback:
$ node sample.mjs
$ $LastExitCode-1073741819
Expanding with what Chromium (Vivaldi 6.7.3329.31, V8 12.4.254.17) does (in case the bugfix wants feature parity), this code is extended a little to do:
I noticed this while working with a library that generated a SVG, but due to misconfiguration, it added another root element to the SVG, and noticed it'd always crash the process.
Given this code:
This gets a valid SVG, and works as intended:
However, if
svg
has an extra root element, for example'<svg></svg><p></p>'
, it'll then produce an uncatchable error (panic?) without a message and doesn't call theonerror
callback:Expanding with what Chromium (Vivaldi 6.7.3329.31, V8 12.4.254.17) does (in case the bugfix wants feature parity), this code is extended a little to do:
Then ran 4 test cases:
<svg></svg>
:onerror Event
(invalid SVG: missingxmlns
)<svg xmlns="http://www.w3.org/2000/svg"></svg>
:onload
<svg xmlns="http://www.w3.org/2000/svg"></svg><p></p>
:onerror Event
(two root elements)<svg xmlns="http://www.w3.org/2000/svg"></svg><svg xmlns="http://www.w3.org/2000/svg"></svg>
:onerror Event
(two valid SVGs, but 2 root elements)Firefox Developer 127.0b3 (64-bit) has the exact same behaviour in all 4 cases.
As a side note, I also just realised that the library doesn't care about missing
xmlns
, should that be fixed too to behave the same as browsers?@napi-rs/canvas
0.1.52The text was updated successfully, but these errors were encountered: