WaveShaperNode#setCurve should throw when the curve is less than two elements

RESOLVED FIXED in Firefox 42

Status

()

Core
Web Audio
RESOLVED FIXED
3 years ago
3 years ago

People

(Reporter: padenot, Assigned: bbouvier, Mentored)

Tracking

unspecified
mozilla42
Points:
---

Firefox Tracking Flags

(firefox42 fixed)

Details

Attachments

(1 attachment)

(Reporter)

Description

3 years ago
Spec bug: https://github.com/WebAudio/web-audio-api/issues/464

The code is here: https://dxr.mozilla.org/mozilla-central/source/dom/media/webaudio/WaveShaperNode.cpp#313. The WebIDL interface is here: https://dxr.mozilla.org/mozilla-central/source/dom/media/webaudio/WaveShaperNode.cpp#313

This bug involves the following steps:
- In the webidl file, make it so that the setter can throw (you can search DXR with SetterThrows to check how this is done).
- In the C++ code, modify the method signature so that it compiles with the SetterThrows, check the size of the curve, and throw the correct exception if the size is less than two.
- Write a test that tests that the correct exception is thrown in the right situation (and not thrown in other situations). https://dxr.mozilla.org/mozilla-central/source/dom/media/webaudio/test contains a lot of other web audio tests for inspiration.
(Assignee)

Comment 2

3 years ago
Created attachment 8637163 [details] [diff] [review]
webaudio.patch

I was curious what the Firefox development process looked like. How does that patch look?

Also, which test suite should I flag in the try flags, to test that this change works on all platforms? mochitests-all?
Assignee: nobody → benj
Status: NEW → ASSIGNED
Attachment #8637163 - Flags: review?(padenot)
(Reporter)

Comment 3

3 years ago
Comment on attachment 8637163 [details] [diff] [review]
webaudio.patch

Review of attachment 8637163 [details] [diff] [review]:
-----------------------------------------------------------------

Thanks for the patch, looks good (with the comment addressed).

You want to run mochitest-3 for desktop platforms, and mochitest-10 for android.

::: dom/webidl/WaveShaperNode.webidl
@@ +17,5 @@
>  };
>  
>  interface WaveShaperNode : AudioNode {
>  
> +      [SetterThrows] attribute Float32Array? curve;

We usually put extended attribute on their own line, above the member they refer to.
Attachment #8637163 - Flags: review?(padenot) → review+
(Assignee)

Comment 4

3 years ago
Thanks for the review! I've updated the spacing in the webidl file.

https://treeherder.mozilla.org/#/jobs?repo=try&revision=d92588ec9f9d
(Assignee)

Comment 5

3 years ago
Comment on attachment 8637163 [details] [diff] [review]
webaudio.patch

Review of attachment 8637163 [details] [diff] [review]:
-----------------------------------------------------------------

Adding smaug for the changes in the webidl file (setting curve can throw, as per spec in comment 0).
Attachment #8637163 - Flags: review?(bugs)

Comment 6

3 years ago
Comment on attachment 8637163 [details] [diff] [review]
webaudio.patch

What paul said about [SetterThrows] being on its own line.
Attachment #8637163 - Flags: review?(bugs) → review+
https://hg.mozilla.org/mozilla-central/rev/e87e35af9d3c
Status: ASSIGNED → RESOLVED
Last Resolved: 3 years ago
status-firefox42: --- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla42
You need to log in before you can comment on or make changes to this bug.