mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-28 19:59:17 +00:00
LibWeb: Validate AudioNode::connect()
input and output arguments
This commit is contained in:
parent
e6334d217b
commit
2edd0812ca
Notes:
github-actions[bot]
2025-01-09 11:35:56 +00:00
Author: https://github.com/tcl3
Commit: 2edd0812ca
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3191
Reviewed-by: https://github.com/shannonbooth ✅
4 changed files with 138 additions and 5 deletions
|
@ -59,18 +59,35 @@ WebIDL::ExceptionOr<GC::Ref<AudioNode>> AudioNode::connect(GC::Ref<AudioNode> de
|
|||
return WebIDL::InvalidAccessError::create(realm(), "Cannot connect to an AudioNode in a different AudioContext"_string);
|
||||
}
|
||||
|
||||
(void)output;
|
||||
(void)input;
|
||||
// The output parameter is an index describing which output of the AudioNode from which to connect.
|
||||
// If this parameter is out-of-bounds, an IndexSizeError exception MUST be thrown.
|
||||
if (output >= number_of_outputs()) {
|
||||
return WebIDL::IndexSizeError::create(realm(), MUST(String::formatted("Output index {} exceeds number of outputs", output)));
|
||||
}
|
||||
|
||||
// The input parameter is an index describing which input of the destination AudioNode to connect to.
|
||||
// If this parameter is out-of-bounds, an IndexSizeError exception MUST be thrown.
|
||||
if (input >= destination_node->number_of_inputs()) {
|
||||
return WebIDL::IndexSizeError::create(realm(), MUST(String::formatted("Input index '{}' exceeds number of inputs", input)));
|
||||
}
|
||||
|
||||
dbgln("FIXME: Implement Audio::connect(AudioNode)");
|
||||
return destination_node;
|
||||
}
|
||||
|
||||
// https://webaudio.github.io/web-audio-api/#dom-audionode-connect-destinationparam-output
|
||||
void AudioNode::connect(GC::Ref<AudioParam> destination_param, WebIDL::UnsignedLong output)
|
||||
WebIDL::ExceptionOr<void> AudioNode::connect(GC::Ref<AudioParam> destination_param, WebIDL::UnsignedLong output)
|
||||
{
|
||||
(void)destination_param;
|
||||
(void)output;
|
||||
|
||||
// The output parameter is an index describing which output of the AudioNode from which to connect.
|
||||
// If the parameter is out-of-bounds, an IndexSizeError exception MUST be thrown.
|
||||
if (output >= number_of_outputs()) {
|
||||
return WebIDL::IndexSizeError::create(realm(), MUST(String::formatted("Output index {} exceeds number of outputs", output)));
|
||||
}
|
||||
|
||||
dbgln("FIXME: Implement AudioNode::connect(AudioParam)");
|
||||
return {};
|
||||
}
|
||||
|
||||
// https://webaudio.github.io/web-audio-api/#dom-audionode-disconnect
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue