Closed Bug 1457013 Opened 2 years ago Closed 2 years ago

AudioBuffer ctor throws wrong exceptions with out-of-range arguments

Categories

(Core :: Web Audio, defect, P3)

57 Branch
defect

Tracking

()

RESOLVED FIXED
mozilla61
Tracking Status
firefox61 --- fixed

People

(Reporter: toy.raymond, Assigned: achronop)

Details

(Keywords: dev-doc-complete)

Attachments

(2 files)

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

Steps to reproduce:

Run

n0 = new AudioBuffer({"numberOfChannels":0,"length":1,"sampleRate":16000});
n1 = new AudioBuffer({numberOfChannels: 2, length: 10, sampleRate: 48000});
n1.getChannelData(3)



Actual results:

Construction of n0 threw an IndexSizeError.

Same thing if you set length to 1 or sampleRate to a rate that's not supported.

n1.getChannelData(3) threw SyntaxError


Expected results:

I was expecting NotSupportedError as mentioned in https://webaudio.github.io/web-audio-api/#dom-baseaudiocontext-createbuffer

Similarly, getChannelData(3) should throw IndexSizeError: https://webaudio.github.io/web-audio-api/#dom-audiobuffer-getchanneldata-channel
Oops. I meant setting length to 0.
Component: Untriaged → Web Audio
Product: Firefox → Core
Rank: 25
Priority: -- → P3
Summary: audiobuffer → AudioBuffer ctor throws wrong exceptions with out-of-range arguments
Status: UNCONFIRMED → NEW
Ever confirmed: true
Comment on attachment 8971270 [details]
Bug 1457013 - In AudioBuffer return NOT_SUPPORTED error message for various cases to align with the spec.

https://reviewboard.mozilla.org/r/240040/#review245802
Attachment #8971270 - Flags: review?(padenot) → review+
Comment on attachment 8971624 [details]
Bug 1457013 - Update AudioBuffer mochitest to expect not supported error.

https://reviewboard.mozilla.org/r/240384/#review246438
Attachment #8971624 - Flags: review?(padenot) → review+
Pushed by achronop@gmail.com:
https://hg.mozilla.org/integration/autoland/rev/42439f5ecc0d
In AudioBuffer return NOT_SUPPORTED error message for various cases to align with the spec. r=padenot
https://hg.mozilla.org/integration/autoland/rev/d1623ae65516
Update AudioBuffer mochitest to expect not supported error. r=padenot
https://hg.mozilla.org/mozilla-central/rev/42439f5ecc0d
https://hg.mozilla.org/mozilla-central/rev/d1623ae65516
Status: NEW → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla61
You need to log in before you can comment on or make changes to this bug.