jsdom / webidl2js

Auto-generate JS class structures for Web IDL specifications
MIT License
79 stars 30 forks source link

Fix treatment of non-strings as enumerations #198

Closed domenic closed 4 years ago

domenic commented 4 years ago

Previously, we were comparing the original value with the set of possible enumeration values. This means values like { toString() { "valid-value" } } would not be allowed. Instead, we should check the post-string-conversion value.

Also changes the error messages generated in cases like these, from

The provided value has member type that 'bytes' is not a valid enumeration value for ReadableStreamType

to

The provided value has member 'type' that 'bytes' is not a valid enumeration value for ReadableStreamType

which is slightly better, although still not grammatical.