Closed Bug 1458979 Opened 2 years ago Closed 2 years ago

AudioBuffer copy to/from channel throws incorrect errors

Categories

(Core :: Web Audio, defect, P3)

57 Branch
defect

Tracking

()

RESOLVED FIXED
mozilla61
Tracking Status
firefox61 --- fixed

People

(Reporter: toy.raymond, Assigned: achronop)

Details

Attachments

(1 file)

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

Steps to reproduce:

In a console:

x = new Float32Array(3)
b = new AudioBuffer({numberOfChannels: 3, length: 3, sampleRate: 48000})
b.copyFromChannel(x, -1) 
b.copyFromChannel(x, 3)
b.copyFromChannel(x, 0, -1)
b.copyFromChannel(x, 0, 16)
b.copyToChannel(x, -1) 
b.copyToChannel(x, 3)
b.copyToChannel(x, 0, -1)
b.copyToChannel(x, 0, 16)



Actual results:

Each of the calls to copyFromChannel and copyToChannel threw NotSupportedError


Expected results:

They should throw IndexSizeError:  https://webaudio.github.io/web-audio-api/#dom-audiobuffer-copytochannel and https://webaudio.github.io/web-audio-api/#dom-audiobuffer-copyfromchannel

This shows up in a Chrome layout test being moved to WPT.
And while we're here,

b.getChannelData(4) throws a NotSupportedError instead of IndexSizeError.
Component: Untriaged → Web Audio
Product: Firefox → Core
Status: UNCONFIRMED → NEW
Rank: 25
Ever confirmed: true
Priority: -- → P3
It looks like I brought in all the above errors with Bug 1457013. I don't know what I was thinking and changed the copy methods. I've pushed a patch to revert these changes and correct the getChannelData() method.
Assignee: nobody → achronop
Comment on attachment 8973182 [details]
Bug 1458979 - Update AudioBuffer's throw errors according to spec.

https://reviewboard.mozilla.org/r/241674/#review247522

lgtm
Attachment #8973182 - Flags: review?(dminor) → review+
Pushed by achronop@gmail.com:
https://hg.mozilla.org/integration/autoland/rev/abdaa1f91c4c
Update AudioBuffer's throw errors according to spec. r=dminor
https://hg.mozilla.org/mozilla-central/rev/abdaa1f91c4c
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.