Align MIDI errors with the web-midi-api spec. Deprecated `SecurityError` and `InvalidAccessError` in favor of `NotAllowedError`
Categories
(Core :: DOM: Device Interfaces, defect, P3)
Tracking
()
People
(Reporter: nikelborm, Assigned: nikelborm, NeedInfo)
References
(Blocks 1 open bug)
Details
Attachments
(1 file, 3 obsolete files)
(I already made the necessary changes to the Firefox codebase, just currently figuring out how to properly submit the patch)
InvalidAccessError replaced by NotAllowedError:
The change in spec: WebAudio/web-midi-api@3795f22
According PR: WebAudio/web-midi-api#278
MDN update PR: mdn/content#42334
Affected APIs
.sendmethod of output MIDI ports.openmethod of MIDI ports
Reasoning
According to Web IDL spec on
InvalidAccessError:Deprecated. Use TypeError for invalid arguments, "NotSupportedError" DOMException for unsupported operations, and "NotAllowedError" DOMException for denied requests instead.
Previously, while trying to open
MIDIPort,"InvalidAccessError" DOMExceptionwas thrown when...the device is unavailable (e.g., is already in use by another process and cannot be opened, or is disconnected)
In this case, I believe
NotAllowedErrorfits well, according to its Web IDL spec description:The request is not allowed by the user agent or the platform in the current context, possibly because the user denied permission.
Security and permissions reasons are only a subset of the appropriate causes, according to this definition. An attempt to
openthe port can fail. Somebody's exclusive lock on the port, or the port being disconnected, is the current context driving the platform's decision not to allow the operation.And in the context of forbidden
.sendcalls:If data is a System Exclusive message, and the
MIDIAccessdid not enable System Exclusive access, throw anInvalidAccessErrorexception.
NotAllowedErrorfits even better, because it fits an explicitly defined subset of permission errors.
SecurityError replaced by NotAllowedError:
The change in spec: WebAudio/web-midi-api@b7806b8
According PR: WebAudio/web-midi-api#267
MDN update PR: mdn/content#41956
Affected APIs
navigator.requestMIDIAccessmethod
Reasoning
webaudio.github.io/web-midi-api#dom-navigator-requestmidiaccess
At the moment a SecurityError (The operation is insecure.) is thrown when a user rejects a permissions prompt for MIDI access requested through the
requestMIDIAccess()method, but it would make more sense to use a NotAllowedError (The request is not allowed by the user agent or the platform in the current context, possibly because the user denied permission.) for this.
| Assignee | ||
Comment 1•9 months ago
|
||
InvalidAccessError replaced by NotAllowedError:
The change in spec: WebAudio/web-midi-api@3795f22
According PR: WebAudio/web-midi-api#278
MDN update PR: mdn/content#42334
Affected APIs
.sendmethod of output MIDI ports.openmethod of MIDI ports
Reasoning
According to Web IDL spec on
InvalidAccessError:Deprecated. Use TypeError for invalid arguments, "NotSupportedError" DOMException for unsupported operations, and "NotAllowedError" DOMException for denied requests instead.
Previously, while trying to open
MIDIPort,"InvalidAccessError" DOMExceptionwas thrown when...the device is unavailable (e.g., is already in use by another process and cannot be opened, or is disconnected)
In this case, I believe
NotAllowedErrorfits well, according to its Web IDL spec description:The request is not allowed by the user agent or the platform in the current context, possibly because the user denied permission.
Security and permissions reasons are only a subset of the appropriate causes, according to this definition. An attempt to
openthe port can fail. Somebody's exclusive lock on the port, or the port being disconnected, is the current context driving the platform's decision not to allow the operation.And in the context of forbidden
.sendcalls:If data is a System Exclusive message, and the
MIDIAccessdid not enable System Exclusive access, throw anInvalidAccessErrorexception.
NotAllowedErrorfits even better, because it fits an explicitly defined subset of permission errors.
SecurityError replaced by NotAllowedError:
The change in spec: WebAudio/web-midi-api@b7806b8
According PR: WebAudio/web-midi-api#267
MDN update PR: mdn/content#41956
Affected APIs
navigator.requestMIDIAccessmethod
Reasoning
webaudio.github.io/web-midi-api#dom-navigator-requestmidiaccess
At the moment a SecurityError (The operation is insecure.) is thrown when a user rejects a permissions prompt for MIDI access requested through the
requestMIDIAccess()method, but it would make more sense to use a NotAllowedError (The request is not allowed by the user agent or the platform in the current context, possibly because the user denied permission.) for this.
Updated•9 months ago
|
Updated•9 months ago
|
| Assignee | ||
Comment 2•9 months ago
|
||
| Assignee | ||
Comment 3•9 months ago
|
||
| Assignee | ||
Comment 4•9 months ago
|
||
Sorry for the messy history of this bug. I'm new to this platform 👉👈 🥺
| Assignee | ||
Updated•9 months ago
|
Updated•9 months ago
|
| Assignee | ||
Comment 5•9 months ago
|
||
= InvalidAccessError replaced by NotAllowedError:
The change in spec: WebAudio/web-midi-api@3795f22
According PR: WebAudio/web-midi-api#278
MDN update PR: mdn/content#42334
== Affected APIs
.sendmethod of output MIDI ports.openmethod of MIDI ports
= SecurityError replaced by NotAllowedError:
The change in spec: WebAudio/web-midi-api@b7806b8
According PR: WebAudio/web-midi-api#267
MDN update PR: mdn/content#41956
== Affected APIs
navigator.requestMIDIAccessmethod
Updated•9 months ago
|
| Assignee | ||
Updated•9 months ago
|
Comment 6•9 months ago
|
||
The severity field is not set for this bug.
:cmartin, could you have a look please?
For more information, please visit BugBot documentation.
Updated•9 months ago
|
| Assignee | ||
Updated•8 months ago
|
Updated•8 months ago
|
Description
•