diff options
author | bors-servo <lbergstrom+bors@mozilla.com> | 2019-08-20 17:27:14 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-08-20 17:27:14 -0400 |
commit | 4275420a562cd7c936010a791138554ea2a33fe9 (patch) | |
tree | 6a59fa8d40f4131f142f5bf4f16104b81d60f4cd /components/script/dom/rtcsessiondescription.rs | |
parent | 17f423723c0206c934f104eb3352f39a9533aa41 (diff) | |
parent | bf70decdd308f24bfe58cebb8f529fbc9cd22001 (diff) | |
download | servo-4275420a562cd7c936010a791138554ea2a33fe9.tar.gz servo-4275420a562cd7c936010a791138554ea2a33fe9.zip |
Auto merge of #23844 - saschanaz:tojson, r=Manishearth
Support default toJSON in WebIDL
<!-- Please describe your changes on the following line: -->
Ported related lines from gecko.
---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: -->
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] These changes fix #22781
<!-- Either: -->
- [x] There are tests for these changes
<!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.-->
<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/23844)
<!-- Reviewable:end -->
Diffstat (limited to 'components/script/dom/rtcsessiondescription.rs')
-rw-r--r-- | components/script/dom/rtcsessiondescription.rs | 19 |
1 files changed, 0 insertions, 19 deletions
diff --git a/components/script/dom/rtcsessiondescription.rs b/components/script/dom/rtcsessiondescription.rs index 9aa46f56060..0ef79a321c6 100644 --- a/components/script/dom/rtcsessiondescription.rs +++ b/components/script/dom/rtcsessiondescription.rs @@ -14,12 +14,7 @@ use crate::dom::bindings::root::DomRoot; use crate::dom::bindings::str::DOMString; use crate::dom::globalscope::GlobalScope; use crate::dom::window::Window; -use crate::script_runtime::JSContext; use dom_struct::dom_struct; -use js::conversions::ToJSValConvertible; -use js::jsapi::JSObject; -use js::jsval::UndefinedValue; -use std::ptr::NonNull; #[dom_struct] pub struct RTCSessionDescription { @@ -71,18 +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 - fn ToJSON(&self, cx: JSContext) -> NonNull<JSObject> { - let init = RTCSessionDescriptionInit { - type_: self.ty, - sdp: self.sdp.clone(), - }; - unsafe { - rooted!(in(*cx) let mut jsval = UndefinedValue()); - init.to_jsval(*cx, jsval.handle_mut()); - NonNull::new(jsval.to_object()).unwrap() - } - } } |