mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-20 03:25:13 +00:00
LibWeb: Validate AudioNode::disconnect()
input and output arguments
This commit is contained in:
parent
5c57acf140
commit
81d6cd497a
Notes:
github-actions[bot]
2025-01-09 11:35:42 +00:00
Author: https://github.com/tcl3 Commit: https://github.com/LadybirdBrowser/ladybird/commit/81d6cd497a7 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3191 Reviewed-by: https://github.com/shannonbooth ✅
2 changed files with 43 additions and 13 deletions
|
@ -101,10 +101,17 @@ void AudioNode::disconnect()
|
|||
}
|
||||
|
||||
// https://webaudio.github.io/web-audio-api/#dom-audionode-disconnect-output
|
||||
void AudioNode::disconnect(WebIDL::UnsignedLong output)
|
||||
WebIDL::ExceptionOr<void> AudioNode::disconnect(WebIDL::UnsignedLong output)
|
||||
{
|
||||
(void)output;
|
||||
// The output parameter is an index describing which output of the AudioNode to disconnect.
|
||||
// It disconnects all outgoing connections from the given output.
|
||||
// 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)));
|
||||
}
|
||||
|
||||
dbgln("FIXME: Implement AudioNode::disconnect(output)");
|
||||
return {};
|
||||
}
|
||||
|
||||
// https://webaudio.github.io/web-audio-api/#dom-audionode-disconnect-destinationnode
|
||||
|
@ -115,20 +122,37 @@ void AudioNode::disconnect(GC::Ref<AudioNode> destination_node)
|
|||
}
|
||||
|
||||
// https://webaudio.github.io/web-audio-api/#dom-audionode-disconnect-destinationnode-output
|
||||
void AudioNode::disconnect(GC::Ref<AudioNode> destination_node, WebIDL::UnsignedLong output)
|
||||
WebIDL::ExceptionOr<void> AudioNode::disconnect(GC::Ref<AudioNode> destination_node, WebIDL::UnsignedLong output)
|
||||
{
|
||||
(void)destination_node;
|
||||
(void)output;
|
||||
// The output parameter is an index describing which output of the AudioNode from which to disconnect.
|
||||
// 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)));
|
||||
}
|
||||
|
||||
dbgln("FIXME: Implement AudioNode::disconnect(destination_node, output)");
|
||||
return {};
|
||||
}
|
||||
|
||||
// https://webaudio.github.io/web-audio-api/#dom-audionode-disconnect-destinationnode-output-input
|
||||
void AudioNode::disconnect(GC::Ref<AudioNode> destination_node, WebIDL::UnsignedLong output, WebIDL::UnsignedLong input)
|
||||
WebIDL::ExceptionOr<void> AudioNode::disconnect(GC::Ref<AudioNode> destination_node, WebIDL::UnsignedLong output, WebIDL::UnsignedLong input)
|
||||
{
|
||||
(void)destination_node;
|
||||
(void)output;
|
||||
(void)input;
|
||||
// The output parameter is an index describing which output of the AudioNode from which to disconnect.
|
||||
// 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 disconnect.
|
||||
// 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 AudioNode::disconnect(destination_node, output, input)");
|
||||
return {};
|
||||
}
|
||||
|
||||
// https://webaudio.github.io/web-audio-api/#dom-audionode-disconnect-destinationparam
|
||||
|
@ -139,11 +163,17 @@ void AudioNode::disconnect(GC::Ref<AudioParam> destination_param)
|
|||
}
|
||||
|
||||
// https://webaudio.github.io/web-audio-api/#dom-audionode-disconnect-destinationparam-output
|
||||
void AudioNode::disconnect(GC::Ref<AudioParam> destination_param, WebIDL::UnsignedLong output)
|
||||
WebIDL::ExceptionOr<void> AudioNode::disconnect(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 disconnect.
|
||||
// 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)));
|
||||
}
|
||||
|
||||
dbgln("FIXME: Implement AudioNode::disconnect(destination_param, output)");
|
||||
return {};
|
||||
}
|
||||
|
||||
// https://webaudio.github.io/web-audio-api/#dom-audionode-channelcount
|
||||
|
|
|
@ -40,12 +40,12 @@ public:
|
|||
WebIDL::ExceptionOr<void> connect(GC::Ref<AudioParam> destination_param, WebIDL::UnsignedLong output = 0);
|
||||
|
||||
void disconnect();
|
||||
void disconnect(WebIDL::UnsignedLong output);
|
||||
WebIDL::ExceptionOr<void> disconnect(WebIDL::UnsignedLong output);
|
||||
void disconnect(GC::Ref<AudioNode> destination_node);
|
||||
void disconnect(GC::Ref<AudioNode> destination_node, WebIDL::UnsignedLong output);
|
||||
void disconnect(GC::Ref<AudioNode> destination_node, WebIDL::UnsignedLong output, WebIDL::UnsignedLong input);
|
||||
WebIDL::ExceptionOr<void> disconnect(GC::Ref<AudioNode> destination_node, WebIDL::UnsignedLong output);
|
||||
WebIDL::ExceptionOr<void> disconnect(GC::Ref<AudioNode> destination_node, WebIDL::UnsignedLong output, WebIDL::UnsignedLong input);
|
||||
void disconnect(GC::Ref<AudioParam> destination_param);
|
||||
void disconnect(GC::Ref<AudioParam> destination_param, WebIDL::UnsignedLong output);
|
||||
WebIDL::ExceptionOr<void> disconnect(GC::Ref<AudioParam> destination_param, WebIDL::UnsignedLong output);
|
||||
|
||||
// https://webaudio.github.io/web-audio-api/#dom-audionode-context
|
||||
GC::Ref<BaseAudioContext const> context() const
|
||||
|
|
Loading…
Add table
Reference in a new issue