WebAudio: Add stub for AudioDestinationNode.destination

This is called by https://athenacrisis.com/ and passed through to
AudioNode.connect, which expects an AudioNode.

Implement this function enough so that we return an AudioNode so that
AudioNode.connect does not throw a TypeError.
This commit is contained in:
Shannon Booth 2024-07-24 17:50:06 +12:00 committed by Andreas Kling
commit a51095f705
Notes: github-actions[bot] 2024-07-24 09:15:48 +00:00
3 changed files with 26 additions and 1 deletions

View file

@ -10,6 +10,7 @@
#include <LibWeb/HTML/EventNames.h>
#include <LibWeb/WebAudio/AudioBuffer.h>
#include <LibWeb/WebAudio/AudioBufferSourceNode.h>
#include <LibWeb/WebAudio/AudioDestinationNode.h>
#include <LibWeb/WebAudio/BaseAudioContext.h>
#include <LibWeb/WebAudio/BiquadFilterNode.h>
#include <LibWeb/WebAudio/DynamicsCompressorNode.h>
@ -32,6 +33,24 @@ void BaseAudioContext::initialize(JS::Realm& realm)
WEB_SET_PROTOTYPE_FOR_INTERFACE(BaseAudioContext);
}
void BaseAudioContext::visit_edges(Cell::Visitor& visitor)
{
Base::visit_edges(visitor);
visitor.visit(m_destination);
}
// https://webaudio.github.io/web-audio-api/#dom-baseaudiocontext-destination
JS::NonnullGCPtr<AudioDestinationNode> BaseAudioContext::destination()
{
auto& realm = this->realm();
dbgln("FIXME: Properly implement BaseAudioContext::destination");
if (!m_destination)
m_destination = realm.heap().allocate<AudioDestinationNode>(realm, realm, *this);
return *m_destination;
}
void BaseAudioContext::set_onstatechange(WebIDL::CallbackType* event_handler)
{
set_event_handler_attribute(HTML::EventNames::statechange, event_handler);