-
Notifications
You must be signed in to change notification settings - Fork 80
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
MediaKeyMessageEvent's message needs to be nullable or required in init dict #329
Comments
I think the The specification as it stands is underspecified because the contents of the |
This seems like a good change, and I doubt this will break any real applications. Do we need to make |
Yes, if the dictionary is still optional you'd still end up with the nullable |
(That was in reply to @ddorwin about making the init dict non-optional.) |
Sorry again, I didn't see that @ddorwin was talking about a different event. For |
|
Oh, if the UA can create instances where |
@foolip Is that true when the dictionary member has a default value ? In this case the default value is i.e.
and
are the same and result in a
|
The bit that I learned today is in https://heycam.github.io/webidl/#es-dictionary step 1.5.1.2. There null is treated as a missing argument, so the two examples you gave would be treated identical, in fact any spec prose that comes "after" that conversion couldn't distinguish them at all. |
Ok. So that seems fine in our case (for |
I think that |
A lot of the things I wrote on this issue are wrong because I misunderstood https://heycam.github.io/webidl/#es-dictionary step 1.5.1.2. That actually checks the type of the thing to convert to a dictionary, not the type of the member. So The initial suggestion about changes to |
@foolip provided (offline) a useful guideline for the init dictionary: "In short, if it'd work to pass I believe we could remove the default value ( Assuming the above is possible, we could change the IDL to: [Constructor(DOMString type, MediaEncryptedEventInit eventInitDict)]
...
dictionary MediaEncryptedEventInit : EventInit {
required DOMString initDataType;
ArrayBuffer? initData = null;
}; |
Returning to Thus, we'd have: [SecureContext]
dictionary MediaKeyMessageEventInit : EventInit {
required MediaKeyMessageType messageType;
required ArrayBuffer message;
}; |
…dictionary Also changes some init dictionary attributes to be required and not have default values.
I created PR #330 for reference (and eventually to be the agreed-upon fix). |
…alue The prose was not updated with the IDL in 5499821.
https://w3c.github.io/encrypted-media/#mediakeymessageevent
Per the current spec,
new MediaKeyMessageEvent('type')
would not throw an exception, because the init dict is not required. However, the result event'smessage
attribute cannot sensibly be anything other than null, and yet it's not nullable in the IDL.The typical pattern for event interfaces where only scripts could create instances with a certain member being null is to make that impossible, as such:
If there is a concern for breaking existing content, the only other option is unfortunately to make
message
nullable.The text was updated successfully, but these errors were encountered: