mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00:00
Support arbitrary protos when wrapping DOM objects with constructors.
This commit is contained in:
parent
d9600ff50f
commit
dbff26bce0
197 changed files with 2028 additions and 586 deletions
|
@ -11,11 +11,12 @@ use crate::dom::bindings::codegen::Bindings::AudioNodeBinding::{
|
|||
use crate::dom::bindings::codegen::Bindings::MediaStreamAudioDestinationNodeBinding::MediaStreamAudioDestinationNodeMethods;
|
||||
use crate::dom::bindings::error::Fallible;
|
||||
use crate::dom::bindings::inheritance::Castable;
|
||||
use crate::dom::bindings::reflector::{reflect_dom_object, DomObject};
|
||||
use crate::dom::bindings::reflector::{reflect_dom_object2, DomObject};
|
||||
use crate::dom::bindings::root::{Dom, DomRoot};
|
||||
use crate::dom::mediastream::MediaStream;
|
||||
use crate::dom::window::Window;
|
||||
use dom_struct::dom_struct;
|
||||
use js::rust::HandleObject;
|
||||
use servo_media::audio::node::AudioNodeInit;
|
||||
use servo_media::streams::MediaStreamType;
|
||||
use servo_media::ServoMedia;
|
||||
|
@ -53,23 +54,33 @@ impl MediaStreamAudioDestinationNode {
|
|||
})
|
||||
}
|
||||
|
||||
#[allow(unrooted_must_root)]
|
||||
pub fn new(
|
||||
window: &Window,
|
||||
context: &AudioContext,
|
||||
options: &AudioNodeOptions,
|
||||
) -> Fallible<DomRoot<MediaStreamAudioDestinationNode>> {
|
||||
Self::new_with_proto(window, None, context, options)
|
||||
}
|
||||
|
||||
#[allow(unrooted_must_root)]
|
||||
fn new_with_proto(
|
||||
window: &Window,
|
||||
proto: Option<HandleObject>,
|
||||
context: &AudioContext,
|
||||
options: &AudioNodeOptions,
|
||||
) -> Fallible<DomRoot<MediaStreamAudioDestinationNode>> {
|
||||
let node = MediaStreamAudioDestinationNode::new_inherited(context, options)?;
|
||||
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: &AudioNodeOptions,
|
||||
) -> Fallible<DomRoot<MediaStreamAudioDestinationNode>> {
|
||||
MediaStreamAudioDestinationNode::new(window, context, options)
|
||||
MediaStreamAudioDestinationNode::new_with_proto(window, proto, context, options)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue