| Index: third_party/WebKit/Source/modules/webaudio/PeriodicWave.cpp
|
| diff --git a/third_party/WebKit/Source/modules/webaudio/PeriodicWave.cpp b/third_party/WebKit/Source/modules/webaudio/PeriodicWave.cpp
|
| index d55f92cb1be9ce48800ab23a2fc2785b7c136972..4a9e8db73300490a2b3c6b7a2de366ddb321e9fc 100644
|
| --- a/third_party/WebKit/Source/modules/webaudio/PeriodicWave.cpp
|
| +++ b/third_party/WebKit/Source/modules/webaudio/PeriodicWave.cpp
|
| @@ -99,13 +99,6 @@ PeriodicWave* PeriodicWave::create(BaseAudioContext* context,
|
| ? options.disableNormalization()
|
| : false;
|
|
|
| - if (!options.hasReal() && !options.hasImag()) {
|
| - exceptionState.throwDOMException(
|
| - InvalidStateError,
|
| - "At least one of real and imag members must be specified.");
|
| - return nullptr;
|
| - }
|
| -
|
| Vector<float> realCoef;
|
| Vector<float> imagCoef;
|
|
|
| @@ -115,11 +108,16 @@ PeriodicWave* PeriodicWave::create(BaseAudioContext* context,
|
| imagCoef = options.imag();
|
| else
|
| imagCoef.resize(realCoef.size());
|
| - } else {
|
| - // We know real is not given, so imag must exist (because we checked for
|
| - // this above).
|
| + } else if (options.hasImag()) {
|
| + // |real| not given, but we have |imag|.
|
| imagCoef = options.imag();
|
| realCoef.resize(imagCoef.size());
|
| + } else {
|
| + // Neither |real| nor |imag| given. Return an object that would
|
| + // generate a sine wave, which means real = [0,0], and imag = [0, 1]
|
| + realCoef.resize(2);
|
| + imagCoef.resize(2);
|
| + imagCoef[1] = 1;
|
| }
|
|
|
| return create(*context, realCoef.size(), realCoef.data(), imagCoef.size(),
|
|
|