mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-28 11:49:44 +00:00
LibWeb: Validate AudioParam context in AudioNode::connect()
An exception is now thown if an `AudioNode` attempts to connect to an `AudioParam` from a different `BaseAudioContext`.
This commit is contained in:
parent
2edd0812ca
commit
5c57acf140
Notes:
github-actions[bot]
2025-01-09 11:35:50 +00:00
Author: https://github.com/tcl3
Commit: 5c57acf140
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3191
Reviewed-by: https://github.com/shannonbooth ✅
14 changed files with 54 additions and 43 deletions
|
@ -78,7 +78,11 @@ WebIDL::ExceptionOr<GC::Ref<AudioNode>> AudioNode::connect(GC::Ref<AudioNode> de
|
|||
// https://webaudio.github.io/web-audio-api/#dom-audionode-connect-destinationparam-output
|
||||
WebIDL::ExceptionOr<void> AudioNode::connect(GC::Ref<AudioParam> destination_param, WebIDL::UnsignedLong output)
|
||||
{
|
||||
(void)destination_param;
|
||||
// If destinationParam belongs to an AudioNode that belongs to a BaseAudioContext that is different from the BaseAudioContext
|
||||
// that has created the AudioNode on which this method was called, an InvalidAccessError MUST be thrown.
|
||||
if (m_context != destination_param->context()) {
|
||||
return WebIDL::InvalidAccessError::create(realm(), "Cannot connect to an AudioParam in a different AudioContext"_string);
|
||||
}
|
||||
|
||||
// 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.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue