W3C home > Mailing lists > Public > public-html-media@w3.org > September 2016

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

From: Philip Jägenstedt via GitHub <sysbot+gh@w3.org>
Date: Thu, 15 Sep 2016 09:41:57 +0000
To: public-html-media@w3.org
Message-ID: <issues.opened-177132332-1473932516-sysbot+gh@w3.org>
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

This archive was generated by hypermail 2.3.1 : Thursday, 15 September 2016 09:42:16 UTC