Changeset 152489 in webkit
- Timestamp:
- Jul 9, 2013 2:59:33 AM (11 years ago)
- Location:
- trunk
- Files:
-
- 4 added
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r152488 r152489 1 2013-07-09 Praveen R Jadhav <praveen.j@samsung.com> 2 3 Update Exception handling in WebAudio. 4 https://bugs.webkit.org/show_bug.cgi?id=118405. 5 6 Reviewed by Chris Rogers. 7 8 New test cases to check exception handling in AnalyserNode and 9 AudioBufferSourceNode. 10 11 * webaudio/analyser-exception-expected.txt: Added. 12 * webaudio/analyser-exception.html: Added. 13 * webaudio/audiobuffersource-exception-expected.txt: Added. 14 * webaudio/audiobuffersource-exception.html: Added. 15 1 16 2013-07-09 Zoltan Arvai <zarvai@inf.u-szeged.hu> 2 17 -
trunk/Source/WebCore/ChangeLog
r152479 r152489 1 2013-07-09 Praveen R Jadhav <praveen.j@samsung.com> 2 3 Update Exception handling in WebAudio. 4 https://bugs.webkit.org/show_bug.cgi?id=118405. 5 6 Reviewed by Chris Rogers. 7 8 AudioBufferSourceNode, OscillatorNode and AnalyserNode don't 9 propagate exception mentioned in WebAudio spec. 10 Code updated to throw DOM exception as expected. 11 12 Tests: webaudio/analyser-exception.html 13 webaudio/audiobuffersource-exception.html 14 15 * Modules/webaudio/AnalyserNode.cpp: 16 (WebCore::AnalyserNode::setFftSize): 17 (WebCore::AnalyserNode::setMinDecibels): 18 (WebCore::AnalyserNode::setMaxDecibels): 19 (WebCore::AnalyserNode::setSmoothingTimeConstant): 20 * Modules/webaudio/AnalyserNode.h: 21 * Modules/webaudio/AnalyserNode.idl: 22 * Modules/webaudio/AudioBufferSourceNode.cpp: 23 (WebCore::AudioBufferSourceNode::startGrain): 24 (WebCore::AudioBufferSourceNode::noteGrainOn): 25 * Modules/webaudio/AudioBufferSourceNode.h: 26 * Modules/webaudio/AudioBufferSourceNode.idl: 27 * Modules/webaudio/AudioContext.cpp: 28 (WebCore::AudioContext::createBuffer): 29 (WebCore::AudioContext::createScriptProcessor): 30 (WebCore::AudioContext::createPeriodicWave): 31 * Modules/webaudio/AudioScheduledSourceNode.cpp: 32 (WebCore::AudioScheduledSourceNode::start): 33 (WebCore::AudioScheduledSourceNode::stop): 34 (WebCore::AudioScheduledSourceNode::noteOn): 35 (WebCore::AudioScheduledSourceNode::noteOff): 36 * Modules/webaudio/AudioScheduledSourceNode.h: 37 * Modules/webaudio/OscillatorNode.idl: 38 1 39 2013-07-08 Martin Robinson <mrobinson@igalia.com> 2 40 -
trunk/Source/WebCore/Modules/webaudio/AnalyserNode.cpp
r149175 r152489 76 76 { 77 77 if (!m_analyser.setFftSize(size)) 78 ec = NOT_SUPPORTED_ERR; 78 ec = INDEX_SIZE_ERR; 79 } 80 81 void AnalyserNode::setMinDecibels(float k, ExceptionCode& ec) 82 { 83 if (k > maxDecibels()) { 84 ec = INDEX_SIZE_ERR; 85 return; 86 } 87 88 m_analyser.setMinDecibels(k); 89 } 90 91 void AnalyserNode::setMaxDecibels(float k, ExceptionCode& ec) 92 { 93 if (k < minDecibels()) { 94 ec = INDEX_SIZE_ERR; 95 return; 96 } 97 98 m_analyser.setMaxDecibels(k); 99 } 100 101 void AnalyserNode::setSmoothingTimeConstant(float k, ExceptionCode& ec) 102 { 103 if (k < 0 || k > 1) { 104 ec = INDEX_SIZE_ERR; 105 return; 106 } 107 108 m_analyser.setSmoothingTimeConstant(k); 79 109 } 80 110 -
trunk/Source/WebCore/Modules/webaudio/AnalyserNode.h
r131486 r152489 51 51 unsigned frequencyBinCount() const { return m_analyser.frequencyBinCount(); } 52 52 53 void setMinDecibels(float k ) { m_analyser.setMinDecibels(k); }53 void setMinDecibels(float k, ExceptionCode&); 54 54 float minDecibels() const { return m_analyser.minDecibels(); } 55 55 56 void setMaxDecibels(float k ) { m_analyser.setMaxDecibels(k); }56 void setMaxDecibels(float k, ExceptionCode&); 57 57 float maxDecibels() const { return m_analyser.maxDecibels(); } 58 58 59 void setSmoothingTimeConstant(float k ) { m_analyser.setSmoothingTimeConstant(k); }59 void setSmoothingTimeConstant(float k, ExceptionCode&); 60 60 float smoothingTimeConstant() const { return m_analyser.smoothingTimeConstant(); } 61 61 -
trunk/Source/WebCore/Modules/webaudio/AnalyserNode.idl
r151321 r152489 31 31 32 32 // minDecibels / maxDecibels represent the range to scale the FFT analysis data for conversion to unsigned byte values. 33 attribute float minDecibels;34 attribute float maxDecibels;33 [SetterRaisesException] attribute float minDecibels; 34 [SetterRaisesException] attribute float maxDecibels; 35 35 36 36 // A value from 0.0 -> 1.0 where 0.0 represents no time averaging with the last analysis frame. 37 attribute float smoothingTimeConstant;37 [SetterRaisesException] attribute float smoothingTimeConstant; 38 38 39 39 // Copies the current frequency data into the passed array. -
trunk/Source/WebCore/Modules/webaudio/AudioBufferSourceNode.cpp
r151301 r152489 374 374 } 375 375 376 void AudioBufferSourceNode::startGrain(double when, double grainOffset )376 void AudioBufferSourceNode::startGrain(double when, double grainOffset, ExceptionCode& ec) 377 377 { 378 378 // Duration of 0 has special value, meaning calculate based on the entire buffer's duration. 379 startGrain(when, grainOffset, 0 );380 } 381 382 void AudioBufferSourceNode::startGrain(double when, double grainOffset, double grainDuration )379 startGrain(when, grainOffset, 0, ec); 380 } 381 382 void AudioBufferSourceNode::startGrain(double when, double grainOffset, double grainDuration, ExceptionCode& ec) 383 383 { 384 384 ASSERT(isMainThread()); … … 387 387 context()->removeBehaviorRestriction(AudioContext::RequireUserGestureForAudioStartRestriction); 388 388 389 if (m_playbackState != UNSCHEDULED_STATE) 389 if (m_playbackState != UNSCHEDULED_STATE) { 390 ec = INVALID_STATE_ERR; 390 391 return; 392 } 391 393 392 394 if (!buffer()) … … 422 424 423 425 #if ENABLE(LEGACY_WEB_AUDIO) 424 void AudioBufferSourceNode::noteGrainOn(double when, double grainOffset, double grainDuration )425 { 426 startGrain(when, grainOffset, grainDuration );426 void AudioBufferSourceNode::noteGrainOn(double when, double grainOffset, double grainDuration, ExceptionCode& ec) 427 { 428 startGrain(when, grainOffset, grainDuration, ec); 427 429 } 428 430 #endif -
trunk/Source/WebCore/Modules/webaudio/AudioBufferSourceNode.h
r150924 r152489 30 30 #include "AudioParam.h" 31 31 #include "AudioScheduledSourceNode.h" 32 #include "ExceptionCode.h" 32 33 #include "PannerNode.h" 33 34 #include <wtf/OwnArrayPtr.h> … … 63 64 64 65 // Play-state 65 void startGrain(double when, double grainOffset );66 void startGrain(double when, double grainOffset, double grainDuration );66 void startGrain(double when, double grainOffset, ExceptionCode&); 67 void startGrain(double when, double grainOffset, double grainDuration, ExceptionCode&); 67 68 68 69 #if ENABLE(LEGACY_WEB_AUDIO) 69 void noteGrainOn(double when, double grainOffset, double grainDuration );70 void noteGrainOn(double when, double grainOffset, double grainDuration, ExceptionCode&); 70 71 #endif 71 72 -
trunk/Source/WebCore/Modules/webaudio/AudioBufferSourceNode.idl
r151321 r152489 45 45 attribute double loopEnd; 46 46 47 void start(double when);48 [ImplementedAs=startGrain ] void start(double when, double grainOffset);49 [ImplementedAs=startGrain ] void start(double when, double grainOffset, double grainDuration);50 void stop(double when);47 [RaisesException] void start(double when); 48 [ImplementedAs=startGrain, RaisesException] void start(double when, double grainOffset); 49 [ImplementedAs=startGrain, RaisesException] void start(double when, double grainOffset, double grainDuration); 50 [RaisesException] void stop(double when); 51 51 52 52 [Conditional=LEGACY_WEB_AUDIO] attribute boolean looping; // This is an alias for the .loop attribute for backwards compatibility. 53 53 54 [Conditional=LEGACY_WEB_AUDIO ] void noteOn(double when);55 [Conditional=LEGACY_WEB_AUDIO ] void noteGrainOn(double when, double grainOffset, double grainDuration);56 [Conditional=LEGACY_WEB_AUDIO ] void noteOff(double when);54 [Conditional=LEGACY_WEB_AUDIO, RaisesException] void noteOn(double when); 55 [Conditional=LEGACY_WEB_AUDIO, RaisesException] void noteGrainOn(double when, double grainOffset, double grainDuration); 56 [Conditional=LEGACY_WEB_AUDIO, RaisesException] void noteOff(double when); 57 57 58 58 attribute EventListener onended; -
trunk/Source/WebCore/Modules/webaudio/AudioContext.cpp
r151914 r152489 92 92 93 93 const unsigned MaxNodesToDeletePerQuantum = 10; 94 const unsigned MaxPeriodicWaveLength = 4096; 94 95 95 96 namespace WebCore { … … 329 330 RefPtr<AudioBuffer> audioBuffer = AudioBuffer::create(numberOfChannels, numberOfFrames, sampleRate); 330 331 if (!audioBuffer.get()) { 331 ec = SYNTAX_ERR;332 ec = NOT_SUPPORTED_ERR; 332 333 return 0; 333 334 } … … 465 466 466 467 if (!node.get()) { 467 ec = SYNTAX_ERR;468 ec = INDEX_SIZE_ERR; 468 469 return 0; 469 470 } … … 598 599 ASSERT(isMainThread()); 599 600 600 if (!real || !imag || (real->length() != imag->length() )) {601 if (!real || !imag || (real->length() != imag->length() || (real->length() > MaxPeriodicWaveLength) || (real->length() <= 0))) { 601 602 ec = SYNTAX_ERR; 602 603 return 0; -
trunk/Source/WebCore/Modules/webaudio/AudioScheduledSourceNode.cpp
r151301 r152489 136 136 } 137 137 138 void AudioScheduledSourceNode::start(double when )138 void AudioScheduledSourceNode::start(double when, ExceptionCode& ec) 139 139 { 140 140 ASSERT(isMainThread()); … … 143 143 context()->removeBehaviorRestriction(AudioContext::RequireUserGestureForAudioStartRestriction); 144 144 145 if (m_playbackState != UNSCHEDULED_STATE) 146 return; 145 if (m_playbackState != UNSCHEDULED_STATE) { 146 ec = INVALID_STATE_ERR; 147 return; 148 } 147 149 148 150 m_startTime = when; … … 150 152 } 151 153 152 void AudioScheduledSourceNode::stop(double when )154 void AudioScheduledSourceNode::stop(double when, ExceptionCode& ec) 153 155 { 154 156 ASSERT(isMainThread()); 155 if (!(m_playbackState == SCHEDULED_STATE || m_playbackState == PLAYING_STATE)) 156 return; 157 if (!(m_playbackState == SCHEDULED_STATE || m_playbackState == PLAYING_STATE)) { 158 ec = INVALID_STATE_ERR; 159 return; 160 } 157 161 158 162 when = max(0.0, when); … … 161 165 162 166 #if ENABLE(LEGACY_WEB_AUDIO) 163 void AudioScheduledSourceNode::noteOn(double when )164 { 165 start(when );166 } 167 168 void AudioScheduledSourceNode::noteOff(double when )169 { 170 stop(when );167 void AudioScheduledSourceNode::noteOn(double when, ExceptionCode& ec) 168 { 169 start(when, ec); 170 } 171 172 void AudioScheduledSourceNode::noteOff(double when, ExceptionCode& ec) 173 { 174 stop(when, ec); 171 175 } 172 176 #endif -
trunk/Source/WebCore/Modules/webaudio/AudioScheduledSourceNode.h
r150924 r152489 31 31 32 32 #include "AudioNode.h" 33 #include "ExceptionCode.h" 33 34 34 35 namespace WebCore { … … 58 59 59 60 // Scheduling. 60 void start(double when );61 void stop(double when );61 void start(double when, ExceptionCode&); 62 void stop(double when, ExceptionCode&); 62 63 63 64 #if ENABLE(LEGACY_WEB_AUDIO) 64 void noteOn(double when );65 void noteOff(double when );65 void noteOn(double when, ExceptionCode&); 66 void noteOff(double when, ExceptionCode&); 66 67 #endif 67 68 -
trunk/Source/WebCore/Modules/webaudio/OscillatorNode.idl
r151914 r152489 49 49 readonly attribute AudioParam detune; // in Cents 50 50 51 void start(double when);52 void stop(double when);51 [RaisesException] void start(double when); 52 [RaisesException] void stop(double when); 53 53 54 [Conditional=LEGACY_WEB_AUDIO ] void noteOn(double when);55 [Conditional=LEGACY_WEB_AUDIO ] void noteOff(double when);54 [Conditional=LEGACY_WEB_AUDIO, RaisesException] void noteOn(double when); 55 [Conditional=LEGACY_WEB_AUDIO, RaisesException] void noteOff(double when); 56 56 57 57 void setPeriodicWave(PeriodicWave wave);
Note: See TracChangeset
for help on using the changeset viewer.