-
Notifications
You must be signed in to change notification settings - Fork 66
navigator.share's argument needs to be optional because ShareData has no required members #47
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Hmm I wonder if it's worth debating this. The reason all the attributes of Although I don't think there's a way to express it in WebIDL, perhaps we could add a check in the share method that "if all fields of the dictionary are not present, reject with a We would still be in violation of the letter of WebIDL but not the spirit. And in fact omitting the argument would have the same result as passing the empty dict (rejected with |
I agree it's weird when some member is required, but no individual one. This was also the case with getUserMedia, debated in whatwg/webidl#130. whatwg/dom@e4f7faa was also done as a result of that. Making it optional and explicitly throwing when missing wouldn't actually be possible with the spec equivalent of "custom bindings", as when you get into the prose, Web IDL has already done its thing and created a dictionary for you. The existing error handling will do the right thing, but the message given will be a bit cryptic, unfortunately. |
This makes no sense to me. If you removed the word "
I'm not suggesting that my prose throw a TypeError if the dictionary is omitted. I'm suggesting that we throw a TypeError if all fields of the dictionary are omitted. (Implicitly, this would be true if the argument was optional and the dictionary was omitted.) This would be the same situation as |
This has no behavioural change, as passing an empty dictionary is a TypeError. But it is required by the WebIDL spec. Closes w3c#47.
This has no behavioural change, as passing an empty dictionary is a TypeError. But it is required by the WebIDL spec. Closes w3c#47.
This has no behavioural change, as passing an empty dictionary is a TypeError. But it is required by the WebIDL spec. Closes w3c#47.
This has no behavioural change, as passing an empty dictionary is a TypeError. But it is required by the WebIDL spec. Closes w3c#47.
This has no behavioural change, as passing an empty dictionary is a TypeError. But it is required by the WebIDL spec. Closes w3c#47.
This is another thing that's a bit surprising in Web IDL, but if a dictionary has no required members, then when used as an argument type, that argument must be optional. It's this bit from https://heycam.github.io/webidl/#idl-operations:
The reason is that with no required arguments,
navigator.share({})
still works, and then it looks "silly" to require the empty object.The text was updated successfully, but these errors were encountered: