Skip to content
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

Why is MediaPositionState nullable? #231

Closed
annevk opened this issue Aug 23, 2019 · 5 comments
Closed

Why is MediaPositionState nullable? #231

annevk opened this issue Aug 23, 2019 · 5 comments
Assignees

Comments

@annevk
Copy link
Member

annevk commented Aug 23, 2019

This came up in whatwg/webidl#774. Credit: Kagami Sascha Rosylight.

@bzbarsky
Copy link

bzbarsky commented Aug 26, 2019

Note that this is not even valid IDL. See whatwg/webidl#774 (comment) and https://bugs.chromium.org/p/chromium/issues/detail?id=997708

@mounirlamouri
Copy link
Member

Yeah, I remember being surprised to see optional and nullable. I thought nullable alone may be the right thing and that's how it's implemented in Blink but what I hear is that this actually incorrect and the right solution is to have it optional only. Am I getting this right?

@bzbarsky
Copy link

and that's how it's implemented in Blink

That's not valid IDL either, fwiw, and the fact that the Blink bindings allow it is a longstanding issue. :(

The right solution is to have it be optional only if the dictionary has no required members. In that case, all of undefined, null, and Object.create(null) (and in most cases {}) will get treated as an empty dictionary when passed from JS.

@mounirlamouri
Copy link
Member

This dictionary has no required members indeed. So I'm not sure if I understand this correctly. Are you suggestion to have optional MediaPositionState or have wording in spec checking whether the dictionary is empty.

@bzbarsky
Copy link

If the dictionary has no required members, then per IDL spec the only valid syntax here is:

void setPositionState(optional MediaPositionState state = {});

The prose for setPositionState would then do whatever it does with the MediaPositionState's members being either present or not present.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants