From a865255e0e449ccd0206083cf0d32534d614766a Mon Sep 17 00:00:00 2001 From: Margareta Eliza Balazs Date: Mon, 16 Jul 2018 17:11:14 +0300 Subject: [PATCH] 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) --- dom/media/webaudio/PeriodicWave.cpp | 53 +++++++------------ dom/webidl/PeriodicWave.webidl | 3 ++ .../meta/webaudio/idlharness.https.html.ini | 6 +++ 3 files changed, 29 insertions(+), 33 deletions(-) diff --git a/dom/media/webaudio/PeriodicWave.cpp b/dom/media/webaudio/PeriodicWave.cpp index 2cb9659c2cf2..bf979ae2245a 100644 --- a/dom/media/webaudio/PeriodicWave.cpp +++ b/dom/media/webaudio/PeriodicWave.cpp @@ -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(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; diff --git a/dom/webidl/PeriodicWave.webidl b/dom/webidl/PeriodicWave.webidl index ff00ccb92292..b5edb9a401eb 100644 --- a/dom/webidl/PeriodicWave.webidl +++ b/dom/webidl/PeriodicWave.webidl @@ -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 + // . Constructor(BaseAudioContext context, optional PeriodicWaveOptions options)] interface PeriodicWave { }; diff --git a/testing/web-platform/meta/webaudio/idlharness.https.html.ini b/testing/web-platform/meta/webaudio/idlharness.https.html.ini index e0e26b72f12f..3813008a544f 100644 --- a/testing/web-platform/meta/webaudio/idlharness.https.html.ini +++ b/testing/web-platform/meta/webaudio/idlharness.https.html.ini @@ -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