This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 26767 - An invalid dictionary member value whose type is an enumeration
Summary: An invalid dictionary member value whose type is an enumeration
Status: RESOLVED FIXED
Alias: None
Product: WebAppsWG
Classification: Unclassified
Component: WebIDL (show other bugs)
Version: unspecified
Hardware: PC All
: P2 normal
Target Milestone: ---
Assignee: Cameron McCormack
QA Contact: public-webapps-bugzilla
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-09-10 03:03 UTC by bashi
Modified: 2019-03-01 16:19 UTC (History)
4 users (show)

See Also:


Attachments

Description bashi 2014-09-10 03:03:44 UTC
The note on http://heycam.github.io/webidl/#idl-enums says:

"In the ECMAScript binding, assignment of an invalid string value to an attribute is ignored, while passing such a value as an operation argument results in an exception being thrown."

What should happen when assignment of an invalid string value to a dictionary member whose type is an enumerations? Maybe the same as an attribute (ignored)? It would be great to mention the case.
Comment 1 Boris Zbarsky 2014-09-10 03:12:23 UTC
Why are you trying to figure that out from an informative note?

This is clearly spelled out in the normative text at <http://heycam.github.io/webidl/#es-dictionary> and <http://heycam.github.io/webidl/#es-enumeration>: The conversion throws.

The "attribute of enumeration type" case is special-cased at http://heycam.github.io/webidl/#dfn-attribute-setter step 4, which doesn't invoke the (throwing) conversion algorithm linked to above.
Comment 2 bashi 2014-09-10 03:17:53 UTC
Ah, I missed "http://heycam.github.io/webidl/#dfn-attribute-setter step 4". Thank you for the pointer.

I thought it would be helpful if the node mention the dictionary case (as I wrote).
Comment 3 Boris Zbarsky 2014-09-10 03:35:43 UTC
Should it also mention what happens with enums in a sequence?  In a union?  In other container types IDL is likely to add in the future (e.g. the proposed OpenEndedDictionary)?

The note is not meant to be exhaustive...  We could try to make it so, at the cost of having to update it if other things get the current attribute behavior, but I'm not sure what the win is here.  It might be simpler to remove the note altogether.
Comment 4 bashi 2014-09-10 04:04:24 UTC
Then, how about removing operation case from the note? It seems that only attributes case is special-cased. I think having the note is still helpful.
Comment 5 Ms2ger 2019-03-01 16:19:58 UTC
https://github.com/heycam/webidl/pull/673