Bug 949474 - Reflect the fact that the nominal range for the sampleRate argument of the AudioContext.createBuffer changed in the spec. r=ehsan
☠☠ backed out by 6532132dc01e ☠ ☠
authorPaul Adenot <paul@paul.cx>
Thu, 12 Dec 2013 16:05:31 +0100
changeset 160253 71f9f57e5ddbb3e231a27181d4b7e0b118e49b11
parent 160252 b2a78c740ec592b934d947413dedea2961eb966f
child 160254 a9654d11cb2635cd255b5f6078689d8764a8e64c
push id25827
push userkwierso@gmail.com
push dateFri, 13 Dec 2013 03:13:04 +0000
treeherdermozilla-central@1bc33fa19b24 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersehsan
bugs949474
milestone29.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 949474 - Reflect the fact that the nominal range for the sampleRate argument of the AudioContext.createBuffer changed in the spec. r=ehsan
content/media/webaudio/AudioContext.cpp
content/media/webaudio/test/test_AudioBuffer.html
--- a/content/media/webaudio/AudioContext.cpp
+++ b/content/media/webaudio/AudioContext.cpp
@@ -169,18 +169,18 @@ AudioContext::CreateBufferSource()
   return bufferNode.forget();
 }
 
 already_AddRefed<AudioBuffer>
 AudioContext::CreateBuffer(JSContext* aJSContext, uint32_t aNumberOfChannels,
                            uint32_t aLength, float aSampleRate,
                            ErrorResult& aRv)
 {
-  if (aSampleRate < 8000 || aSampleRate > 96000 || !aLength) {
-    aRv.Throw(NS_ERROR_DOM_NOT_SUPPORTED_ERR);
+  if (aSampleRate < 8000 || aSampleRate > 192000 || !aLength || !aNumberOfChannels) {
+    aRv.Throw(NS_ERROR_DOM_INDEX_SIZE_ERR);
     return nullptr;
   }
 
   if (aLength > INT32_MAX) {
     aRv.Throw(NS_ERROR_OUT_OF_MEMORY);
     return nullptr;
   }
 
--- a/content/media/webaudio/test/test_AudioBuffer.html
+++ b/content/media/webaudio/test/test_AudioBuffer.html
@@ -76,24 +76,30 @@ addLoadEvent(function() {
   }, DOMException.INDEX_SIZE_ERR);
 
   expectException(function() {
     buffer.copyToChannel(newData, 0, 100);
   }, DOMException.INDEX_SIZE_ERR);
 
   expectException(function() {
     context.createBuffer(2, 2048, 7999);
-  }, DOMException.NOT_SUPPORTED_ERR);
+  }, DOMException.INDEX_SIZE_ERR);
   expectException(function() {
-    context.createBuffer(2, 2048, 96001);
-  }, DOMException.NOT_SUPPORTED_ERR);
+    context.createBuffer(2, 2048, 192001);
+  }, DOMException.INDEX_SIZE_ERR);
   context.createBuffer(2, 2048, 8000);  // no exception
-  context.createBuffer(2, 2048, 96000); // no exception
+  context.createBuffer(2, 2048, 192000); // no exception
+  context.createBuffer(32, 2048, 48000); // no exception
+  // Null length
   expectException(function() {
     context.createBuffer(2, 0, 48000);
-  }, DOMException.NOT_SUPPORTED_ERR);
+  }, DOMException.INDEX_SIZE_ERR);
+  // Null number of channels
+  expectException(function() {
+    context.createBuffer(0, 2048, 48000);
+  }, DOMException.INDEX_SIZE_ERR);
   SimpleTest.finish();
 });
 
 </script>
 </pre>
 </body>
 </html>