If you think a bug might affect users in the 57 release, please set the correct tracking and status flags for Release Management.

Add line number + code to SVG parsing error message

UNCONFIRMED
Unassigned

Status

()

Core
SVG
UNCONFIRMED
6 years ago
6 years ago

People

(Reporter: virtue, Unassigned)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

6 years ago
User Agent: Mozilla/5.0 (Windows NT 5.1) AppleWebKit/535.2 (KHTML, like Gecko) Chrome/15.0.874.106 Safari/535.2

Steps to reproduce:

When firefox encounters an error in a SVG file, or when a bad attribute value is assigned to an SVG element by javascript, a very vague error message is shown, something like:

    Unexpected value NaN parsing y attribute.

In a complex document (or with multiple documents), there's almost no way to track down where this error is happening.



Expected results:

Ideally, the error message would look more like this for javascript:

    Unexpected value NaN parsing y attribute.
    Line 103:    svgElement.setAttribute('x', some_bad_js_variable);

Or this for normal SVG markup:

    Unexpected value "abc" parsing y attribute.
    Line 103:    <circle cx="abc" cy="123" />

Comment 1

6 years ago
This suggestion is very difficult to implement. The code that produces the error message is common to javascript and markup and doesn't know which one is calling it to ask for the line number.

I could add the element name to the error message e.g.

Unexpected value NaN parsing y attribute on element z

If that's acceptable.

Updated

6 years ago
Duplicate of this bug: 737094
You need to log in before you can comment on or make changes to this bug.