mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
Support default toJSON in WebIDL
This commit is contained in:
parent
9a7e2663e8
commit
16b4e3446b
9 changed files with 106 additions and 155 deletions
|
@ -15,10 +15,6 @@ use crate::dom::bindings::str::DOMString;
|
|||
use crate::dom::globalscope::GlobalScope;
|
||||
use crate::dom::window::Window;
|
||||
use dom_struct::dom_struct;
|
||||
use js::conversions::ToJSValConvertible;
|
||||
use js::jsapi::{JSContext, JSObject};
|
||||
use js::jsval::UndefinedValue;
|
||||
use std::ptr::NonNull;
|
||||
|
||||
#[dom_struct]
|
||||
pub struct RTCSessionDescription {
|
||||
|
@ -70,16 +66,4 @@ impl RTCSessionDescriptionMethods for RTCSessionDescription {
|
|||
fn Sdp(&self) -> DOMString {
|
||||
self.sdp.clone()
|
||||
}
|
||||
|
||||
#[allow(unsafe_code)]
|
||||
/// https://w3c.github.io/webrtc-pc/#dom-rtcsessiondescription-tojson
|
||||
unsafe fn ToJSON(&self, cx: *mut JSContext) -> NonNull<JSObject> {
|
||||
let init = RTCSessionDescriptionInit {
|
||||
type_: self.ty,
|
||||
sdp: self.sdp.clone(),
|
||||
};
|
||||
rooted!(in(cx) let mut jsval = UndefinedValue());
|
||||
init.to_jsval(cx, jsval.handle_mut());
|
||||
NonNull::new(jsval.to_object()).unwrap()
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue