Closed Bug 1713046 Opened 5 years ago Closed 9 months ago

AudioContext.constructor misses type checking for contextOptions.latencyHint Param

Categories

(Core :: Web Audio, enhancement)

Firefox 88
enhancement

Tracking

()

RESOLVED INVALID

People

(Reporter: zyscoder, Unassigned)

References

Details

(Keywords: parity-chrome, parity-safari)

User Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.77 Safari/537.36

Steps to reproduce:

(1) Open a tab and navigate to any URL;
(2) Run the following code in the Console of Devtools:

new AudioContext({latencyHint: "any_str"})

(3) This code would be evaluated successfully without throwing any exceptions.

Actual results:

This code would be evaluated successfully without throwing any exceptions.

Expected results:

As https://webaudio.github.io/web-audio-api/#dom-audiocontext-audiocontext says, The preferred value of the latencyHint is a value from AudioContextLatencyCategory. However, a double can also be specified for the number of seconds of latency for finer control to balance latency and power consumption. It is at the browser’s discretion to interpret the number appropriately. The actual latency used is given by AudioContext’s baseLatency attribute.
However, in my test, string value, a boolean value, or null would not cause an exception thrown.

The Bugbug bot thinks this bug should belong to the 'Core::Web Audio' component, and is moving the bug to that component. Please revert this change in case you think the bot is wrong.

Component: Untriaged → Web Audio
Product: Firefox → Core

It's just that it's not implemented, and things that aren't implemented behave like this, e.g.

new AudioContext({"zaza": "zouzou"}) isn't supposed to throw.

I'm implementing it in bug 2020377, but this behaves as expected.

Status: UNCONFIRMED → RESOLVED
Closed: 9 months ago
Resolution: --- → INVALID
See Also: → 2020377
You need to log in before you can comment on or make changes to this bug.