Bug 949474 - Reflect the fact that the nominal range for the sampleRate argument of the AudioContext.createBuffer changed in the spec. r=

* * *
Bug 949474 - Fix various oranges, on a CLOSED TREE.

--HG--
extra : rebase_source : 1317857063b7f028687aab1c00f113d947cd5685
This commit is contained in:
Paul Adenot 2013-12-13 17:58:00 +01:00
Родитель 9d29199dc3
Коммит b31e1049fa
4 изменённых файлов: 19 добавлений и 12 удалений

Просмотреть файл

@ -174,8 +174,8 @@ 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;
}

Просмотреть файл

@ -81,15 +81,21 @@ addLoadEvent(function() {
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();
});

Просмотреть файл

@ -21,8 +21,6 @@ var gTest = {
var source = context.createBufferSource();
source.buffer = buffer;
var sp = context.createScriptProcessor(2048 * 4, 1);
source.start(0);
source.loop = true;
source.loopStart = buffer.duration * 0.25;

Просмотреть файл

@ -9,9 +9,12 @@
<pre id="test">
<script class="testbody" type="text/javascript">
var ctx = new AudioContext();
ctx.createBuffer(0, 1, ctx.sampleRate);
ok(true, "The test should not crash during CC");
try {
var ctx = new AudioContext();
ctx.createBuffer(0, 1, ctx.sampleRate);
} catch (e) {
ok(true, "The test should not crash during CC");
}
</script>
</pre>