Bug 1443228 - Make the ConvolverNode ctor throw NotSupportedError when passed a buffer with an invalid channel count. r?karlt
Spec: https://webaudio.github.io/web-audio-api/#dom-convolvernode-buffer
This is well tested in web-platform-test, the test has been added a day ago and
will be merged soon: https://github.com/w3c/web-platform-tests/blob/16376ce7a6ca10ca6ac31dff565c47b6555e3103/webaudio/the-audio-api/the-convolvernode-interface/convolver-channels.html
MozReview-Commit-ID: LxsDomV5bEL
--- a/dom/media/webaudio/ConvolverNode.cpp
+++ b/dom/media/webaudio/ConvolverNode.cpp
@@ -241,17 +241,17 @@ ConvolverNode::SetBuffer(JSContext* aCx,
if (aBuffer) {
switch (aBuffer->NumberOfChannels()) {
case 1:
case 2:
case 4:
// Supported number of channels
break;
default:
- aRv.Throw(NS_ERROR_DOM_SYNTAX_ERR);
+ aRv.Throw(NS_ERROR_DOM_NOT_SUPPORTED_ERR);
return;
}
}
// Send the buffer to the stream
AudioNodeStream* ns = mStream;
MOZ_ASSERT(ns, "Why don't we have a stream here?");
if (aBuffer) {