w3c / media-source

Media Source Extensions
https://w3c.github.io/media-source/
Other
268 stars 57 forks source link

BufferedChangeEventInit shouldn't be optional in BufferedChangeEvent constructor #349

Open jyavenard opened 8 months ago

jyavenard commented 8 months ago

The constructor of the BufferedChangeEventInit is defined as optional (https://www.w3.org/TR/media-source/#dom-bufferedchangeevent)

interface BufferedChangeEvent : Event {
  constructor(DOMString  type, optional BufferedChangeEventInit eventInitDict = {});

https://www.w3.org/TR/media-source/#dom-bufferedchangeeventinit

Given that a BufferedChangeEvents are always browser generated, making the BufferedChangeEventInit mandatory is preferred.

tidoust commented 8 months ago

The argument had been made optional by #342 because Web IDL mandates that a dictionary argument must be optional if it has no required fields.

Dropping the optional keyword made the Web IDL invalid again, which triggered the proposed automatic fix in #351 to reintroduce the optional keyword. I'm going to merge #351 to make the Web IDL valid (needed by spec crawlers). If you'd like to make the argument mandatory, that needs to be captured in the construction algorithm (which isn't specified yet, see #345), or something else needs to change.