Issue with a SVG embedded in a data: URL

Talk about code development, features, specific bugs, enhancements, patches, and similar things.
Forum rules
Please keep everything here strictly on-topic.
This board is meant for Pale Moon source code development related subjects only like code snippets, patches, specific bugs, git, the repositories, etc.

This is not for tech support! Please do not post tech support questions in the "Development" board!
Please make sure not to use this board for support questions. Please post issues with specific websites, extensions, etc. in the relevant boards for those topics.

Please keep things on-topic as this forum will be used for reference for Pale Moon development. Expect topics that aren't relevant as such to be moved or deleted.
SemiKebab
Moonbather
Moonbather
Posts: 50
Joined: 2021-05-30, 03:48

Issue with a SVG embedded in a data: URL

Unread post by SemiKebab » 2023-11-29, 19:04

The following SVG, embedded in a data: URL, is broken (using Pale Moon 32.5.1):

Code: Select all

data:image/svg+xml,%3Csvg%20xmlns=%22http://www.w3.org/2000/svg%22%20xmlns:xlink=%22http://www.w3.org/1999/xlink%22%20width=%22107%22%20height=%2220%22%3E%20%3Cdefs%3E%20%3Cpath%20d=%22M3.1%2C0%200%2C3.8%200%2C6%208%2C6%208%2C3.8%204.9%2C0zm8.2%2C7%20-2.3%2C2%200%2C2%202.3%2C2%203.4%2C0%202.3%2C-2%200%2C-2%20-2.3%2C-2zm6.7%2C7%200%2C2.2%203.1%2C3.8%201.8%2C0%203.1%2C-3.8%200%2C-2.2z%22%20id=%22a%22/%3E%20%3Cpath%20d=%22m18.5%2C10.75%200%2C-1.5%202%2C-1.75%203%2C0%202%2C1.75%200%2C1.5%20-2%2C1.75%20-3%2C0zm0%2C-6.75%200%2C1.5%207%2C0%200%2C-1.5%20-2.875%2C-3.5%20-1.25%2C0zm-9%2C12%200%2C-1.5%207%2C0%200%2C1.5%20-2.875%2C3.5%20-1.25%2C0zm0%2C-12%200%2C1.5%207%2C0%200%2C-1.5%20-2.875%2C-3.5%20-1.25%2C0zm-9%2C12%200%2C-1.5%207%2C0%200%2C1.5%20-2.875%2C3.5%20-1.25%2C0zm0%2C-5.25%200%2C-1.5%202%2C-1.75%203%2C0%202%2C1.75%200%2C1.5%20-2%2C1.75%20-3%2C0z%22%20id=%22b%22%20fill=%22none%22/%3E%20%3C/defs%3E%20%3Cuse%20fill=%22%23000%22%20x=%220%22%20y=%220%22%20xlink:href=%22%23a%22/%3E%20%3Cuse%20stroke=%22%23000%22%20x=%220%22%20y=%220%22%20xlink:href=%22%23b%22/%3E%20%3Cuse%20fill=%22%2372777d%22%20x=%2227%22%20y=%220%22%20xlink:href=%22%23a%22/%3E%20%3Cuse%20stroke=%22%2372777d%22%20x=%2227%22%20y=%220%22%20xlink:href=%22%23b%22/%3E%20%3Cuse%20fill=%22%2336c%22%20x=%2254%22%20y=%220%22%20xlink:href=%22%23a%22/%3E%20%3Cuse%20stroke=%22%2336c%22%20x=%2254%22%20y=%220%22%20xlink:href=%22%23b%22/%3E%20%3Cuse%20fill=%22%23447ff5%22%20x=%2281%22%20y=%220%22%20xlink:href=%22%23a%22/%3E%20%3Cuse%20stroke=%22%23447ff5%22%20x=%2281%22%20y=%220%22%20xlink:href=%22%23b%22/%3E%20%3C/svg%3E
The source SVG: on Gerrit, on GitHub.

However, Pale Moon is able to open the SVG directly: rankselector.svg. The issue happens only when embedded in a data: URL.

For comparison, this one works:

Code: Select all

data:image/svg+xml,%3Csvg%20xmlns=%22http://www.w3.org/2000/svg%22%20width=%2236%22%20height=%2220%22%3E%20%3Crect%20width=%2210%22%20height=%226%22%20x=%220%22%20y=%220%22%20fill=%22%2354595d%22/%3E%20%3Crect%20width=%229%22%20height=%225%22%20x=%220.5%22%20y=%227.5%22%20fill=%22none%22%20stroke=%22%2354595d%22/%3E%20%3Cpath%20d=%22m0.5%2C15%200%2C4.5%209%2C0%200%2C-4.5%22%20fill=%22none%22%20stroke=%22%2354595d%22/%3E%20%3Crect%20width=%2210%22%20height=%226%22%20x=%2213%22%20y=%220%22%20fill=%22%2336c%22/%3E%20%3Crect%20width=%229%22%20height=%225%22%20x=%2213.5%22%20y=%227.5%22%20fill=%22none%22%20stroke=%22%2336c%22/%3E%20%3Cpath%20d=%22m13.5%2C15%200%2C4.5%209%2C0%200%2C-4.5%22%20fill=%22none%22%20stroke=%22%2336c%22/%3E%20%3Crect%20width=%2210%22%20height=%226%22%20x=%2226%22%20y=%220%22%20fill=%22%23447ff5%22/%3E%20%3Crect%20width=%229%22%20height=%225%22%20x=%2226.5%22%20y=%227.5%22%20fill=%22none%22%20stroke=%22%23447ff5%22/%3E%20%3Cpath%20d=%22m26.5%2C15%200%2C4.5%209%2C0%200%2C-4.5%22%20fill=%22none%22%20stroke=%22%23447ff5%22/%3E%20%3C/svg%3E
I didn't have the issue previously, and the problematic SVG hasn't been edited for years, so I suspect a regression in Pale Moon. It might be related to this commit: No issue - Stop supporting data: scheme in SVG <use> elements.

User avatar
Moonchild
Pale Moon guru
Pale Moon guru
Posts: 35651
Joined: 2011-08-28, 17:27
Location: Motala, SE

Re: Issue with a SVG embedded in a data: URL

Unread post by Moonchild » 2023-11-29, 22:46

Yeah it was supposed to block data: in <use> statements inside the SVG, but now it blocks <svg> in data: URIs that have <use> in them somewhere. So it's not working as-intended.
Mozilla is also running into issues and have backed it out; unfortunately in our case it was already landed and made it into the release.
For the time being I'm backing this out also; it's not really a big deal although the spec says we should not allow it.
"Sometimes, the best way to get what you want is to be a good person." -- Louis Rossmann
"Seek wisdom, not knowledge. Knowledge is of the past; wisdom is of the future." -- Native American proverb
"Linux makes everything difficult." -- Lyceus Anubite