[encrypted-media] MediaKeyMessageEvent's message needs to be nullable or required in init dict

foolip has just created a new issue for 
https://github.com/w3c/encrypted-media:

== MediaKeyMessageEvent's message needs to be nullable or required in 
init dict ==
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's `message` 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:

```WebIDL
[SecureContext,
 Constructor(DOMString type, MediaKeyMessageEventInit eventInitDict)]
interface MediaKeyMessageEvent : Event {
    readonly attribute MediaKeyMessageType messageType;
    readonly attribute ArrayBuffer         message;
};

[SecureContext]
dictionary MediaKeyMessageEventInit : EventInit {
    MediaKeyMessageType messageType = "license-request";
    required ArrayBuffer message;
};
```

If there is a concern for breaking existing content, the only other 
option is unfortunately to make `message` nullable.

Please view or discuss this issue at 
https://github.com/w3c/encrypted-media/issues/329 using your GitHub 
account

Received on Thursday, 15 September 2016 09:42:16 UTC