Closed Bug 1186343 Opened 9 years ago Closed 9 years ago

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

Categories

(Core :: Web Audio, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla42
Tracking Status
firefox42 --- fixed

People

(Reporter: padenot, Assigned: bbouvier, Mentored)

Details

Attachments

(1 file)

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.
Attached patch webaudio.patchSplinter Review
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)
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+
Thanks for the review! I've updated the spacing in the webidl file.

https://treeherder.mozilla.org/#/jobs?repo=try&revision=d92588ec9f9d
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 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
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla42
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: