Changeset 267639 in webkit
- Timestamp:
- Sep 26, 2020, 3:13:56 PM (6 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 2 deleted
- 24 edited
-
LayoutTests/ChangeLog (modified) (1 diff)
-
LayoutTests/http/wpt/webaudio/audiocontext-stopped-expected.txt (deleted)
-
LayoutTests/http/wpt/webaudio/audiocontext-stopped.html (deleted)
-
LayoutTests/webaudio/MediaStreamAudioDestination/create-in-destroyed-context-expected.txt (modified) (1 diff)
-
LayoutTests/webaudio/construct-node-with-closed-context-expected.txt (added)
-
LayoutTests/webaudio/construct-node-with-closed-context.html (added)
-
Source/WebCore/ChangeLog (modified) (1 diff)
-
Source/WebCore/Modules/webaudio/AnalyserNode.cpp (modified) (1 diff)
-
Source/WebCore/Modules/webaudio/AudioBufferSourceNode.cpp (modified) (1 diff)
-
Source/WebCore/Modules/webaudio/BaseAudioContext.cpp (modified) (4 diffs)
-
Source/WebCore/Modules/webaudio/BaseAudioContext.h (modified) (1 diff)
-
Source/WebCore/Modules/webaudio/BiquadFilterNode.cpp (modified) (1 diff)
-
Source/WebCore/Modules/webaudio/ChannelMergerNode.cpp (modified) (1 diff)
-
Source/WebCore/Modules/webaudio/ChannelSplitterNode.cpp (modified) (1 diff)
-
Source/WebCore/Modules/webaudio/ConstantSourceNode.cpp (modified) (1 diff)
-
Source/WebCore/Modules/webaudio/ConvolverNode.cpp (modified) (1 diff)
-
Source/WebCore/Modules/webaudio/DelayNode.cpp (modified) (1 diff)
-
Source/WebCore/Modules/webaudio/DynamicsCompressorNode.cpp (modified) (1 diff)
-
Source/WebCore/Modules/webaudio/GainNode.cpp (modified) (1 diff)
-
Source/WebCore/Modules/webaudio/IIRFilterNode.cpp (modified) (1 diff)
-
Source/WebCore/Modules/webaudio/MediaElementAudioSourceNode.cpp (modified) (1 diff)
-
Source/WebCore/Modules/webaudio/MediaStreamAudioDestinationNode.cpp (modified) (1 diff)
-
Source/WebCore/Modules/webaudio/MediaStreamAudioSourceNode.cpp (modified) (1 diff)
-
Source/WebCore/Modules/webaudio/OscillatorNode.cpp (modified) (1 diff)
-
Source/WebCore/Modules/webaudio/PannerNode.cpp (modified) (1 diff)
-
Source/WebCore/Modules/webaudio/PeriodicWave.cpp (modified) (1 diff)
-
Source/WebCore/Modules/webaudio/StereoPannerNode.cpp (modified) (1 diff)
-
Source/WebCore/Modules/webaudio/WaveShaperNode.cpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r267637 r267639 1 2020-09-26 Chris Dumez <cdumez@apple.com> 2 3 Constructing an AudioNode for a closed context should not throw an exception 4 https://bugs.webkit.org/show_bug.cgi?id=216994 5 6 Reviewed by Darin Adler. 7 8 * http/wpt/webaudio/audiocontext-stopped-expected.txt: Removed. 9 * http/wpt/webaudio/audiocontext-stopped.html: Removed. 10 Drop outdated test. It is replaced with the new test I am introducing. 11 12 * webaudio/MediaStreamAudioDestination/create-in-destroyed-context-expected.txt: 13 Rebaseline Blink-imported test that is now passing. 14 15 * webaudio/construct-node-with-closed-context-expected.txt: Added. 16 * webaudio/construct-node-with-closed-context.html: Added. 17 Add layout test coverage. 18 1 19 2020-09-26 Zalan Bujtas <zalan@apple.com> 2 20 -
trunk/LayoutTests/webaudio/MediaStreamAudioDestination/create-in-destroyed-context-expected.txt
r267307 r267639 1 1 2 FAIL MediaStreamAudioDestinationNode creation in closed iframe throws error assert_throws_dom: function "() => { 3 let stream = iframe_ac.createMediaStreamDestination(); 4 }" threw object "InvalidStateError: The object is in an invalid state." that is not a DOMException NotAllowedError: property "code" is equal to 11, expected 0 2 PASS MediaStreamAudioDestinationNode creation in closed iframe throws error 5 3 -
trunk/Source/WebCore/ChangeLog
r267638 r267639 1 2020-09-26 Chris Dumez <cdumez@apple.com> 2 3 Constructing an AudioNode for a closed context should not throw an exception 4 https://bugs.webkit.org/show_bug.cgi?id=216994 5 6 Reviewed by Darin Adler. 7 8 Constructing an AudioNode for a closed context should not throw an exception. This 9 behavior is not as per specification and does not match the behavior of Chrome & 10 Firefox either. 11 12 Test: webaudio/construct-node-with-closed-context.html 13 14 * Modules/webaudio/AnalyserNode.cpp: 15 (WebCore::AnalyserNode::create): 16 * Modules/webaudio/AudioBufferSourceNode.cpp: 17 (WebCore::AudioBufferSourceNode::create): 18 * Modules/webaudio/BaseAudioContext.cpp: 19 (WebCore::BaseAudioContext::lazyInitialize): 20 (WebCore::BaseAudioContext::sampleRate const): 21 * Modules/webaudio/BaseAudioContext.h: 22 * Modules/webaudio/BiquadFilterNode.cpp: 23 (WebCore::BiquadFilterNode::create): 24 * Modules/webaudio/ChannelMergerNode.cpp: 25 (WebCore::ChannelMergerNode::create): 26 * Modules/webaudio/ChannelSplitterNode.cpp: 27 (WebCore::ChannelSplitterNode::create): 28 * Modules/webaudio/ConstantSourceNode.cpp: 29 (WebCore::ConstantSourceNode::create): 30 * Modules/webaudio/ConvolverNode.cpp: 31 (WebCore::ConvolverNode::create): 32 * Modules/webaudio/DelayNode.cpp: 33 (WebCore::DelayNode::create): 34 * Modules/webaudio/DynamicsCompressorNode.cpp: 35 (WebCore::DynamicsCompressorNode::create): 36 * Modules/webaudio/GainNode.cpp: 37 (WebCore::GainNode::create): 38 * Modules/webaudio/IIRFilterNode.cpp: 39 (WebCore::IIRFilterNode::create): 40 * Modules/webaudio/MediaElementAudioSourceNode.cpp: 41 (WebCore::MediaElementAudioSourceNode::create): 42 * Modules/webaudio/MediaStreamAudioDestinationNode.cpp: 43 (WebCore::MediaStreamAudioDestinationNode::create): 44 * Modules/webaudio/MediaStreamAudioSourceNode.cpp: 45 (WebCore::MediaStreamAudioSourceNode::create): 46 * Modules/webaudio/OscillatorNode.cpp: 47 (WebCore::OscillatorNode::create): 48 * Modules/webaudio/PannerNode.cpp: 49 (WebCore::PannerNode::create): 50 * Modules/webaudio/PeriodicWave.cpp: 51 (WebCore::PeriodicWave::create): 52 * Modules/webaudio/StereoPannerNode.cpp: 53 (WebCore::StereoPannerNode::create): 54 * Modules/webaudio/WaveShaperNode.cpp: 55 (WebCore::WaveShaperNode::create): 56 1 57 2020-09-26 Chris Dumez <cdumez@apple.com> 2 58 -
trunk/Source/WebCore/Modules/webaudio/AnalyserNode.cpp
r267609 r267639 39 39 ExceptionOr<Ref<AnalyserNode>> AnalyserNode::create(BaseAudioContext& context, const AnalyserOptions& options) 40 40 { 41 if (context.isStopped())42 return Exception { InvalidStateError };43 44 41 auto analyser = adoptRef(*new AnalyserNode(context)); 45 42 -
trunk/Source/WebCore/Modules/webaudio/AudioBufferSourceNode.cpp
r267609 r267639 68 68 ExceptionOr<Ref<AudioBufferSourceNode>> AudioBufferSourceNode::create(BaseAudioContext& context, AudioBufferSourceOptions&& options) 69 69 { 70 if (context.isStopped())71 return Exception { InvalidStateError };72 73 70 auto node = adoptRef(*new AudioBufferSourceNode(context)); 74 71 -
trunk/Source/WebCore/Modules/webaudio/BaseAudioContext.cpp
r267609 r267639 36 36 #include "AudioBufferOptions.h" 37 37 #include "AudioBufferSourceNode.h" 38 #include "AudioDestination.h" 38 39 #include "AudioListener.h" 39 40 #include "AudioNodeInput.h" … … 208 209 void BaseAudioContext::lazyInitialize() 209 210 { 210 ASSERT(!m_isStopScheduled); 211 if (isStopped()) 212 return; 211 213 212 214 if (m_isInitialized) … … 373 375 auto* document = downcast<Document>(m_scriptExecutionContext); 374 376 return document ? document->identifier() : DocumentIdentifier { }; 377 } 378 379 float BaseAudioContext::sampleRate() const 380 { 381 return m_destinationNode ? m_destinationNode->sampleRate() : AudioDestination::hardwareSampleRate(); 375 382 } 376 383 … … 467 474 468 475 ASSERT(isMainThread()); 469 470 if (m_isStopScheduled)471 return Exception { InvalidStateError };472 473 lazyInitialize();474 476 475 477 // W3C Editor's Draft 06 June 2017 -
trunk/Source/WebCore/Modules/webaudio/BaseAudioContext.h
r267591 r267639 122 122 size_t currentSampleFrame() const { return m_destinationNode ? m_destinationNode->currentSampleFrame() : 0; } 123 123 double currentTime() const { return m_destinationNode ? m_destinationNode->currentTime() : 0.; } 124 float sampleRate() const { return m_destinationNode ? m_destinationNode->sampleRate() : 0.f; }124 float sampleRate() const; 125 125 unsigned long activeSourceCount() const { return static_cast<unsigned long>(m_activeSourceCount); } 126 126 -
trunk/Source/WebCore/Modules/webaudio/BiquadFilterNode.cpp
r267609 r267639 36 36 ExceptionOr<Ref<BiquadFilterNode>> BiquadFilterNode::create(BaseAudioContext& context, const BiquadFilterOptions& options) 37 37 { 38 if (context.isStopped())39 return Exception { InvalidStateError };40 41 38 auto node = adoptRef(*new BiquadFilterNode(context)); 42 39 -
trunk/Source/WebCore/Modules/webaudio/ChannelMergerNode.cpp
r267609 r267639 44 44 ExceptionOr<Ref<ChannelMergerNode>> ChannelMergerNode::create(BaseAudioContext& context, const ChannelMergerOptions& options) 45 45 { 46 if (context.isStopped())47 return Exception { InvalidStateError };48 49 46 if (options.numberOfInputs > AudioContext::maxNumberOfChannels() || !options.numberOfInputs) 50 47 return Exception { IndexSizeError, "Number of inputs is not in the allowed range."_s }; -
trunk/Source/WebCore/Modules/webaudio/ChannelSplitterNode.cpp
r267609 r267639 40 40 ExceptionOr<Ref<ChannelSplitterNode>> ChannelSplitterNode::create(BaseAudioContext& context, const ChannelSplitterOptions& options) 41 41 { 42 if (context.isStopped())43 return Exception { InvalidStateError };44 45 42 if (options.numberOfOutputs > AudioContext::maxNumberOfChannels() || !options.numberOfOutputs) 46 43 return Exception { IndexSizeError, "Number of outputs is not in the allowed range"_s }; -
trunk/Source/WebCore/Modules/webaudio/ConstantSourceNode.cpp
r267609 r267639 42 42 ExceptionOr<Ref<ConstantSourceNode>> ConstantSourceNode::create(BaseAudioContext& context, const ConstantSourceOptions& options) 43 43 { 44 if (context.isStopped())45 return Exception { InvalidStateError };46 47 44 auto node = adoptRef(*new ConstantSourceNode(context, options.offset)); 48 45 -
trunk/Source/WebCore/Modules/webaudio/ConvolverNode.cpp
r267609 r267639 58 58 ExceptionOr<Ref<ConvolverNode>> ConvolverNode::create(BaseAudioContext& context, ConvolverOptions&& options) 59 59 { 60 if (context.isStopped())61 return Exception { InvalidStateError };62 63 60 auto node = adoptRef(*new ConvolverNode(context)); 64 61 -
trunk/Source/WebCore/Modules/webaudio/DelayNode.cpp
r267609 r267639 50 50 ExceptionOr<Ref<DelayNode>> DelayNode::create(BaseAudioContext& context, const DelayOptions& options) 51 51 { 52 if (context.isStopped())53 return Exception { InvalidStateError };54 55 52 if (options.maxDelayTime <= 0 || options.maxDelayTime >= maximumAllowedDelayTime) 56 53 return Exception { NotSupportedError }; -
trunk/Source/WebCore/Modules/webaudio/DynamicsCompressorNode.cpp
r267609 r267639 48 48 ExceptionOr<Ref<DynamicsCompressorNode>> DynamicsCompressorNode::create(BaseAudioContext& context, const DynamicsCompressorOptions& options) 49 49 { 50 if (context.isStopped())51 return Exception { InvalidStateError };52 53 50 auto node = adoptRef(*new DynamicsCompressorNode(context, options)); 54 51 -
trunk/Source/WebCore/Modules/webaudio/GainNode.cpp
r267609 r267639 41 41 ExceptionOr<Ref<GainNode>> GainNode::create(BaseAudioContext& context, const GainOptions& options) 42 42 { 43 if (context.isStopped())44 return Exception { InvalidStateError };45 46 43 auto gainNode = adoptRef(*new GainNode(context)); 47 44 -
trunk/Source/WebCore/Modules/webaudio/IIRFilterNode.cpp
r267609 r267639 85 85 ExceptionOr<Ref<IIRFilterNode>> IIRFilterNode::create(ScriptExecutionContext& scriptExecutionContext, BaseAudioContext& context, IIRFilterOptions&& options) 86 86 { 87 if (context.isStopped())88 return Exception { InvalidStateError };89 90 87 if (!options.feedforward.size() || options.feedforward.size() > IIRFilter::maxOrder) 91 88 return Exception { NotSupportedError, "feedforward array must have a length between 1 and 20"_s }; -
trunk/Source/WebCore/Modules/webaudio/MediaElementAudioSourceNode.cpp
r267609 r267639 49 49 { 50 50 RELEASE_ASSERT(options.mediaElement); 51 52 if (context.isStopped())53 return Exception { InvalidStateError };54 51 55 52 if (options.mediaElement->audioSourceNode()) -
trunk/Source/WebCore/Modules/webaudio/MediaStreamAudioDestinationNode.cpp
r267609 r267639 42 42 ExceptionOr<Ref<MediaStreamAudioDestinationNode>> MediaStreamAudioDestinationNode::create(BaseAudioContext& context, const AudioNodeOptions& options) 43 43 { 44 if (context.isStopped()) 45 return Exception { InvalidStateError }; 44 // This behavior is not part of the specification. This is done for consistency with Blink. 45 if (context.isStopped() || !context.scriptExecutionContext()) 46 return Exception { NotAllowedError, "Cannot create a MediaStreamAudioDestinationNode in a detached frame"_s }; 46 47 47 48 auto node = adoptRef(*new MediaStreamAudioDestinationNode(context)); -
trunk/Source/WebCore/Modules/webaudio/MediaStreamAudioSourceNode.cpp
r267609 r267639 43 43 { 44 44 RELEASE_ASSERT(options.mediaStream); 45 46 if (context.isStopped())47 return Exception { InvalidStateError };48 45 49 46 auto audioTracks = options.mediaStream->getAudioTracks(); -
trunk/Source/WebCore/Modules/webaudio/OscillatorNode.cpp
r267609 r267639 63 63 ExceptionOr<Ref<OscillatorNode>> OscillatorNode::create(BaseAudioContext& context, const OscillatorOptions& options) 64 64 { 65 if (context.isStopped())66 return Exception { InvalidStateError };67 68 65 if (options.type == OscillatorType::Custom && !options.periodicWave) 69 66 return Exception { InvalidStateError, "Must provide periodicWave when using custom type."_s }; -
trunk/Source/WebCore/Modules/webaudio/PannerNode.cpp
r267609 r267639 58 58 ExceptionOr<Ref<PannerNode>> PannerNode::create(BaseAudioContext& context, const PannerOptions& options) 59 59 { 60 if (context.isStopped())61 return Exception { InvalidStateError };62 63 60 auto panner = adoptRef(*new PannerNode(context, options)); 64 61 -
trunk/Source/WebCore/Modules/webaudio/PeriodicWave.cpp
r267609 r267639 62 62 ExceptionOr<Ref<PeriodicWave>> PeriodicWave::create(BaseAudioContext& context, PeriodicWaveOptions&& options) 63 63 { 64 if (context.isStopped())65 return Exception { InvalidStateError };66 67 64 Vector<float> real; 68 65 Vector<float> imag; -
trunk/Source/WebCore/Modules/webaudio/StereoPannerNode.cpp
r267609 r267639 42 42 ExceptionOr<Ref<StereoPannerNode>> StereoPannerNode::create(BaseAudioContext& context, const StereoPannerOptions& options) 43 43 { 44 if (context.isStopped())45 return Exception { InvalidStateError };46 47 44 auto stereo = adoptRef(*new StereoPannerNode(context, options.pan)); 48 45 -
trunk/Source/WebCore/Modules/webaudio/WaveShaperNode.cpp
r267609 r267639 40 40 ExceptionOr<Ref<WaveShaperNode>> WaveShaperNode::create(BaseAudioContext& context, const WaveShaperOptions& options) 41 41 { 42 if (context.isStopped())43 return Exception { InvalidStateError };44 45 42 RefPtr<Float32Array> curve; 46 43 if (options.curve) {
Note:
See TracChangeset
for help on using the changeset viewer.