Changeset 244774 in webkit
- Timestamp:
- Apr 30, 2019, 8:17:07 AM (7 years ago)
- Location:
- trunk
- Files:
-
- 5 added
- 6 edited
-
LayoutTests/ChangeLog (modified) (1 diff)
-
LayoutTests/http/wpt/webaudio (added)
-
LayoutTests/http/wpt/webaudio/audiocontext-stopped-expected.txt (added)
-
LayoutTests/http/wpt/webaudio/audiocontext-stopped.html (added)
-
LayoutTests/http/wpt/webaudio/resources (added)
-
LayoutTests/http/wpt/webaudio/resources/audiocontext-stopped-iframe.html (added)
-
LayoutTests/platform/win/TestExpectations (modified) (1 diff)
-
Source/WebCore/ChangeLog (modified) (1 diff)
-
Source/WebCore/Modules/webaudio/AudioContext.cpp (modified) (16 diffs)
-
Source/WebCore/Modules/webaudio/AudioContext.h (modified) (2 diffs)
-
Source/WebCore/Modules/webaudio/AudioContext.idl (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r244766 r244774 1 2019-04-30 Youenn Fablet <youenn@apple.com> 2 3 Reject/throw when calling AudioContext methods on a stopped AudioContext 4 https://bugs.webkit.org/show_bug.cgi?id=197391 5 6 Reviewed by Eric Carlson. 7 8 * http/wpt/webaudio/audiocontext-stopped-expected.txt: Added. 9 * http/wpt/webaudio/audiocontext-stopped.html: Added. 10 * http/wpt/webaudio/resources/audiocontext-stopped-iframe.html: Added. 11 * platform/win/TestExpectations: Skip test for win. 12 1 13 2019-04-30 Carlos Garcia Campos <cgarcia@igalia.com> 2 14 -
trunk/LayoutTests/platform/win/TestExpectations
r244685 r244774 495 495 # TODO For now, Web Audio tests are disabled 496 496 webkit.org/b/86914 webaudio/ [ Skip ] 497 webkit.org/b/86914 http/wpt/webaudio/ [ Skip ] 497 498 webkit.org/b/86914 fast/history/page-cache-closed-audiocontext.html [ Skip ] 498 499 webkit.org/b/86914 fast/history/page-cache-running-audiocontext.html [ Skip ] -
trunk/Source/WebCore/ChangeLog
r244773 r244774 1 2019-04-30 Youenn Fablet <youenn@apple.com> 2 3 Reject/throw when calling AudioContext methods on a stopped AudioContext 4 https://bugs.webkit.org/show_bug.cgi?id=197391 5 6 Reviewed by Eric Carlson. 7 8 Return InvalidStateError in that case. 9 ASSERT that we do not call lazyInitialize after being stopped 10 since this would mean we are doing unneeded processing. 11 12 Test: http/wpt/webaudio/audiocontext-stopped.html 13 14 * Modules/webaudio/AudioContext.cpp: 15 (WebCore::AudioContext::lazyInitialize): 16 (WebCore::AudioContext::createBufferSource): 17 (WebCore::AudioContext::createMediaElementSource): 18 (WebCore::AudioContext::createMediaStreamSource): 19 (WebCore::AudioContext::createMediaStreamDestination): 20 (WebCore::AudioContext::createScriptProcessor): 21 (WebCore::AudioContext::createBiquadFilter): 22 (WebCore::AudioContext::createWaveShaper): 23 (WebCore::AudioContext::createPanner): 24 (WebCore::AudioContext::createConvolver): 25 (WebCore::AudioContext::createDynamicsCompressor): 26 (WebCore::AudioContext::createAnalyser): 27 (WebCore::AudioContext::createGain): 28 (WebCore::AudioContext::createDelay): 29 (WebCore::AudioContext::createChannelSplitter): 30 (WebCore::AudioContext::createChannelMerger): 31 (WebCore::AudioContext::createOscillator): 32 (WebCore::AudioContext::createPeriodicWave): 33 (WebCore::AudioContext::startRendering): 34 (WebCore::AudioContext::suspend): 35 (WebCore::AudioContext::resume): 36 (WebCore::AudioContext::close): 37 * Modules/webaudio/AudioContext.h: 38 * Modules/webaudio/AudioContext.idl: 39 1 40 2019-04-30 Youenn Fablet <youenn@apple.com> 2 41 -
trunk/Source/WebCore/Modules/webaudio/AudioContext.cpp
r244771 r244774 217 217 void AudioContext::lazyInitialize() 218 218 { 219 ASSERT(!m_isStopScheduled); 220 219 221 if (m_isInitialized) 220 222 return; … … 431 433 } 432 434 433 Ref<AudioBufferSourceNode> AudioContext::createBufferSource() 434 { 435 ALWAYS_LOG(LOGIDENTIFIER); 436 437 ASSERT(isMainThread()); 435 ExceptionOr<Ref<AudioBufferSourceNode>> AudioContext::createBufferSource() 436 { 437 ALWAYS_LOG(LOGIDENTIFIER); 438 439 ASSERT(isMainThread()); 440 441 if (m_isStopScheduled) 442 return Exception { InvalidStateError }; 443 438 444 lazyInitialize(); 439 445 Ref<AudioBufferSourceNode> node = AudioBufferSourceNode::create(*this, m_destinationNode->sampleRate()); … … 451 457 { 452 458 ALWAYS_LOG(LOGIDENTIFIER); 453 454 ASSERT(isMainThread()); 455 lazyInitialize(); 456 457 if (mediaElement.audioSourceNode()) 458 return Exception { InvalidStateError }; 459 459 460 ASSERT(isMainThread()); 461 462 if (m_isStopScheduled || mediaElement.audioSourceNode()) 463 return Exception { InvalidStateError }; 464 465 lazyInitialize(); 466 460 467 auto node = MediaElementAudioSourceNode::create(*this, mediaElement); 461 468 … … 475 482 476 483 ASSERT(isMainThread()); 484 485 if (m_isStopScheduled) 486 return Exception { InvalidStateError }; 477 487 478 488 auto audioTracks = mediaStream.getAudioTracks(); … … 499 509 } 500 510 501 Ref<MediaStreamAudioDestinationNode> AudioContext::createMediaStreamDestination() 502 { 511 ExceptionOr<Ref<MediaStreamAudioDestinationNode>> AudioContext::createMediaStreamDestination() 512 { 513 if (m_isStopScheduled) 514 return Exception { InvalidStateError }; 515 503 516 // FIXME: Add support for an optional argument which specifies the number of channels. 504 517 // FIXME: The default should probably be stereo instead of mono. … … 513 526 514 527 ASSERT(isMainThread()); 528 529 if (m_isStopScheduled) 530 return Exception { InvalidStateError }; 531 515 532 lazyInitialize(); 516 533 … … 568 585 } 569 586 570 Ref<BiquadFilterNode> AudioContext::createBiquadFilter() 571 { 572 ALWAYS_LOG(LOGIDENTIFIER); 573 574 ASSERT(isMainThread()); 575 lazyInitialize(); 587 ExceptionOr<Ref<BiquadFilterNode>> AudioContext::createBiquadFilter() 588 { 589 ALWAYS_LOG(LOGIDENTIFIER); 590 591 ASSERT(isMainThread()); 592 if (m_isStopScheduled) 593 return Exception { InvalidStateError }; 594 595 lazyInitialize(); 596 576 597 return BiquadFilterNode::create(*this, m_destinationNode->sampleRate()); 577 598 } 578 599 579 Ref<WaveShaperNode> AudioContext::createWaveShaper() 580 { 581 ALWAYS_LOG(LOGIDENTIFIER); 582 583 ASSERT(isMainThread()); 600 ExceptionOr<Ref<WaveShaperNode>> AudioContext::createWaveShaper() 601 { 602 ALWAYS_LOG(LOGIDENTIFIER); 603 604 ASSERT(isMainThread()); 605 if (m_isStopScheduled) 606 return Exception { InvalidStateError }; 607 584 608 lazyInitialize(); 585 609 return WaveShaperNode::create(*this); 586 610 } 587 611 588 Ref<PannerNode> AudioContext::createPanner() 589 { 590 ALWAYS_LOG(LOGIDENTIFIER); 591 592 ASSERT(isMainThread()); 612 ExceptionOr<Ref<PannerNode>> AudioContext::createPanner() 613 { 614 ALWAYS_LOG(LOGIDENTIFIER); 615 616 ASSERT(isMainThread()); 617 if (m_isStopScheduled) 618 return Exception { InvalidStateError }; 619 593 620 lazyInitialize(); 594 621 return PannerNode::create(*this, m_destinationNode->sampleRate()); 595 622 } 596 623 597 Ref<ConvolverNode> AudioContext::createConvolver() 598 { 599 ALWAYS_LOG(LOGIDENTIFIER); 600 601 ASSERT(isMainThread()); 624 ExceptionOr<Ref<ConvolverNode>> AudioContext::createConvolver() 625 { 626 ALWAYS_LOG(LOGIDENTIFIER); 627 628 ASSERT(isMainThread()); 629 if (m_isStopScheduled) 630 return Exception { InvalidStateError }; 631 602 632 lazyInitialize(); 603 633 return ConvolverNode::create(*this, m_destinationNode->sampleRate()); 604 634 } 605 635 606 Ref<DynamicsCompressorNode> AudioContext::createDynamicsCompressor() 607 { 608 ALWAYS_LOG(LOGIDENTIFIER); 609 610 ASSERT(isMainThread()); 636 ExceptionOr<Ref<DynamicsCompressorNode>> AudioContext::createDynamicsCompressor() 637 { 638 ALWAYS_LOG(LOGIDENTIFIER); 639 640 ASSERT(isMainThread()); 641 if (m_isStopScheduled) 642 return Exception { InvalidStateError }; 643 611 644 lazyInitialize(); 612 645 return DynamicsCompressorNode::create(*this, m_destinationNode->sampleRate()); 613 646 } 614 647 615 Ref<AnalyserNode> AudioContext::createAnalyser() 616 { 617 ALWAYS_LOG(LOGIDENTIFIER); 618 619 ASSERT(isMainThread()); 648 ExceptionOr<Ref<AnalyserNode>> AudioContext::createAnalyser() 649 { 650 ALWAYS_LOG(LOGIDENTIFIER); 651 652 ASSERT(isMainThread()); 653 if (m_isStopScheduled) 654 return Exception { InvalidStateError }; 655 620 656 lazyInitialize(); 621 657 return AnalyserNode::create(*this, m_destinationNode->sampleRate()); 622 658 } 623 659 624 Ref<GainNode> AudioContext::createGain() 625 { 626 ALWAYS_LOG(LOGIDENTIFIER); 627 628 ASSERT(isMainThread()); 660 ExceptionOr<Ref<GainNode>> AudioContext::createGain() 661 { 662 ALWAYS_LOG(LOGIDENTIFIER); 663 664 ASSERT(isMainThread()); 665 if (m_isStopScheduled) 666 return Exception { InvalidStateError }; 667 629 668 lazyInitialize(); 630 669 return GainNode::create(*this, m_destinationNode->sampleRate()); … … 636 675 637 676 ASSERT(isMainThread()); 677 if (m_isStopScheduled) 678 return Exception { InvalidStateError }; 679 638 680 lazyInitialize(); 639 681 return DelayNode::create(*this, m_destinationNode->sampleRate(), maxDelayTime); … … 645 687 646 688 ASSERT(isMainThread()); 689 if (m_isStopScheduled) 690 return Exception { InvalidStateError }; 691 647 692 lazyInitialize(); 648 693 auto node = ChannelSplitterNode::create(*this, m_destinationNode->sampleRate(), numberOfOutputs); … … 657 702 658 703 ASSERT(isMainThread()); 704 if (m_isStopScheduled) 705 return Exception { InvalidStateError }; 706 659 707 lazyInitialize(); 660 708 auto node = ChannelMergerNode::create(*this, m_destinationNode->sampleRate(), numberOfInputs); … … 664 712 } 665 713 666 Ref<OscillatorNode> AudioContext::createOscillator() 667 { 668 ALWAYS_LOG(LOGIDENTIFIER); 669 670 ASSERT(isMainThread()); 714 ExceptionOr<Ref<OscillatorNode>> AudioContext::createOscillator() 715 { 716 ALWAYS_LOG(LOGIDENTIFIER); 717 718 ASSERT(isMainThread()); 719 if (m_isStopScheduled) 720 return Exception { InvalidStateError }; 721 671 722 lazyInitialize(); 672 723 … … 685 736 686 737 ASSERT(isMainThread()); 738 if (m_isStopScheduled) 739 return Exception { InvalidStateError }; 740 687 741 if (real.length() != imaginary.length() || (real.length() > MaxPeriodicWaveLength) || !real.length()) 688 742 return Exception { IndexSizeError }; … … 1079 1133 { 1080 1134 ALWAYS_LOG(LOGIDENTIFIER); 1081 if ( !willBeginPlayback())1135 if (m_isStopScheduled || !willBeginPlayback()) 1082 1136 return; 1083 1137 … … 1151 1205 void AudioContext::suspend(DOMPromiseDeferred<void>&& promise) 1152 1206 { 1153 if (isOfflineContext() ) {1207 if (isOfflineContext() || m_isStopScheduled) { 1154 1208 promise.reject(InvalidStateError); 1155 1209 return; … … 1180 1234 void AudioContext::resume(DOMPromiseDeferred<void>&& promise) 1181 1235 { 1182 if (isOfflineContext() ) {1236 if (isOfflineContext() || m_isStopScheduled) { 1183 1237 promise.reject(InvalidStateError); 1184 1238 return; … … 1209 1263 void AudioContext::close(DOMPromiseDeferred<void>&& promise) 1210 1264 { 1211 if (isOfflineContext() ) {1265 if (isOfflineContext() || m_isStopScheduled) { 1212 1266 promise.reject(InvalidStateError); 1213 1267 return; -
trunk/Source/WebCore/Modules/webaudio/AudioContext.h
r243887 r244774 135 135 136 136 // The AudioNode create methods are called on the main thread (from JavaScript). 137 Ref<AudioBufferSourceNode> createBufferSource();137 ExceptionOr<Ref<AudioBufferSourceNode>> createBufferSource(); 138 138 #if ENABLE(VIDEO) 139 139 ExceptionOr<Ref<MediaElementAudioSourceNode>> createMediaElementSource(HTMLMediaElement&); … … 141 141 #if ENABLE(MEDIA_STREAM) 142 142 ExceptionOr<Ref<MediaStreamAudioSourceNode>> createMediaStreamSource(MediaStream&); 143 Ref<MediaStreamAudioDestinationNode> createMediaStreamDestination();143 ExceptionOr<Ref<MediaStreamAudioDestinationNode>> createMediaStreamDestination(); 144 144 #endif 145 Ref<GainNode> createGain();146 Ref<BiquadFilterNode> createBiquadFilter();147 Ref<WaveShaperNode> createWaveShaper();145 ExceptionOr<Ref<GainNode>> createGain(); 146 ExceptionOr<Ref<BiquadFilterNode>> createBiquadFilter(); 147 ExceptionOr<Ref<WaveShaperNode>> createWaveShaper(); 148 148 ExceptionOr<Ref<DelayNode>> createDelay(double maxDelayTime); 149 Ref<PannerNode> createPanner();150 Ref<ConvolverNode> createConvolver();151 Ref<DynamicsCompressorNode> createDynamicsCompressor();152 Ref<AnalyserNode> createAnalyser();149 ExceptionOr<Ref<PannerNode>> createPanner(); 150 ExceptionOr<Ref<ConvolverNode>> createConvolver(); 151 ExceptionOr<Ref<DynamicsCompressorNode>> createDynamicsCompressor(); 152 ExceptionOr<Ref<AnalyserNode>> createAnalyser(); 153 153 ExceptionOr<Ref<ScriptProcessorNode>> createScriptProcessor(size_t bufferSize, size_t numberOfInputChannels, size_t numberOfOutputChannels); 154 154 ExceptionOr<Ref<ChannelSplitterNode>> createChannelSplitter(size_t numberOfOutputs); 155 155 ExceptionOr<Ref<ChannelMergerNode>> createChannelMerger(size_t numberOfInputs); 156 Ref<OscillatorNode> createOscillator();156 ExceptionOr<Ref<OscillatorNode>> createOscillator(); 157 157 ExceptionOr<Ref<PeriodicWave>> createPeriodicWave(Float32Array& real, Float32Array& imaginary); 158 158 -
trunk/Source/WebCore/Modules/webaudio/AudioContext.idl
r217919 r244774 70 70 71 71 // Sources 72 AudioBufferSourceNode createBufferSource();72 [MayThrowException] AudioBufferSourceNode createBufferSource(); 73 73 74 74 [Conditional=VIDEO, MayThrowException] MediaElementAudioSourceNode createMediaElementSource(HTMLMediaElement mediaElement); 75 75 76 76 [Conditional=MEDIA_STREAM, MayThrowException] MediaStreamAudioSourceNode createMediaStreamSource(MediaStream mediaStream); 77 [Conditional=MEDIA_STREAM ] MediaStreamAudioDestinationNode createMediaStreamDestination();77 [Conditional=MEDIA_STREAM, MayThrowException] MediaStreamAudioDestinationNode createMediaStreamDestination(); 78 78 79 79 // Processing nodes 80 GainNode createGain();80 [MayThrowException] GainNode createGain(); 81 81 [MayThrowException] DelayNode createDelay(optional unrestricted double maxDelayTime = 1); 82 BiquadFilterNode createBiquadFilter();83 WaveShaperNode createWaveShaper();84 PannerNode createPanner();85 ConvolverNode createConvolver();86 DynamicsCompressorNode createDynamicsCompressor();87 AnalyserNode createAnalyser();82 [MayThrowException] BiquadFilterNode createBiquadFilter(); 83 [MayThrowException] WaveShaperNode createWaveShaper(); 84 [MayThrowException] PannerNode createPanner(); 85 [MayThrowException] ConvolverNode createConvolver(); 86 [MayThrowException] DynamicsCompressorNode createDynamicsCompressor(); 87 [MayThrowException] AnalyserNode createAnalyser(); 88 88 [MayThrowException] ScriptProcessorNode createScriptProcessor(optional unsigned long bufferSize = 0, optional unsigned long numberOfInputChannels = 2, optional unsigned long numberOfOutputChannels = 2); 89 OscillatorNode createOscillator();89 [MayThrowException] OscillatorNode createOscillator(); 90 90 [MayThrowException] PeriodicWave createPeriodicWave(Float32Array real, Float32Array imag); 91 91
Note:
See TracChangeset
for help on using the changeset viewer.