mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
Throw on out-of-bounds channelCount in AudioNodes
This commit is contained in:
parent
0ac861ca94
commit
28c21421ca
9 changed files with 44 additions and 38 deletions
|
@ -31,7 +31,7 @@ impl GainNode {
|
|||
window: &Window,
|
||||
context: &BaseAudioContext,
|
||||
options: &GainOptions,
|
||||
) -> GainNode {
|
||||
) -> Fallible<GainNode> {
|
||||
let mut node_options = AudioNodeOptions::empty();
|
||||
let count = options.parent.channelCount.unwrap_or(2);
|
||||
let mode = options.parent.channelCountMode.unwrap_or(ChannelCountMode::Max);
|
||||
|
@ -45,7 +45,7 @@ impl GainNode {
|
|||
&node_options,
|
||||
1, // inputs
|
||||
1, // outputs
|
||||
);
|
||||
)?;
|
||||
let gain = AudioParam::new(
|
||||
window,
|
||||
context,
|
||||
|
@ -56,10 +56,10 @@ impl GainNode {
|
|||
f32::MIN, // min value
|
||||
f32::MAX, // max value
|
||||
);
|
||||
GainNode {
|
||||
Ok(GainNode {
|
||||
node,
|
||||
gain: Dom::from_ref(&gain),
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
#[allow(unrooted_must_root)]
|
||||
|
@ -67,9 +67,9 @@ impl GainNode {
|
|||
window: &Window,
|
||||
context: &BaseAudioContext,
|
||||
options: &GainOptions,
|
||||
) -> DomRoot<GainNode> {
|
||||
let node = GainNode::new_inherited(window, context, options);
|
||||
reflect_dom_object(Box::new(node), window, GainNodeBinding::Wrap)
|
||||
) -> Fallible<DomRoot<GainNode>> {
|
||||
let node = GainNode::new_inherited(window, context, options)?;
|
||||
Ok(reflect_dom_object(Box::new(node), window, GainNodeBinding::Wrap))
|
||||
}
|
||||
|
||||
pub fn Constructor(
|
||||
|
@ -77,7 +77,7 @@ impl GainNode {
|
|||
context: &BaseAudioContext,
|
||||
options: &GainOptions,
|
||||
) -> Fallible<DomRoot<GainNode>> {
|
||||
Ok(GainNode::new(window, context, options))
|
||||
GainNode::new(window, context, options)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue