diff options
Diffstat (limited to 'components/script/dom/rtcpeerconnectioniceevent.rs')
-rw-r--r-- | components/script/dom/rtcpeerconnectioniceevent.rs | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/components/script/dom/rtcpeerconnectioniceevent.rs b/components/script/dom/rtcpeerconnectioniceevent.rs index e88222e34ad..8fbe1564960 100644 --- a/components/script/dom/rtcpeerconnectioniceevent.rs +++ b/components/script/dom/rtcpeerconnectioniceevent.rs @@ -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() |