Bug 1443224 - Throw correct exceptions when trying to set the channelCount, the channelCountMode and the channelInterpretation on a ChannelSplitterNode. r=baku

Spec: https://webaudio.github.io/web-audio-api/#dom-audionode-channelcount
Google has written a web platform test this is going to be merged soon (we
currently fail it).

MozReview-Commit-ID: 1RpASaIJrhm

--HG--
extra : rebase_source : 42dc8af6e677831d70e84ffc23e738d49549c59d
extra : amend_source : b4c30805157bd9bfd06afdfc8f439fe8de1b6aae
extra : source : e7b5b629fb30c4c8b8708979e926029f4e743420
This commit is contained in:
Paul Adenot 2018-03-09 15:22:44 +01:00
parent f7b76851ba
commit 2423ff6f48
4 changed files with 19 additions and 2 deletions

View File

@ -91,7 +91,10 @@ AudioNode::Initialize(const AudioNodeOptions& aOptions, ErrorResult& aRv)
}
if (aOptions.mChannelInterpretation.WasPassed()) {
SetChannelInterpretationValue(aOptions.mChannelInterpretation.Value());
SetChannelInterpretationValue(aOptions.mChannelInterpretation.Value(), aRv);
if (NS_WARN_IF(aRv.Failed())) {
return;
}
}
}

View File

@ -152,7 +152,7 @@ public:
{
return mChannelInterpretation;
}
void SetChannelInterpretationValue(ChannelInterpretation aMode)
virtual void SetChannelInterpretationValue(ChannelInterpretation aMode, ErrorResult& aRv)
{
mChannelInterpretation = aMode;
SendChannelMixingParametersToStream();

View File

@ -31,6 +31,19 @@ public:
return Create(aAudioContext, aOptions, aRv);
}
void SetChannelCount(uint32_t aChannelCount, ErrorResult& aRv) override
{
aRv.Throw(NS_ERROR_DOM_INVALID_STATE_ERR);
}
void SetChannelCountModeValue(ChannelCountMode aMode, ErrorResult& aRv) override
{
aRv.Throw(NS_ERROR_DOM_INVALID_STATE_ERR);
}
void SetChannelInterpretationValue(ChannelInterpretation aMode, ErrorResult& aRv) override
{
aRv.Throw(NS_ERROR_DOM_INVALID_STATE_ERR);
}
JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
uint16_t NumberOfOutputs() const override { return mOutputCount; }

View File

@ -58,6 +58,7 @@ interface AudioNode : EventTarget {
attribute unsigned long channelCount;
[SetterThrows]
attribute ChannelCountMode channelCountMode;
[SetterThrows]
attribute ChannelInterpretation channelInterpretation;
};