зеркало из https://github.com/mozilla/gecko-dev.git
Bug 809882 - Disallow non-positive arguments to AudioContext.createDelay; r=bzbarsky
This commit is contained in:
Родитель
e18f765a77
Коммит
e09214c973
|
@ -104,8 +104,12 @@ AudioContext::CreateGain()
|
||||||
}
|
}
|
||||||
|
|
||||||
already_AddRefed<DelayNode>
|
already_AddRefed<DelayNode>
|
||||||
AudioContext::CreateDelay(float aMaxDelayTime)
|
AudioContext::CreateDelay(float aMaxDelayTime, ErrorResult& aRv)
|
||||||
{
|
{
|
||||||
|
if (aMaxDelayTime <= 0.f) {
|
||||||
|
aRv.Throw(NS_ERROR_DOM_NOT_SUPPORTED_ERR);
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
nsRefPtr<DelayNode> delayNode = new DelayNode(this, aMaxDelayTime);
|
nsRefPtr<DelayNode> delayNode = new DelayNode(this, aMaxDelayTime);
|
||||||
return delayNode.forget();
|
return delayNode.forget();
|
||||||
}
|
}
|
||||||
|
|
|
@ -73,7 +73,7 @@ public:
|
||||||
CreateGain();
|
CreateGain();
|
||||||
|
|
||||||
already_AddRefed<DelayNode>
|
already_AddRefed<DelayNode>
|
||||||
CreateDelay(float aMaxDelayTime);
|
CreateDelay(float aMaxDelayTime, ErrorResult& aRv);
|
||||||
|
|
||||||
already_AddRefed<PannerNode>
|
already_AddRefed<PannerNode>
|
||||||
CreatePanner();
|
CreatePanner();
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<pre id="test">
|
<pre id="test">
|
||||||
|
<script src="webaudio.js" type="text/javascript"></script>
|
||||||
<script class="testbody" type="text/javascript">
|
<script class="testbody" type="text/javascript">
|
||||||
|
|
||||||
SimpleTest.waitForExplicitFinish();
|
SimpleTest.waitForExplicitFinish();
|
||||||
|
@ -52,6 +53,14 @@ addLoadEvent(function() {
|
||||||
is(delay2.delayTime.minValue, 0, "Correct min value");
|
is(delay2.delayTime.minValue, 0, "Correct min value");
|
||||||
is(delay2.delayTime.maxValue, 2.0, "Correct max value");
|
is(delay2.delayTime.maxValue, 2.0, "Correct max value");
|
||||||
|
|
||||||
|
expectException(function() {
|
||||||
|
context.createDelay(0);
|
||||||
|
}, DOMException.NOT_SUPPORTED_ERR);
|
||||||
|
expectException(function() {
|
||||||
|
context.createDelay(-1);
|
||||||
|
}, DOMException.NOT_SUPPORTED_ERR);
|
||||||
|
context.createDelay(1); // should not throw
|
||||||
|
|
||||||
source.start(0);
|
source.start(0);
|
||||||
SimpleTest.executeSoon(function() {
|
SimpleTest.executeSoon(function() {
|
||||||
source.stop(0);
|
source.stop(0);
|
||||||
|
|
|
@ -28,7 +28,7 @@ interface mozAudioContext {
|
||||||
|
|
||||||
[Creator]
|
[Creator]
|
||||||
GainNode createGain();
|
GainNode createGain();
|
||||||
[Creator]
|
[Creator, Throws]
|
||||||
DelayNode createDelay(optional float maxDelayTime = 1);
|
DelayNode createDelay(optional float maxDelayTime = 1);
|
||||||
[Creator]
|
[Creator]
|
||||||
BiquadFilterNode createBiquadFilter();
|
BiquadFilterNode createBiquadFilter();
|
||||||
|
|
Загрузка…
Ссылка в новой задаче