ISSUE-2261 (using-wrong-type-err): SVGXXXList interfaces perhaps should not throw SVGException(SVG_WRONG_TYPE_ERR) [SVG Full 1.1]

ISSUE-2261 (using-wrong-type-err): SVGXXXList interfaces perhaps should not throw SVGException(SVG_WRONG_TYPE_ERR) [SVG Full 1.1]

http://www.w3.org/Graphics/SVG/WG/track/issues/2261

Raised by: Cameron McCormack
On product: SVG Full 1.1

The various SVGXXXList interfaces in SVG 1.1 say that an SVGException with code SVG_WRONG_TYPE_ERR is to be thrown if an item of an inappropriate type is passed into the methods.  This won't be possible in strongly typed languages (since the code wouldn't compile, or the language runtime would catch it).  In ECMAScript it would be customary to throw a TypeError in this situation.

Passing objects of inappropriate types is a general problem, and exceptions aren't declared on all methods to handle this case.  For example, you could try to pass an SVGLength object to Node::appendChild(), but Node::appendChild() doesn't say that a particular exception should be thrown in this case.

Recent Firefoxes and Operas do throw an exception with those SVGXXXList methods, but not an SVGException.  (Opera has an InternalException, and Firefox throws some XPCOM-specific excpetion.)  WebKit erroneously allows the method to succeed.

I think we should consider dropping the SVGException from these methods.

Received on Monday, 13 April 2009 13:14:20 UTC