[Webkit-unassigned] [Bug 225340] New: When assigning to the src value for a constructed Image(), Safari 14.1 mangles the string

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Mon May 3 17:57:26 PDT 2021


https://bugs.webkit.org/show_bug.cgi?id=225340

            Bug ID: 225340
           Summary: When assigning to the src value for a constructed
                    Image(), Safari 14.1 mangles the string
           Product: WebKit
           Version: Safari 14
          Hardware: Mac (Intel)
                OS: macOS 11
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: JavaScriptCore
          Assignee: webkit-unassigned at lists.webkit.org
          Reporter: jarod.gowgiel at gmail.com

When assigning an SVG string that is not URI encoded to the src value of a constructed Image (https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/Image) the resulting string is mangled by Safari 14.1 but not Safari 14.0.3.

I'm not sure specifically where this bug lies (JavaScriptCore or WebCore JavaScript) but I believe it must be in the JavaScript engine somewhere.

As demonstrated in https://codepen.io/JarodG/pen/KKaOjRG?editors=1011 - notice:

In both Safari 14.0.3 and Chrome 89.0.4389.128, assigning a simple SVG string to the src attribute maintains the same structure and formatting when read as the initial string. In Safari 14.1, however, assigning an SVG string to the same attribute causes the string to seemingly become partially encoded after an indeterminate point.

The string in question goes from: 

'<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 36 36"> <path fill="#DD2E44" d="M35.885 11.833c0-5.45-4.418-9.868-9.867-9.868-3.308 0-6.227 1.633-8.018 4.129-1.791-2.496-4.71-4.129-8.017-4.129-5.45 0-9.868 4.417-9.868 9.868 0 .772.098 1.52.266 2.241C1.751 22.587 11.216 31.568 18 34.034c6.783-2.466 16.249-11.447 17.617-19.959.17-.721.268-1.469.268-2.242z"/></svg>'

to

'<svg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 36 36'> <path fill='#DD2E44%22%20d=%22M35.885%2011.833c0-5.45-4.418-9.868-9.867-9.868-3.308%200-6.227%201.633-8.018%204.129-1.791-2.496-4.71-4.129-8.017-4.129-5.45%200-9.868%204.417-9.868%209.868%200%20.772.098%201.52.266%202.241C1.751%2022.587%2011.216%2031.568%2018%2034.034c6.783-2.466%2016.249-11.447%2017.617-19.959.17-.721.268-1.469.268-2.242z%22/%3E%3C/svg%3E'

I'm aware that setting the data URI like this is not the best practice, but wanted to report this as a deviation from the previous version of Safari (and a change which I couldn't find recorded anywhere).

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20210504/7dfd848d/attachment.htm>


More information about the webkit-unassigned mailing list