Diff
Modified: trunk/LayoutTests/ChangeLog (267638 => 267639)
--- trunk/LayoutTests/ChangeLog 2020-09-26 22:07:25 UTC (rev 267638)
+++ trunk/LayoutTests/ChangeLog 2020-09-26 22:13:56 UTC (rev 267639)
@@ -1,3 +1,21 @@
+2020-09-26 Chris Dumez <cdu...@apple.com>
+
+ Constructing an AudioNode for a closed context should not throw an exception
+ https://bugs.webkit.org/show_bug.cgi?id=216994
+
+ Reviewed by Darin Adler.
+
+ * http/wpt/webaudio/audiocontext-stopped-expected.txt: Removed.
+ * http/wpt/webaudio/audiocontext-stopped.html: Removed.
+ Drop outdated test. It is replaced with the new test I am introducing.
+
+ * webaudio/MediaStreamAudioDestination/create-in-destroyed-context-expected.txt:
+ Rebaseline Blink-imported test that is now passing.
+
+ * webaudio/construct-node-with-closed-context-expected.txt: Added.
+ * webaudio/construct-node-with-closed-context.html: Added.
+ Add layout test coverage.
+
2020-09-26 Zalan Bujtas <za...@apple.com>
[LFC][IFC] Add support for <wbr>
Deleted: trunk/LayoutTests/http/wpt/webaudio/audiocontext-stopped-expected.txt (267638 => 267639)
--- trunk/LayoutTests/http/wpt/webaudio/audiocontext-stopped-expected.txt 2020-09-26 22:07:25 UTC (rev 267638)
+++ trunk/LayoutTests/http/wpt/webaudio/audiocontext-stopped-expected.txt 2020-09-26 22:13:56 UTC (rev 267639)
@@ -1,21 +0,0 @@
-
-
-PASS Load test iframe
-PASS createBufferSource
-PASS createMediaElementSource
-PASS createMediaStreamDestination
-PASS createGain
-PASS createDelay
-PASS createBiquadFilter
-PASS createWaveShapper
-PASS createPanner
-PASS createConvolver
-PASS createDynamicsCompressor
-PASS createAnalyser
-PASS createScriptProcessor
-PASS createOscillator
-PASS createPeriodicWave
-PASS suspend
-PASS resume
-PASS close
-
Deleted: trunk/LayoutTests/http/wpt/webaudio/audiocontext-stopped.html (267638 => 267639)
--- trunk/LayoutTests/http/wpt/webaudio/audiocontext-stopped.html 2020-09-26 22:07:25 UTC (rev 267638)
+++ trunk/LayoutTests/http/wpt/webaudio/audiocontext-stopped.html 2020-09-26 22:13:56 UTC (rev 267639)
@@ -1,101 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
-<script src=""
-<script src=""
-</head>
-<body>
-<video id="video"></video>
-<script>
-function with_iframe(url) {
- return new Promise(function(resolve) {
- var frame = document.createElement('iframe');
- frame.className = 'test-iframe';
- frame.src = ""
- frame._onload_ = function() { resolve(frame); };
- document.body.appendChild(frame);
- });
-}
-
-var context;
-promise_test(async () => {
- const iframe = await with_iframe("resources/audiocontext-stopped-iframe.html");
- domExceptionConstructor = iframe.contentWindow.DOMException;
- context = iframe.contentWindow.audioContext;
- iframe.remove();
-
- runTests();
-}, "Load test iframe");
-
-function runTests()
-{
- test(() => {
- assert_throws_dom('InvalidStateError', domExceptionConstructor, () => context.createBufferSource());
- }, "createBufferSource");
- test(() => {
- assert_throws_dom('InvalidStateError', domExceptionConstructor, () => context.createMediaElementSource(video));
- }, "createMediaElementSource");
-
- test(() => {
- assert_throws_dom('InvalidStateError', domExceptionConstructor, () => context.createMediaStreamDestination());
- }, "createMediaStreamDestination");
-
- test(() => {
- assert_throws_dom('InvalidStateError', domExceptionConstructor, () => context.createGain());
- }, "createGain");
-
- test(() => {
- assert_throws_dom('InvalidStateError', domExceptionConstructor, () => context.createDelay());
- }, "createDelay");
-
- test(() => {
- assert_throws_dom('InvalidStateError', domExceptionConstructor, () => context.createBiquadFilter());
- }, "createBiquadFilter");
-
- test(() => {
- assert_throws_dom('InvalidStateError', domExceptionConstructor, () => context.createWaveShaper());
- }, "createWaveShapper");
-
- test(() => {
- assert_throws_dom('InvalidStateError', domExceptionConstructor, () => context.createPanner());
- }, "createPanner");
-
- test(() => {
- assert_throws_dom('InvalidStateError', domExceptionConstructor, () => context.createConvolver());
- }, "createConvolver");
-
- test(() => {
- assert_throws_dom('InvalidStateError', domExceptionConstructor, () => context.createDynamicsCompressor());
- }, "createDynamicsCompressor");
-
- test(() => {
- assert_throws_dom('InvalidStateError', domExceptionConstructor, () => context.createAnalyser());
- }, "createAnalyser");
-
- test(() => {
- assert_throws_dom('InvalidStateError', domExceptionConstructor, () => context.createScriptProcessor());
- }, "createScriptProcessor");
-
- test(() => {
- assert_throws_dom('InvalidStateError', domExceptionConstructor, () => context.createOscillator());
- }, "createOscillator");
-
- test(() => {
- assert_throws_dom('InvalidStateError', domExceptionConstructor, () => context.createPeriodicWave(new Float32Array(1), new Float32Array(1)));
- }, "createPeriodicWave");
-
- promise_test((test) => {
- return promise_rejects_dom(test, 'InvalidStateError', context.suspend());
- }, "suspend");
-
- promise_test((test) => {
- return promise_rejects_dom(test, 'InvalidStateError', context.resume());
- }, "resume");
-
- promise_test((test) => {
- return promise_rejects_dom(test, 'InvalidStateError', context.close());
- }, "close");
-}
-</script>
-</body>
-</html>
Modified: trunk/LayoutTests/webaudio/MediaStreamAudioDestination/create-in-destroyed-context-expected.txt (267638 => 267639)
--- trunk/LayoutTests/webaudio/MediaStreamAudioDestination/create-in-destroyed-context-expected.txt 2020-09-26 22:07:25 UTC (rev 267638)
+++ trunk/LayoutTests/webaudio/MediaStreamAudioDestination/create-in-destroyed-context-expected.txt 2020-09-26 22:13:56 UTC (rev 267639)
@@ -1,5 +1,3 @@
-FAIL MediaStreamAudioDestinationNode creation in closed iframe throws error assert_throws_dom: function "() => {
- let stream = iframe_ac.createMediaStreamDestination();
- }" threw object "InvalidStateError: The object is in an invalid state." that is not a DOMException NotAllowedError: property "code" is equal to 11, expected 0
+PASS MediaStreamAudioDestinationNode creation in closed iframe throws error
Added: trunk/LayoutTests/webaudio/construct-node-with-closed-context-expected.txt (0 => 267639)
--- trunk/LayoutTests/webaudio/construct-node-with-closed-context-expected.txt (rev 0)
+++ trunk/LayoutTests/webaudio/construct-node-with-closed-context-expected.txt 2020-09-26 22:13:56 UTC (rev 267639)
@@ -0,0 +1,49 @@
+Makes sure that we don't throw an exception when constructing an AudioNode with a closed context.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS new AnalyserNode(context) did not throw exception.
+PASS new AudioBufferSourceNode(context) did not throw exception.
+PASS new BiquadFilterNode(context) did not throw exception.
+PASS new ChannelMergerNode(context) did not throw exception.
+PASS new ChannelSplitterNode(context) did not throw exception.
+PASS new ConstantSourceNode(context) did not throw exception.
+PASS new ConvolverNode(context) did not throw exception.
+PASS new DelayNode(context) did not throw exception.
+PASS new DynamicsCompressorNode(context) did not throw exception.
+PASS new GainNode(context) did not throw exception.
+PASS new IIRFilterNode(context, { feedforward: [1], feedback: [1, -0.9] }) did not throw exception.
+PASS new MediaElementAudioSourceNode(context, { mediaElement: new Audio }) did not throw exception.
+PASS new MediaStreamAudioDestinationNode(context) threw exception NotAllowedError: Cannot create a MediaStreamAudioDestinationNode in a detached frame.
+PASS new OscillatorNode(context) did not throw exception.
+PASS new PannerNode(context) did not throw exception.
+PASS new PeriodicWave(context) did not throw exception.
+PASS new StereoPannerNode(context) did not throw exception.
+PASS new WaveShaperNode(context) did not throw exception.
+PASS context.createAnalyser() did not throw exception.
+PASS context.createBufferSource() did not throw exception.
+PASS context.createBiquadFilter() did not throw exception.
+PASS context.createChannelMerger() did not throw exception.
+PASS context.createChannelSplitter() did not throw exception.
+PASS context.createConstantSource() did not throw exception.
+PASS context.createConvolver() did not throw exception.
+PASS context.createDelay() did not throw exception.
+PASS context.createDynamicsCompressor() did not throw exception.
+PASS context.createGain() did not throw exception.
+PASS context.createIIRFilter([1], [1, -0.9]) did not throw exception.
+PASS context.createMediaElementSource(new Audio) did not throw exception.
+PASS context.createMediaStreamDestination() threw exception NotAllowedError: Cannot create a MediaStreamAudioDestinationNode in a detached frame.
+PASS context.createOscillator() did not throw exception.
+PASS context.createPanner() did not throw exception.
+PASS context.createPeriodicWave([1, 2], [1, 2]) did not throw exception.
+PASS context.createStereoPanner() did not throw exception.
+PASS context.createWaveShaper() did not throw exception.
+PASS context.createScriptProcessor() did not throw exception.
+PASS context.suspend() rejected promise with InvalidStateError: The object is in an invalid state..
+PASS context.resume() rejected promise with InvalidStateError: The object is in an invalid state..
+PASS context.close() rejected promise with InvalidStateError: The object is in an invalid state..
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/webaudio/construct-node-with-closed-context.html (0 => 267639)
--- trunk/LayoutTests/webaudio/construct-node-with-closed-context.html (rev 0)
+++ trunk/LayoutTests/webaudio/construct-node-with-closed-context.html 2020-09-26 22:13:56 UTC (rev 267639)
@@ -0,0 +1,61 @@
+<!DOCTYPE html>
+<html>
+<body>
+<script src=""
+<script>
+description("Makes sure that we don't throw an exception when constructing an AudioNode with a closed context.");
+
+async function runTest() {
+ iframe = document.createElement("iframe");
+ document.body.appendChild(iframe);
+ context = new iframe.contentWindow.AudioContext();
+ document.body.removeChild(iframe);
+
+ shouldNotThrow("new AnalyserNode(context)");
+ shouldNotThrow("new AudioBufferSourceNode(context)");
+ shouldNotThrow("new BiquadFilterNode(context)");
+ shouldNotThrow("new ChannelMergerNode(context)");
+ shouldNotThrow("new ChannelSplitterNode(context)");
+ shouldNotThrow("new ConstantSourceNode(context)");
+ shouldNotThrow("new ConvolverNode(context)");
+ shouldNotThrow("new DelayNode(context)");
+ shouldNotThrow("new DynamicsCompressorNode(context)");
+ shouldNotThrow("new GainNode(context)");
+ shouldNotThrow("new IIRFilterNode(context, { feedforward: [1], feedback: [1, -0.9] })");
+ shouldNotThrow("new MediaElementAudioSourceNode(context, { mediaElement: new Audio })");
+ shouldThrowErrorName("new MediaStreamAudioDestinationNode(context)", "NotAllowedError"); // Not per specification but this is Blink's behavior.
+ shouldNotThrow("new OscillatorNode(context)");
+ shouldNotThrow("new PannerNode(context)");
+ shouldNotThrow("new PeriodicWave(context)");
+ shouldNotThrow("new StereoPannerNode(context)");
+ shouldNotThrow("new WaveShaperNode(context)");
+
+ shouldNotThrow("context.createAnalyser()");
+ shouldNotThrow("context.createBufferSource()");
+ shouldNotThrow("context.createBiquadFilter()");
+ shouldNotThrow("context.createChannelMerger()");
+ shouldNotThrow("context.createChannelSplitter()");
+ shouldNotThrow("context.createConstantSource()");
+ shouldNotThrow("context.createConvolver()");
+ shouldNotThrow("context.createDelay()");
+ shouldNotThrow("context.createDynamicsCompressor()");
+ shouldNotThrow("context.createGain()");
+ shouldNotThrow("context.createIIRFilter([1], [1, -0.9])");
+ shouldNotThrow("context.createMediaElementSource(new Audio)");
+ shouldThrowErrorName("context.createMediaStreamDestination()", "NotAllowedError"); // Not per specification but this is Blink's behavior.
+ shouldNotThrow("context.createOscillator()");
+ shouldNotThrow("context.createPanner()");
+ shouldNotThrow("context.createPeriodicWave([1, 2], [1, 2])");
+ shouldNotThrow("context.createStereoPanner()");
+ shouldNotThrow("context.createWaveShaper()");
+ shouldNotThrow("context.createScriptProcessor()");
+
+ await shouldRejectWithErrorName("context.suspend()", "InvalidStateError");
+ await shouldRejectWithErrorName("context.resume()", "InvalidStateError");
+ await shouldRejectWithErrorName("context.close()", "InvalidStateError");
+}
+
+_onload_ = runTest;
+</script>
+</body>
+</html>
Modified: trunk/Source/WebCore/ChangeLog (267638 => 267639)
--- trunk/Source/WebCore/ChangeLog 2020-09-26 22:07:25 UTC (rev 267638)
+++ trunk/Source/WebCore/ChangeLog 2020-09-26 22:13:56 UTC (rev 267639)
@@ -1,5 +1,61 @@
2020-09-26 Chris Dumez <cdu...@apple.com>
+ Constructing an AudioNode for a closed context should not throw an exception
+ https://bugs.webkit.org/show_bug.cgi?id=216994
+
+ Reviewed by Darin Adler.
+
+ Constructing an AudioNode for a closed context should not throw an exception. This
+ behavior is not as per specification and does not match the behavior of Chrome &
+ Firefox either.
+
+ Test: webaudio/construct-node-with-closed-context.html
+
+ * Modules/webaudio/AnalyserNode.cpp:
+ (WebCore::AnalyserNode::create):
+ * Modules/webaudio/AudioBufferSourceNode.cpp:
+ (WebCore::AudioBufferSourceNode::create):
+ * Modules/webaudio/BaseAudioContext.cpp:
+ (WebCore::BaseAudioContext::lazyInitialize):
+ (WebCore::BaseAudioContext::sampleRate const):
+ * Modules/webaudio/BaseAudioContext.h:
+ * Modules/webaudio/BiquadFilterNode.cpp:
+ (WebCore::BiquadFilterNode::create):
+ * Modules/webaudio/ChannelMergerNode.cpp:
+ (WebCore::ChannelMergerNode::create):
+ * Modules/webaudio/ChannelSplitterNode.cpp:
+ (WebCore::ChannelSplitterNode::create):
+ * Modules/webaudio/ConstantSourceNode.cpp:
+ (WebCore::ConstantSourceNode::create):
+ * Modules/webaudio/ConvolverNode.cpp:
+ (WebCore::ConvolverNode::create):
+ * Modules/webaudio/DelayNode.cpp:
+ (WebCore::DelayNode::create):
+ * Modules/webaudio/DynamicsCompressorNode.cpp:
+ (WebCore::DynamicsCompressorNode::create):
+ * Modules/webaudio/GainNode.cpp:
+ (WebCore::GainNode::create):
+ * Modules/webaudio/IIRFilterNode.cpp:
+ (WebCore::IIRFilterNode::create):
+ * Modules/webaudio/MediaElementAudioSourceNode.cpp:
+ (WebCore::MediaElementAudioSourceNode::create):
+ * Modules/webaudio/MediaStreamAudioDestinationNode.cpp:
+ (WebCore::MediaStreamAudioDestinationNode::create):
+ * Modules/webaudio/MediaStreamAudioSourceNode.cpp:
+ (WebCore::MediaStreamAudioSourceNode::create):
+ * Modules/webaudio/OscillatorNode.cpp:
+ (WebCore::OscillatorNode::create):
+ * Modules/webaudio/PannerNode.cpp:
+ (WebCore::PannerNode::create):
+ * Modules/webaudio/PeriodicWave.cpp:
+ (WebCore::PeriodicWave::create):
+ * Modules/webaudio/StereoPannerNode.cpp:
+ (WebCore::StereoPannerNode::create):
+ * Modules/webaudio/WaveShaperNode.cpp:
+ (WebCore::WaveShaperNode::create):
+
+2020-09-26 Chris Dumez <cdu...@apple.com>
+
Drop AudioNode::lazyInitialize()
https://bugs.webkit.org/show_bug.cgi?id=217004
Modified: trunk/Source/WebCore/Modules/webaudio/AnalyserNode.cpp (267638 => 267639)
--- trunk/Source/WebCore/Modules/webaudio/AnalyserNode.cpp 2020-09-26 22:07:25 UTC (rev 267638)
+++ trunk/Source/WebCore/Modules/webaudio/AnalyserNode.cpp 2020-09-26 22:13:56 UTC (rev 267639)
@@ -38,9 +38,6 @@
ExceptionOr<Ref<AnalyserNode>> AnalyserNode::create(BaseAudioContext& context, const AnalyserOptions& options)
{
- if (context.isStopped())
- return Exception { InvalidStateError };
-
auto analyser = adoptRef(*new AnalyserNode(context));
auto result = analyser->handleAudioNodeOptions(options, { 2, ChannelCountMode::Max, ChannelInterpretation::Speakers });
Modified: trunk/Source/WebCore/Modules/webaudio/AudioBufferSourceNode.cpp (267638 => 267639)
--- trunk/Source/WebCore/Modules/webaudio/AudioBufferSourceNode.cpp 2020-09-26 22:07:25 UTC (rev 267638)
+++ trunk/Source/WebCore/Modules/webaudio/AudioBufferSourceNode.cpp 2020-09-26 22:13:56 UTC (rev 267639)
@@ -67,9 +67,6 @@
ExceptionOr<Ref<AudioBufferSourceNode>> AudioBufferSourceNode::create(BaseAudioContext& context, AudioBufferSourceOptions&& options)
{
- if (context.isStopped())
- return Exception { InvalidStateError };
-
auto node = adoptRef(*new AudioBufferSourceNode(context));
node->setBuffer(WTFMove(options.buffer));
Modified: trunk/Source/WebCore/Modules/webaudio/BaseAudioContext.cpp (267638 => 267639)
--- trunk/Source/WebCore/Modules/webaudio/BaseAudioContext.cpp 2020-09-26 22:07:25 UTC (rev 267638)
+++ trunk/Source/WebCore/Modules/webaudio/BaseAudioContext.cpp 2020-09-26 22:13:56 UTC (rev 267639)
@@ -35,6 +35,7 @@
#include "AudioBufferCallback.h"
#include "AudioBufferOptions.h"
#include "AudioBufferSourceNode.h"
+#include "AudioDestination.h"
#include "AudioListener.h"
#include "AudioNodeInput.h"
#include "AudioNodeOutput.h"
@@ -207,7 +208,8 @@
void BaseAudioContext::lazyInitialize()
{
- ASSERT(!m_isStopScheduled);
+ if (isStopped())
+ return;
if (m_isInitialized)
return;
@@ -374,6 +376,11 @@
return document ? document->identifier() : DocumentIdentifier { };
}
+float BaseAudioContext::sampleRate() const
+{
+ return m_destinationNode ? m_destinationNode->sampleRate() : AudioDestination::hardwareSampleRate();
+}
+
bool BaseAudioContext::isSuspended() const
{
return !document() || document()->activeDOMObjectsAreSuspended() || document()->activeDOMObjectsAreStopped();
@@ -467,11 +474,6 @@
ASSERT(isMainThread());
- if (m_isStopScheduled)
- return Exception { InvalidStateError };
-
- lazyInitialize();
-
// W3C Editor's Draft 06 June 2017
// https://webaudio.github.io/web-audio-api/#widl-BaseAudioContext-createScriptProcessor-ScriptProcessorNode-unsigned-long-bufferSize-unsigned-long-numberOfInputChannels-unsigned-long-numberOfOutputChannels
Modified: trunk/Source/WebCore/Modules/webaudio/BaseAudioContext.h (267638 => 267639)
--- trunk/Source/WebCore/Modules/webaudio/BaseAudioContext.h 2020-09-26 22:07:25 UTC (rev 267638)
+++ trunk/Source/WebCore/Modules/webaudio/BaseAudioContext.h 2020-09-26 22:13:56 UTC (rev 267639)
@@ -121,7 +121,7 @@
AudioDestinationNode* destination() { return m_destinationNode.get(); }
size_t currentSampleFrame() const { return m_destinationNode ? m_destinationNode->currentSampleFrame() : 0; }
double currentTime() const { return m_destinationNode ? m_destinationNode->currentTime() : 0.; }
- float sampleRate() const { return m_destinationNode ? m_destinationNode->sampleRate() : 0.f; }
+ float sampleRate() const;
unsigned long activeSourceCount() const { return static_cast<unsigned long>(m_activeSourceCount); }
void incrementActiveSourceCount();
Modified: trunk/Source/WebCore/Modules/webaudio/BiquadFilterNode.cpp (267638 => 267639)
--- trunk/Source/WebCore/Modules/webaudio/BiquadFilterNode.cpp 2020-09-26 22:07:25 UTC (rev 267638)
+++ trunk/Source/WebCore/Modules/webaudio/BiquadFilterNode.cpp 2020-09-26 22:13:56 UTC (rev 267639)
@@ -35,9 +35,6 @@
ExceptionOr<Ref<BiquadFilterNode>> BiquadFilterNode::create(BaseAudioContext& context, const BiquadFilterOptions& options)
{
- if (context.isStopped())
- return Exception { InvalidStateError };
-
auto node = adoptRef(*new BiquadFilterNode(context));
auto result = node->handleAudioNodeOptions(options, { 2, ChannelCountMode::Max, ChannelInterpretation::Speakers });
Modified: trunk/Source/WebCore/Modules/webaudio/ChannelMergerNode.cpp (267638 => 267639)
--- trunk/Source/WebCore/Modules/webaudio/ChannelMergerNode.cpp 2020-09-26 22:07:25 UTC (rev 267638)
+++ trunk/Source/WebCore/Modules/webaudio/ChannelMergerNode.cpp 2020-09-26 22:13:56 UTC (rev 267639)
@@ -43,9 +43,6 @@
ExceptionOr<Ref<ChannelMergerNode>> ChannelMergerNode::create(BaseAudioContext& context, const ChannelMergerOptions& options)
{
- if (context.isStopped())
- return Exception { InvalidStateError };
-
if (options.numberOfInputs > AudioContext::maxNumberOfChannels() || !options.numberOfInputs)
return Exception { IndexSizeError, "Number of inputs is not in the allowed range."_s };
Modified: trunk/Source/WebCore/Modules/webaudio/ChannelSplitterNode.cpp (267638 => 267639)
--- trunk/Source/WebCore/Modules/webaudio/ChannelSplitterNode.cpp 2020-09-26 22:07:25 UTC (rev 267638)
+++ trunk/Source/WebCore/Modules/webaudio/ChannelSplitterNode.cpp 2020-09-26 22:13:56 UTC (rev 267639)
@@ -39,9 +39,6 @@
ExceptionOr<Ref<ChannelSplitterNode>> ChannelSplitterNode::create(BaseAudioContext& context, const ChannelSplitterOptions& options)
{
- if (context.isStopped())
- return Exception { InvalidStateError };
-
if (options.numberOfOutputs > AudioContext::maxNumberOfChannels() || !options.numberOfOutputs)
return Exception { IndexSizeError, "Number of outputs is not in the allowed range"_s };
Modified: trunk/Source/WebCore/Modules/webaudio/ConstantSourceNode.cpp (267638 => 267639)
--- trunk/Source/WebCore/Modules/webaudio/ConstantSourceNode.cpp 2020-09-26 22:07:25 UTC (rev 267638)
+++ trunk/Source/WebCore/Modules/webaudio/ConstantSourceNode.cpp 2020-09-26 22:13:56 UTC (rev 267639)
@@ -41,9 +41,6 @@
ExceptionOr<Ref<ConstantSourceNode>> ConstantSourceNode::create(BaseAudioContext& context, const ConstantSourceOptions& options)
{
- if (context.isStopped())
- return Exception { InvalidStateError };
-
auto node = adoptRef(*new ConstantSourceNode(context, options.offset));
context.refNode(node);
Modified: trunk/Source/WebCore/Modules/webaudio/ConvolverNode.cpp (267638 => 267639)
--- trunk/Source/WebCore/Modules/webaudio/ConvolverNode.cpp 2020-09-26 22:07:25 UTC (rev 267638)
+++ trunk/Source/WebCore/Modules/webaudio/ConvolverNode.cpp 2020-09-26 22:13:56 UTC (rev 267639)
@@ -57,9 +57,6 @@
ExceptionOr<Ref<ConvolverNode>> ConvolverNode::create(BaseAudioContext& context, ConvolverOptions&& options)
{
- if (context.isStopped())
- return Exception { InvalidStateError };
-
auto node = adoptRef(*new ConvolverNode(context));
auto result = node->handleAudioNodeOptions(options, { 2, ChannelCountMode::ClampedMax, ChannelInterpretation::Speakers });
Modified: trunk/Source/WebCore/Modules/webaudio/DelayNode.cpp (267638 => 267639)
--- trunk/Source/WebCore/Modules/webaudio/DelayNode.cpp 2020-09-26 22:07:25 UTC (rev 267638)
+++ trunk/Source/WebCore/Modules/webaudio/DelayNode.cpp 2020-09-26 22:13:56 UTC (rev 267639)
@@ -49,9 +49,6 @@
ExceptionOr<Ref<DelayNode>> DelayNode::create(BaseAudioContext& context, const DelayOptions& options)
{
- if (context.isStopped())
- return Exception { InvalidStateError };
-
if (options.maxDelayTime <= 0 || options.maxDelayTime >= maximumAllowedDelayTime)
return Exception { NotSupportedError };
Modified: trunk/Source/WebCore/Modules/webaudio/DynamicsCompressorNode.cpp (267638 => 267639)
--- trunk/Source/WebCore/Modules/webaudio/DynamicsCompressorNode.cpp 2020-09-26 22:07:25 UTC (rev 267638)
+++ trunk/Source/WebCore/Modules/webaudio/DynamicsCompressorNode.cpp 2020-09-26 22:13:56 UTC (rev 267639)
@@ -47,9 +47,6 @@
ExceptionOr<Ref<DynamicsCompressorNode>> DynamicsCompressorNode::create(BaseAudioContext& context, const DynamicsCompressorOptions& options)
{
- if (context.isStopped())
- return Exception { InvalidStateError };
-
auto node = adoptRef(*new DynamicsCompressorNode(context, options));
auto result = node->handleAudioNodeOptions(options, { 2, ChannelCountMode::ClampedMax, ChannelInterpretation::Speakers });
Modified: trunk/Source/WebCore/Modules/webaudio/GainNode.cpp (267638 => 267639)
--- trunk/Source/WebCore/Modules/webaudio/GainNode.cpp 2020-09-26 22:07:25 UTC (rev 267638)
+++ trunk/Source/WebCore/Modules/webaudio/GainNode.cpp 2020-09-26 22:13:56 UTC (rev 267639)
@@ -40,9 +40,6 @@
ExceptionOr<Ref<GainNode>> GainNode::create(BaseAudioContext& context, const GainOptions& options)
{
- if (context.isStopped())
- return Exception { InvalidStateError };
-
auto gainNode = adoptRef(*new GainNode(context));
auto result = gainNode->handleAudioNodeOptions(options, { 2, ChannelCountMode::Max, ChannelInterpretation::Speakers });
Modified: trunk/Source/WebCore/Modules/webaudio/IIRFilterNode.cpp (267638 => 267639)
--- trunk/Source/WebCore/Modules/webaudio/IIRFilterNode.cpp 2020-09-26 22:07:25 UTC (rev 267638)
+++ trunk/Source/WebCore/Modules/webaudio/IIRFilterNode.cpp 2020-09-26 22:13:56 UTC (rev 267639)
@@ -84,9 +84,6 @@
ExceptionOr<Ref<IIRFilterNode>> IIRFilterNode::create(ScriptExecutionContext& scriptExecutionContext, BaseAudioContext& context, IIRFilterOptions&& options)
{
- if (context.isStopped())
- return Exception { InvalidStateError };
-
if (!options.feedforward.size() || options.feedforward.size() > IIRFilter::maxOrder)
return Exception { NotSupportedError, "feedforward array must have a length between 1 and 20"_s };
Modified: trunk/Source/WebCore/Modules/webaudio/MediaElementAudioSourceNode.cpp (267638 => 267639)
--- trunk/Source/WebCore/Modules/webaudio/MediaElementAudioSourceNode.cpp 2020-09-26 22:07:25 UTC (rev 267638)
+++ trunk/Source/WebCore/Modules/webaudio/MediaElementAudioSourceNode.cpp 2020-09-26 22:13:56 UTC (rev 267639)
@@ -49,9 +49,6 @@
{
RELEASE_ASSERT(options.mediaElement);
- if (context.isStopped())
- return Exception { InvalidStateError };
-
if (options.mediaElement->audioSourceNode())
return Exception { InvalidStateError, "Media element is already associated with an audio source node"_s };
Modified: trunk/Source/WebCore/Modules/webaudio/MediaStreamAudioDestinationNode.cpp (267638 => 267639)
--- trunk/Source/WebCore/Modules/webaudio/MediaStreamAudioDestinationNode.cpp 2020-09-26 22:07:25 UTC (rev 267638)
+++ trunk/Source/WebCore/Modules/webaudio/MediaStreamAudioDestinationNode.cpp 2020-09-26 22:13:56 UTC (rev 267639)
@@ -41,8 +41,9 @@
ExceptionOr<Ref<MediaStreamAudioDestinationNode>> MediaStreamAudioDestinationNode::create(BaseAudioContext& context, const AudioNodeOptions& options)
{
- if (context.isStopped())
- return Exception { InvalidStateError };
+ // This behavior is not part of the specification. This is done for consistency with Blink.
+ if (context.isStopped() || !context.scriptExecutionContext())
+ return Exception { NotAllowedError, "Cannot create a MediaStreamAudioDestinationNode in a detached frame"_s };
auto node = adoptRef(*new MediaStreamAudioDestinationNode(context));
Modified: trunk/Source/WebCore/Modules/webaudio/MediaStreamAudioSourceNode.cpp (267638 => 267639)
--- trunk/Source/WebCore/Modules/webaudio/MediaStreamAudioSourceNode.cpp 2020-09-26 22:07:25 UTC (rev 267638)
+++ trunk/Source/WebCore/Modules/webaudio/MediaStreamAudioSourceNode.cpp 2020-09-26 22:13:56 UTC (rev 267639)
@@ -43,9 +43,6 @@
{
RELEASE_ASSERT(options.mediaStream);
- if (context.isStopped())
- return Exception { InvalidStateError };
-
auto audioTracks = options.mediaStream->getAudioTracks();
if (audioTracks.isEmpty())
return Exception { InvalidStateError, "Media stream has no audio tracks"_s };
Modified: trunk/Source/WebCore/Modules/webaudio/OscillatorNode.cpp (267638 => 267639)
--- trunk/Source/WebCore/Modules/webaudio/OscillatorNode.cpp 2020-09-26 22:07:25 UTC (rev 267638)
+++ trunk/Source/WebCore/Modules/webaudio/OscillatorNode.cpp 2020-09-26 22:13:56 UTC (rev 267639)
@@ -62,9 +62,6 @@
ExceptionOr<Ref<OscillatorNode>> OscillatorNode::create(BaseAudioContext& context, const OscillatorOptions& options)
{
- if (context.isStopped())
- return Exception { InvalidStateError };
-
if (options.type == OscillatorType::Custom && !options.periodicWave)
return Exception { InvalidStateError, "Must provide periodicWave when using custom type."_s };
Modified: trunk/Source/WebCore/Modules/webaudio/PannerNode.cpp (267638 => 267639)
--- trunk/Source/WebCore/Modules/webaudio/PannerNode.cpp 2020-09-26 22:07:25 UTC (rev 267638)
+++ trunk/Source/WebCore/Modules/webaudio/PannerNode.cpp 2020-09-26 22:13:56 UTC (rev 267639)
@@ -57,9 +57,6 @@
ExceptionOr<Ref<PannerNode>> PannerNode::create(BaseAudioContext& context, const PannerOptions& options)
{
- if (context.isStopped())
- return Exception { InvalidStateError };
-
auto panner = adoptRef(*new PannerNode(context, options));
auto result = panner->handleAudioNodeOptions(options, { 2, ChannelCountMode::ClampedMax, ChannelInterpretation::Speakers });
Modified: trunk/Source/WebCore/Modules/webaudio/PeriodicWave.cpp (267638 => 267639)
--- trunk/Source/WebCore/Modules/webaudio/PeriodicWave.cpp 2020-09-26 22:07:25 UTC (rev 267638)
+++ trunk/Source/WebCore/Modules/webaudio/PeriodicWave.cpp 2020-09-26 22:13:56 UTC (rev 267639)
@@ -61,9 +61,6 @@
ExceptionOr<Ref<PeriodicWave>> PeriodicWave::create(BaseAudioContext& context, PeriodicWaveOptions&& options)
{
- if (context.isStopped())
- return Exception { InvalidStateError };
-
Vector<float> real;
Vector<float> imag;
Modified: trunk/Source/WebCore/Modules/webaudio/StereoPannerNode.cpp (267638 => 267639)
--- trunk/Source/WebCore/Modules/webaudio/StereoPannerNode.cpp 2020-09-26 22:07:25 UTC (rev 267638)
+++ trunk/Source/WebCore/Modules/webaudio/StereoPannerNode.cpp 2020-09-26 22:13:56 UTC (rev 267639)
@@ -41,9 +41,6 @@
ExceptionOr<Ref<StereoPannerNode>> StereoPannerNode::create(BaseAudioContext& context, const StereoPannerOptions& options)
{
- if (context.isStopped())
- return Exception { InvalidStateError };
-
auto stereo = adoptRef(*new StereoPannerNode(context, options.pan));
auto result = stereo->handleAudioNodeOptions(options, { 2, ChannelCountMode::ClampedMax, ChannelInterpretation::Speakers });
Modified: trunk/Source/WebCore/Modules/webaudio/WaveShaperNode.cpp (267638 => 267639)
--- trunk/Source/WebCore/Modules/webaudio/WaveShaperNode.cpp 2020-09-26 22:07:25 UTC (rev 267638)
+++ trunk/Source/WebCore/Modules/webaudio/WaveShaperNode.cpp 2020-09-26 22:13:56 UTC (rev 267639)
@@ -39,9 +39,6 @@
ExceptionOr<Ref<WaveShaperNode>> WaveShaperNode::create(BaseAudioContext& context, const WaveShaperOptions& options)
{
- if (context.isStopped())
- return Exception { InvalidStateError };
-
RefPtr<Float32Array> curve;
if (options.curve) {
curve = Float32Array::tryCreate(options.curve->data(), options.curve->size());