mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01: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
|
@ -7,7 +7,7 @@ use crate::dom::bindings::codegen::Bindings::RTCPeerConnectionIceEventBinding::R
|
|||
use crate::dom::bindings::codegen::Bindings::RTCPeerConnectionIceEventBinding::RTCPeerConnectionIceEventMethods;
|
||||
use crate::dom::bindings::error::Fallible;
|
||||
use crate::dom::bindings::inheritance::Castable;
|
||||
use crate::dom::bindings::reflector::reflect_dom_object;
|
||||
use crate::dom::bindings::reflector::reflect_dom_object2;
|
||||
use crate::dom::bindings::reflector::DomObject;
|
||||
use crate::dom::bindings::root::{Dom, DomRoot};
|
||||
use crate::dom::bindings::str::DOMString;
|
||||
|
@ -16,6 +16,7 @@ use crate::dom::globalscope::GlobalScope;
|
|||
use crate::dom::rtcicecandidate::RTCIceCandidate;
|
||||
use crate::dom::window::Window;
|
||||
use dom_struct::dom_struct;
|
||||
use js::rust::HandleObject;
|
||||
use servo_atoms::Atom;
|
||||
|
||||
#[dom_struct]
|
||||
|
@ -44,9 +45,21 @@ impl RTCPeerConnectionIceEvent {
|
|||
url: Option<DOMString>,
|
||||
trusted: bool,
|
||||
) -> DomRoot<RTCPeerConnectionIceEvent> {
|
||||
let e = reflect_dom_object(
|
||||
Self::new_with_proto(global, None, ty, candidate, url, trusted)
|
||||
}
|
||||
|
||||
fn new_with_proto(
|
||||
global: &GlobalScope,
|
||||
proto: Option<HandleObject>,
|
||||
ty: Atom,
|
||||
candidate: Option<&RTCIceCandidate>,
|
||||
url: Option<DOMString>,
|
||||
trusted: bool,
|
||||
) -> DomRoot<RTCPeerConnectionIceEvent> {
|
||||
let e = reflect_dom_object2(
|
||||
Box::new(RTCPeerConnectionIceEvent::new_inherited(candidate, url)),
|
||||
global,
|
||||
proto,
|
||||
);
|
||||
let evt = e.upcast::<Event>();
|
||||
evt.init_event(ty, false, false); // XXXManishearth bubbles/cancelable?
|
||||
|
@ -57,11 +70,13 @@ impl RTCPeerConnectionIceEvent {
|
|||
#[allow(non_snake_case)]
|
||||
pub fn Constructor(
|
||||
window: &Window,
|
||||
proto: Option<HandleObject>,
|
||||
ty: DOMString,
|
||||
init: &RTCPeerConnectionIceEventInit,
|
||||
) -> Fallible<DomRoot<RTCPeerConnectionIceEvent>> {
|
||||
Ok(RTCPeerConnectionIceEvent::new(
|
||||
Ok(RTCPeerConnectionIceEvent::new_with_proto(
|
||||
&window.global(),
|
||||
proto,
|
||||
ty.into(),
|
||||
init.candidate
|
||||
.as_ref()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue