Bug 19110 - DOM "throw" algorithm doesn't seem to use WebIDL "throw" algorithm correctly
DOM "throw" algorithm doesn't seem to use WebIDL "throw" algorithm correctly
Status: RESOLVED FIXED
Product: WebAppsWG
Classification: Unclassified
Component: DOM
unspecified
All Windows 3.1
: P2 normal
: ---
Assigned To: Anne
public-webapps-bugzilla
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2012-09-28 11:33 UTC by Aryeh Gregor
Modified: 2012-12-06 09:23 UTC (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Aryeh Gregor 2012-09-28 11:33:04 UTC
http://dom.spec.whatwg.org/#concept-throw

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

http://dev.w3.org/2006/webapi/WebIDL/#es-throwing-exceptions

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.
Comment 1 Anne 2012-10-09 14:24:05 UTC
Any suggestions heycam?
Comment 2 Cameron McCormack 2012-12-06 05:13:31 UTC
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.