зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1080909 - Do not accept a zero time constant when calling AudioParam.setTargetAtTime in order to avoid the division by zero later on; r=padenot
This commit is contained in:
Родитель
0888b1668e
Коммит
7c556dd594
|
@ -15,6 +15,7 @@
|
|||
|
||||
#include "nsTArray.h"
|
||||
#include "math.h"
|
||||
#include "WebAudioUtils.h"
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
|
@ -75,6 +76,11 @@ struct AudioTimelineEvent {
|
|||
}
|
||||
}
|
||||
|
||||
if (mType == AudioTimelineEvent::SetTarget &&
|
||||
WebAudioUtils::FuzzyEqual(mTimeConstant, 0.0)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return IsValid(mTime) &&
|
||||
IsValid(mValue) &&
|
||||
IsValid(mTimeConstant) &&
|
||||
|
|
|
@ -391,7 +391,7 @@ void TestSetTargetZeroTimeConstant()
|
|||
ErrorResultMock rv;
|
||||
|
||||
timeline.SetTargetAtTime(20.0f, 1.0, 0.0, rv);
|
||||
is(timeline.GetValueAtTime(10.), 20.f, "Should get the correct value with timeConstant == 0");
|
||||
is(rv, NS_ERROR_DOM_SYNTAX_ERR, "Correct error code returned");
|
||||
}
|
||||
|
||||
void TestExponentialInvalidPreviousZeroValue()
|
||||
|
|
Загрузка…
Ссылка в новой задаче