aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/mediaelementaudiosourcenode.rs
diff options
context:
space:
mode:
authorJosh Matthews <josh@joshmatthews.net>2023-05-28 22:43:55 -0400
committerJosh Matthews <josh@joshmatthews.net>2023-05-28 23:23:12 -0400
commitdbff26bce05d404027ef5bbfd85fb5995e4726bc (patch)
tree6ebb631eef396c2f387fe8269b0d59bde0dccae2 /components/script/dom/mediaelementaudiosourcenode.rs
parentd9600ff50f3c1bdd8c44e2dfc15a18416d80cb82 (diff)
downloadservo-dbff26bce05d404027ef5bbfd85fb5995e4726bc.tar.gz
servo-dbff26bce05d404027ef5bbfd85fb5995e4726bc.zip
Support arbitrary protos when wrapping DOM objects with constructors.
Diffstat (limited to 'components/script/dom/mediaelementaudiosourcenode.rs')
-rw-r--r--components/script/dom/mediaelementaudiosourcenode.rs19
1 files changed, 15 insertions, 4 deletions
diff --git a/components/script/dom/mediaelementaudiosourcenode.rs b/components/script/dom/mediaelementaudiosourcenode.rs
index 29737fc3bc0..98f43a063be 100644
--- a/components/script/dom/mediaelementaudiosourcenode.rs
+++ b/components/script/dom/mediaelementaudiosourcenode.rs
@@ -7,11 +7,12 @@ use crate::dom::audionode::AudioNode;
use crate::dom::bindings::codegen::Bindings::MediaElementAudioSourceNodeBinding::MediaElementAudioSourceNodeMethods;
use crate::dom::bindings::codegen::Bindings::MediaElementAudioSourceNodeBinding::MediaElementAudioSourceOptions;
use crate::dom::bindings::error::Fallible;
-use crate::dom::bindings::reflector::reflect_dom_object;
+use crate::dom::bindings::reflector::reflect_dom_object2;
use crate::dom::bindings::root::{Dom, DomRoot};
use crate::dom::htmlmediaelement::HTMLMediaElement;
use crate::dom::window::Window;
use dom_struct::dom_struct;
+use js::rust::HandleObject;
use servo_media::audio::media_element_source_node::MediaElementSourceNodeMessage;
use servo_media::audio::node::{AudioNodeInit, AudioNodeMessage};
use std::sync::mpsc;
@@ -48,23 +49,33 @@ impl MediaElementAudioSourceNode {
})
}
- #[allow(unrooted_must_root)]
pub fn new(
window: &Window,
context: &AudioContext,
media_element: &HTMLMediaElement,
) -> Fallible<DomRoot<MediaElementAudioSourceNode>> {
+ Self::new_with_proto(window, None, context, media_element)
+ }
+
+ #[allow(unrooted_must_root)]
+ fn new_with_proto(
+ window: &Window,
+ proto: Option<HandleObject>,
+ context: &AudioContext,
+ media_element: &HTMLMediaElement,
+ ) -> Fallible<DomRoot<MediaElementAudioSourceNode>> {
let node = MediaElementAudioSourceNode::new_inherited(context, media_element)?;
- Ok(reflect_dom_object(Box::new(node), window))
+ Ok(reflect_dom_object2(Box::new(node), window, proto))
}
#[allow(non_snake_case)]
pub fn Constructor(
window: &Window,
+ proto: Option<HandleObject>,
context: &AudioContext,
options: &MediaElementAudioSourceOptions,
) -> Fallible<DomRoot<MediaElementAudioSourceNode>> {
- MediaElementAudioSourceNode::new(window, context, &*options.mediaElement)
+ MediaElementAudioSourceNode::new_with_proto(window, proto, context, &*options.mediaElement)
}
}