aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/audionode.rs
diff options
context:
space:
mode:
Diffstat (limited to 'components/script/dom/audionode.rs')
-rw-r--r--components/script/dom/audionode.rs19
1 files changed, 17 insertions, 2 deletions
diff --git a/components/script/dom/audionode.rs b/components/script/dom/audionode.rs
index 4690f74245e..5a149dd814f 100644
--- a/components/script/dom/audionode.rs
+++ b/components/script/dom/audionode.rs
@@ -44,9 +44,14 @@ impl AudioNode {
options: &AudioNodeOptions,
number_of_inputs: u32,
number_of_outputs: u32,
- ) -> AudioNode {
+ ) -> Fallible<AudioNode> {
+ if let Some(c) = options.channelCount {
+ if c == 0 || c > MAX_CHANNEL_COUNT {
+ return Err(Error::NotSupported);
+ }
+ }
let node_id = context.audio_context_impl().create_node(node_type);
- AudioNode::new_inherited_for_id(node_id, context, options, number_of_inputs, number_of_outputs)
+ Ok(AudioNode::new_inherited_for_id(node_id, context, options, number_of_inputs, number_of_outputs))
}
pub fn new_inherited_for_id(
@@ -218,6 +223,11 @@ impl AudioNodeMethods for AudioNode {
return Err(Error::NotSupported)
}
}
+ EventTargetTypeId::AudioNode(AudioNodeTypeId::ChannelMergerNode) => {
+ if value != 1 {
+ return Err(Error::InvalidState)
+ }
+ }
// XXX We do not support any of the other AudioNodes with
// constraints yet. Add more cases here as we add support
// for new AudioNodes.
@@ -256,6 +266,11 @@ impl AudioNodeMethods for AudioNode {
return Err(Error::NotSupported)
}
}
+ EventTargetTypeId::AudioNode(AudioNodeTypeId::ChannelMergerNode) => {
+ if value != ChannelCountMode::Explicit {
+ return Err(Error::InvalidState)
+ }
+ }
// XXX We do not support any of the other AudioNodes with
// constraints yet. Add more cases here as we add support
// for new AudioNodes.