зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1477205 - Remove the exception when a node is created after closing the AudioContext. r=padenot
Differential Revision: https://phabricator.services.mozilla.com/D21361 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
8a57bf6e92
Коммит
ce1581df1f
|
@ -90,10 +90,6 @@ class AnalyserNodeEngine final : public AudioNodeEngine {
|
|||
already_AddRefed<AnalyserNode> AnalyserNode::Create(
|
||||
AudioContext& aAudioContext, const AnalyserOptions& aOptions,
|
||||
ErrorResult& aRv) {
|
||||
if (aAudioContext.CheckClosed(aRv)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
RefPtr<AnalyserNode> analyserNode = new AnalyserNode(&aAudioContext);
|
||||
|
||||
analyserNode->Initialize(aOptions, aRv);
|
||||
|
|
|
@ -608,10 +608,6 @@ AudioBufferSourceNode::AudioBufferSourceNode(AudioContext* aContext)
|
|||
already_AddRefed<AudioBufferSourceNode> AudioBufferSourceNode::Create(
|
||||
JSContext* aCx, AudioContext& aAudioContext,
|
||||
const AudioBufferSourceOptions& aOptions, ErrorResult& aRv) {
|
||||
if (aAudioContext.CheckClosed(aRv)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
RefPtr<AudioBufferSourceNode> audioNode =
|
||||
new AudioBufferSourceNode(&aAudioContext);
|
||||
|
||||
|
|
|
@ -328,15 +328,6 @@ already_AddRefed<AudioContext> AudioContext::Constructor(
|
|||
return object.forget();
|
||||
}
|
||||
|
||||
bool AudioContext::CheckClosed(ErrorResult& aRv) {
|
||||
if (mAudioContextState == AudioContextState::Closed || mIsShutDown ||
|
||||
mIsDisconnecting) {
|
||||
aRv.Throw(NS_ERROR_DOM_INVALID_STATE_ERR);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
already_AddRefed<AudioBufferSourceNode> AudioContext::CreateBufferSource(
|
||||
ErrorResult& aRv) {
|
||||
return AudioBufferSourceNode::Create(nullptr, *this,
|
||||
|
@ -345,10 +336,6 @@ already_AddRefed<AudioBufferSourceNode> AudioContext::CreateBufferSource(
|
|||
|
||||
already_AddRefed<ConstantSourceNode> AudioContext::CreateConstantSource(
|
||||
ErrorResult& aRv) {
|
||||
if (CheckClosed(aRv)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
RefPtr<ConstantSourceNode> constantSourceNode = new ConstantSourceNode(this);
|
||||
return constantSourceNode.forget();
|
||||
}
|
||||
|
@ -402,10 +389,6 @@ already_AddRefed<ScriptProcessorNode> AudioContext::CreateScriptProcessor(
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
if (CheckClosed(aRv)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
RefPtr<ScriptProcessorNode> scriptProcessor = new ScriptProcessorNode(
|
||||
this, aBufferSize, aNumberOfInputChannels, aNumberOfOutputChannels);
|
||||
return scriptProcessor.forget();
|
||||
|
|
|
@ -310,8 +310,6 @@ class AudioContext final : public DOMEventTargetHelper,
|
|||
|
||||
BasicWaveFormCache* GetBasicWaveFormCache();
|
||||
|
||||
bool CheckClosed(ErrorResult& aRv);
|
||||
|
||||
// Steals from |aParamMap|
|
||||
void SetParamMapForWorkletName(const nsAString& aName,
|
||||
AudioParamDescriptorMap* aParamMap);
|
||||
|
|
|
@ -26,10 +26,6 @@ already_AddRefed<AudioWorkletNode> AudioWorkletNode::Constructor(
|
|||
const GlobalObject& aGlobal, AudioContext& aAudioContext,
|
||||
const nsAString& aName, const AudioWorkletNodeOptions& aOptions,
|
||||
ErrorResult& aRv) {
|
||||
if (aAudioContext.CheckClosed(aRv)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (aOptions.mNumberOfInputs == 0 && aOptions.mNumberOfOutputs == 0) {
|
||||
aRv.Throw(NS_ERROR_DOM_NOT_SUPPORTED_ERR);
|
||||
return nullptr;
|
||||
|
|
|
@ -243,10 +243,6 @@ BiquadFilterNode::BiquadFilterNode(AudioContext* aContext)
|
|||
already_AddRefed<BiquadFilterNode> BiquadFilterNode::Create(
|
||||
AudioContext& aAudioContext, const BiquadFilterOptions& aOptions,
|
||||
ErrorResult& aRv) {
|
||||
if (aAudioContext.CheckClosed(aRv)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
RefPtr<BiquadFilterNode> audioNode = new BiquadFilterNode(&aAudioContext);
|
||||
|
||||
audioNode->Initialize(aOptions, aRv);
|
||||
|
|
|
@ -68,10 +68,6 @@ ChannelMergerNode::ChannelMergerNode(AudioContext* aContext,
|
|||
already_AddRefed<ChannelMergerNode> ChannelMergerNode::Create(
|
||||
AudioContext& aAudioContext, const ChannelMergerOptions& aOptions,
|
||||
ErrorResult& aRv) {
|
||||
if (aAudioContext.CheckClosed(aRv)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (aOptions.mNumberOfInputs == 0 ||
|
||||
aOptions.mNumberOfInputs > WebAudioUtils::MaxChannelCount) {
|
||||
aRv.Throw(NS_ERROR_DOM_INDEX_SIZE_ERR);
|
||||
|
|
|
@ -58,10 +58,6 @@ ChannelSplitterNode::ChannelSplitterNode(AudioContext* aContext,
|
|||
already_AddRefed<ChannelSplitterNode> ChannelSplitterNode::Create(
|
||||
AudioContext& aAudioContext, const ChannelSplitterOptions& aOptions,
|
||||
ErrorResult& aRv) {
|
||||
if (aAudioContext.CheckClosed(aRv)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (aOptions.mNumberOfOutputs == 0 ||
|
||||
aOptions.mNumberOfOutputs > WebAudioUtils::MaxChannelCount) {
|
||||
aRv.Throw(NS_ERROR_DOM_INDEX_SIZE_ERR);
|
||||
|
|
|
@ -396,10 +396,6 @@ ConvolverNode::ConvolverNode(AudioContext* aContext)
|
|||
already_AddRefed<ConvolverNode> ConvolverNode::Create(
|
||||
JSContext* aCx, AudioContext& aAudioContext,
|
||||
const ConvolverOptions& aOptions, ErrorResult& aRv) {
|
||||
if (aAudioContext.CheckClosed(aRv)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
RefPtr<ConvolverNode> audioNode = new ConvolverNode(&aAudioContext);
|
||||
|
||||
audioNode->Initialize(aOptions, aRv);
|
||||
|
|
|
@ -185,10 +185,6 @@ DelayNode::DelayNode(AudioContext* aContext, double aMaxDelay)
|
|||
already_AddRefed<DelayNode> DelayNode::Create(AudioContext& aAudioContext,
|
||||
const DelayOptions& aOptions,
|
||||
ErrorResult& aRv) {
|
||||
if (aAudioContext.CheckClosed(aRv)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (aOptions.mMaxDelayTime <= 0. || aOptions.mMaxDelayTime >= 180.) {
|
||||
aRv.Throw(NS_ERROR_DOM_NOT_SUPPORTED_ERR);
|
||||
return nullptr;
|
||||
|
|
|
@ -184,10 +184,6 @@ DynamicsCompressorNode::DynamicsCompressorNode(AudioContext* aContext)
|
|||
already_AddRefed<DynamicsCompressorNode> DynamicsCompressorNode::Create(
|
||||
AudioContext& aAudioContext, const DynamicsCompressorOptions& aOptions,
|
||||
ErrorResult& aRv) {
|
||||
if (aAudioContext.CheckClosed(aRv)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
RefPtr<DynamicsCompressorNode> audioNode =
|
||||
new DynamicsCompressorNode(&aAudioContext);
|
||||
|
||||
|
|
|
@ -119,10 +119,6 @@ GainNode::GainNode(AudioContext* aContext)
|
|||
already_AddRefed<GainNode> GainNode::Create(AudioContext& aAudioContext,
|
||||
const GainOptions& aOptions,
|
||||
ErrorResult& aRv) {
|
||||
if (aAudioContext.CheckClosed(aRv)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
RefPtr<GainNode> audioNode = new GainNode(&aAudioContext);
|
||||
|
||||
audioNode->Initialize(aOptions, aRv);
|
||||
|
|
|
@ -159,10 +159,6 @@ IIRFilterNode::IIRFilterNode(AudioContext* aContext,
|
|||
already_AddRefed<IIRFilterNode> IIRFilterNode::Create(
|
||||
AudioContext& aAudioContext, const IIRFilterOptions& aOptions,
|
||||
ErrorResult& aRv) {
|
||||
if (aAudioContext.CheckClosed(aRv)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (aOptions.mFeedforward.Length() == 0 ||
|
||||
aOptions.mFeedforward.Length() > 20) {
|
||||
aRv.Throw(NS_ERROR_DOM_NOT_SUPPORTED_ERR);
|
||||
|
|
|
@ -26,10 +26,6 @@ MediaElementAudioSourceNode::Create(
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
if (aAudioContext.CheckClosed(aRv)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
RefPtr<MediaElementAudioSourceNode> node =
|
||||
new MediaElementAudioSourceNode(&aAudioContext);
|
||||
|
||||
|
|
|
@ -100,10 +100,6 @@ MediaStreamAudioDestinationNode::Create(AudioContext& aAudioContext,
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
if (aAudioContext.CheckClosed(aRv)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
RefPtr<MediaStreamAudioDestinationNode> audioNode =
|
||||
new MediaStreamAudioDestinationNode(&aAudioContext);
|
||||
|
||||
|
|
|
@ -50,10 +50,6 @@ already_AddRefed<MediaStreamAudioSourceNode> MediaStreamAudioSourceNode::Create(
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
if (aAudioContext.CheckClosed(aRv)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (aAudioContext.Graph() !=
|
||||
aOptions.mMediaStream->GetPlaybackStream()->Graph()) {
|
||||
nsCOMPtr<nsPIDOMWindowInner> pWindow = aAudioContext.GetParentObject();
|
||||
|
|
|
@ -390,10 +390,6 @@ OscillatorNode::OscillatorNode(AudioContext* aContext)
|
|||
already_AddRefed<OscillatorNode> OscillatorNode::Create(
|
||||
AudioContext& aAudioContext, const OscillatorOptions& aOptions,
|
||||
ErrorResult& aRv) {
|
||||
if (aAudioContext.CheckClosed(aRv)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
RefPtr<OscillatorNode> audioNode = new OscillatorNode(&aAudioContext);
|
||||
|
||||
audioNode->Initialize(aOptions, aRv);
|
||||
|
|
|
@ -325,10 +325,6 @@ PannerNode::PannerNode(AudioContext* aContext)
|
|||
already_AddRefed<PannerNode> PannerNode::Create(AudioContext& aAudioContext,
|
||||
const PannerOptions& aOptions,
|
||||
ErrorResult& aRv) {
|
||||
if (aAudioContext.CheckClosed(aRv)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
RefPtr<PannerNode> audioNode = new PannerNode(&aAudioContext);
|
||||
|
||||
audioNode->Initialize(aOptions, aRv);
|
||||
|
|
|
@ -168,10 +168,6 @@ StereoPannerNode::StereoPannerNode(AudioContext* aContext)
|
|||
already_AddRefed<StereoPannerNode> StereoPannerNode::Create(
|
||||
AudioContext& aAudioContext, const StereoPannerOptions& aOptions,
|
||||
ErrorResult& aRv) {
|
||||
if (aAudioContext.CheckClosed(aRv)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
RefPtr<StereoPannerNode> audioNode = new StereoPannerNode(&aAudioContext);
|
||||
|
||||
audioNode->Initialize(aOptions, aRv);
|
||||
|
|
|
@ -296,10 +296,6 @@ WaveShaperNode::WaveShaperNode(AudioContext* aContext)
|
|||
already_AddRefed<WaveShaperNode> WaveShaperNode::Create(
|
||||
AudioContext& aAudioContext, const WaveShaperOptions& aOptions,
|
||||
ErrorResult& aRv) {
|
||||
if (aAudioContext.CheckClosed(aRv)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
RefPtr<WaveShaperNode> audioNode = new WaveShaperNode(&aAudioContext);
|
||||
|
||||
audioNode->Initialize(aOptions, aRv);
|
||||
|
|
|
@ -41,7 +41,7 @@ function tryToCreateNodeOnClosedContext(ctx) {
|
|||
return;
|
||||
}
|
||||
|
||||
expectException(function() {
|
||||
expectNoException(function() {
|
||||
ctx[e.name].apply(ctx, e.args);
|
||||
}, DOMException.INVALID_STATE_ERR);
|
||||
});
|
||||
|
|
Загрузка…
Ссылка в новой задаче