Re: [w3c/manifest] Don't use enums, because they throw (#633)

I have been playing around with manifest parsing via WebIDL spec recently and may have some options that are hopefully useful to you. 

First off, for WebAppManifest as currently defined, I found the following situations which can potentially throw TypeErrors:

* DOMString/USVString, if a Symbol is assigned
* Enums, if an invalid value is assigned
* Dictionary members marked required, if omitted

The first can be ignored for WebAppManifests as the values come from parsing JSON which should not be able to produce Symbols.

The other two can arise and formally would invalidate the WebAppManifest, if WebIDL conversion is followed strictly.

My suggestion:

* by default require strict WebIDL conversion, so improperly written manifests are indeed invalidated - since improper JSON is rejected, why not simply extend this behavior to improper values in a proper JSON?
* that said, via MAY/SHOULD language user-agents should be allowed/encouraged to use their own custom variants of WebIDL conversion, that handle TypeErrors as they see fit - this covers how user-agents currently behave anyway
* the TypeErrors that are allowed to be handled in a custom fashion can optionally be restricted to the relevant cases mentioned above

There is also relevant discussion going in https://github.com/w3c/manifest/pull/710 currently, which probably should better be continued here? 

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/w3c/manifest/issues/633#issuecomment-415314808

Received on Thursday, 23 August 2018 07:09:55 UTC