-
Notifications
You must be signed in to change notification settings - Fork 50
Make MIDIMessageEvent data MIDIConnectionEvent port nullable #252
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
Make MIDIMessageEvent data MIDIConnectionEvent port nullable #252
Conversation
Unfortunately we can't make it required now, we have two implementations that have shipped with it being optional. This is the implementation in Gecko: |
Wouldn't this only affect code that calls the event constructors? I mean something like this would be affected, right? new MIDIConnectionEvent('just-a-type-but-no-options');
new MIDIMessageEvent('just-a-type-but-no-options'); I would argue that this is very rarely done if you are just using the Web MIDI API. It looks like at least on GitHub all code doing something like this is either an implementation of the spec, a polyfill, a platform test or something similar. https://github.com/search?q=%22new+MIDIConnectionEvent%28%22&type=code In that case it's maybe still fine to change it. |
@chrisguttandin Thank you for the code links! Yes, it would affect the cases you noted. Even if it's mostly tests and polyfills now, since the API is being used in this way that is more motivation to take the "pragmatic" approach and codify the existing behavior instead of trying to change things. @padenot Thank you for the Gecko standpoint. Blink has the same standpoint. I will update this PR to make the data and port nullable instead (probably will get to it early next week). |
This makes the data and port nullable. Note that the dictionary elements are not explicitly marked nullable, as per discussion in #233. Both Gecko and Blink should update their IDL after this change. |
https://bugzilla.mozilla.org/show_bug.cgi?id=1857420 is the Gecko side for this. |
Chromium CL here: https://crrev.com/c/4917021 |
This aligns MIDIConnectionEvent with the following change to the Web MIDI spec: WebAudio/web-midi-api#252 MIDIMessageEvent was updated here: https://crrev.com/c/6044556 Changing the nullability of dictionaries could cause web compatibility issues and requires an intent to ship. Due to that, just update the bug link for the dictionaries and do not remove the nullable mark in this CL. Bug: 40286113 Change-Id: I34c76be4181aa45f9d81fa7dda9da7ba61196fa2 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4917021 Commit-Queue: Michael Wilson <[email protected]> Reviewed-by: Hongchan Choi <[email protected]> Cr-Commit-Position: refs/heads/main@{#1403068}
This is to fix #168 and #233.
It seems like there are two possible approaches to fixing these issues:
While pragmatism is generally a good thing, I would like to consider this one more time with Gecko and Chromium stakeholders before merging a change.
If it's not a lot of work to update the implementations, and if we don't expect this to break applications, it seems like making the arguments required might be a better API. But, if we feel strongly that it's better to simply make this nullable to move forward more quickly I will modify this change to that form.