svg parser errors are not reported as JavaScript exceptions |
||||
Issue description
UserAgent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.110 Safari/537.36
Steps to reproduce the problem:
<script>
(function () {
try {
var svgns = "http://www.w3.org/2000/svg";
var shape = document.createElementNS(svgns, "circle");
shape.setAttributeNS(null, "r", "foo");
console.log('No exception was thrown');
} catch(ex) {
console.error(ex.stack || ex);
}
})();
</script>
What is the expected behavior?
An exception logged in the console.
What went wrong?
No exception was thrown. This means all kinds of JS tools cannot know that the svg parse failed. In particular,
unit tests can pass even though the parse failed.
Did this work before? No
Chrome version: 49.0.2623.110 Channel: stable
OS Version:
Flash Version: Shockwave Flash 21.0 r0
This is probably a design bug in the interface between svg and chrome but I put it under Developer Tools because we are the ones who will care about this problem.
,
Apr 8 2016
Thank you for your reply! To be clear, my report is not about the attribute parsing but rather it is about the "drop a note in the console" approach. Developers focus a lot of attention on the browser console. It is their primary UI to develop web pages. As we are trying to use the Web to create useful content, we request that the browser also try to be useful in its output to the console for developers. Sending "Error" to the console as a logging message is not useful. We don't have any mechanism for routing such messages. We can't log them when users find them; we can't check for them in unit tests; we can't prevent them when we know the errors are harmless. There is an established and effective solution for errors: throw JS exceptions or route the errors through window.onerror. Thanks.
,
Apr 8 2016
Regardless of mechanism this sounds like something that would be "Web exposed", so should probably be ventilated outside the Chromium project first before going anywhere. Maybe https://github.com/DeveloperToolsWG/console-object is a good starting point for discussions?
,
Apr 8 2016
,
Apr 11 2016
,
Jun 3 2016
,
Jul 29 2016
Since it's a spec issue, I'll close it here. Feel free to open it again when spec will be ready. |
||||
►
Sign in to add a comment |
||||
Comment 1 by f...@opera.com
, Apr 8 2016