Backed out 2 changesets (bug 1456271) for mda failures in dom/media/webaudio/test/test_periodicWave.html

Backed out changeset b99bd4121181 (bug 1456271)
Backed out changeset b37a0606d6a0 (bug 1456271)
This commit is contained in:
Margareta Eliza Balazs 2018-07-16 17:11:14 +03:00
parent 357fe664a2
commit a865255e0e
3 changed files with 29 additions and 33 deletions

View File

@ -26,7 +26,7 @@ PeriodicWave::PeriodicWave(AudioContext* aContext,
, mDisableNormalization(aDisableNormalization)
{
MOZ_ASSERT(aContext);
MOZ_ASSERT((aRealData || aImagData) || aLength == 2);
MOZ_ASSERT(aRealData || aImagData);
// Caller should have checked this and thrown.
MOZ_ASSERT(aLength > 0);
@ -44,29 +44,21 @@ PeriodicWave::PeriodicWave(AudioContext* aContext,
auto data = static_cast<float*>(buffer->Data());
mCoefficients.mBuffer = std::move(buffer);
if (!aRealData && !aImagData) {
PodZero(data, aLength);
mCoefficients.mChannelData.AppendElement(data);
data += aLength;
data[0] = 0.0f;
data[1] = 1.0f;
mCoefficients.mChannelData.AppendElement(data);
if (aRealData) {
PodCopy(data, aRealData, aLength);
} else {
if (aRealData) {
PodCopy(data, aRealData, aLength);
} else {
PodZero(data, aLength);
}
mCoefficients.mChannelData.AppendElement(data);
data += aLength;
if (aImagData) {
PodCopy(data, aImagData, aLength);
} else {
PodZero(data, aLength);
}
mCoefficients.mChannelData.AppendElement(data);
PodZero(data, aLength);
}
mCoefficients.mChannelData.AppendElement(data);
data += aLength;
if (aImagData) {
PodCopy(data, aImagData, aLength);
} else {
PodZero(data, aLength);
}
mCoefficients.mChannelData.AppendElement(data);
mCoefficients.mVolume = 1.0f;
mCoefficients.mBufferFormat = AUDIO_FORMAT_FLOAT32;
}
@ -77,6 +69,10 @@ PeriodicWave::Constructor(const GlobalObject& aGlobal,
const PeriodicWaveOptions& aOptions,
ErrorResult& aRv)
{
if (!aOptions.mReal.WasPassed() && !aOptions.mImag.WasPassed()) {
aRv.Throw(NS_ERROR_DOM_INDEX_SIZE_ERR);
return nullptr;
}
if (aOptions.mReal.WasPassed() && aOptions.mImag.WasPassed() &&
aOptions.mReal.Value().Length() != aOptions.mImag.Value().Length()) {
@ -84,17 +80,8 @@ PeriodicWave::Constructor(const GlobalObject& aGlobal,
return nullptr;
}
uint32_t length = 0;
if (aOptions.mReal.WasPassed()) {
length = aOptions.mReal.Value().Length();
} else if (aOptions.mImag.WasPassed()) {
length = aOptions.mImag.Value().Length();
} else {
// If nothing has been passed, this PeriodicWave will be a sine wave: 2
// elements for each array, the second imaginary component set to 1.0.
length = 2;
}
uint32_t length =
aOptions.mReal.WasPassed() ? aOptions.mReal.Value().Length() : aOptions.mImag.Value().Length();
if (length == 0) {
aRv.Throw(NS_ERROR_DOM_INDEX_SIZE_ERR);
return nullptr;

View File

@ -20,6 +20,9 @@ dictionary PeriodicWaveOptions : PeriodicWaveConstraints {
};
[Pref="dom.webaudio.enabled",
// XXXbz The second arg is not optional in the spec, but that looks
// like a spec bug to me. See
// <https://github.com/WebAudio/web-audio-api/issues/1116>.
Constructor(BaseAudioContext context, optional PeriodicWaveOptions options)]
interface PeriodicWave {
};

View File

@ -164,6 +164,12 @@
[MediaStreamTrackAudioSourceNode interface: existence and properties of interface prototype object's @@unscopables property]
expected: FAIL
[PeriodicWave must be primary interface of new PeriodicWave(context)]
expected: FAIL
[Stringification of new PeriodicWave(context)]
expected: FAIL
[AudioWorklet interface: existence and properties of interface object]
expected: FAIL