Bugzilla – Bug 19110
DOM "throw" algorithm doesn't seem to use WebIDL "throw" algorithm correctly
Last modified: 2012-12-06 09:23:38 UTC
says to create a new DOMException, "set" its name and message to something, and then "throw" it in the WebIDL sense. But WebIDL's throw algorithm
takes the name and message as optional arguments, not an existing exception object. Nothing says what it means to "set" the name and message (own properties? inherited?). I think the DOM algorithm needs to be rewritten to match the WebIDL one, because currently the combination doesn't make sense to me. Maybe you want something like
Throw a DOMException, with name equal to name and message equal to an implementation-defined value.
But you need to set the code attribute somehow.
Any suggestions heycam?
I extended http://dev.w3.org/2006/webapi/WebIDL/#dfn-throw to take the values to assign to the exception fields, and changed the algorithm in http://dev.w3.org/2006/webapi/WebIDL/#es-throwing-exceptions to set them so.
You can then say:
Throw a DOMException, with name equal to name, message equal to an
implementation-defined value, and with code set to blah.