1#![allow(non_camel_case_types,non_upper_case_globals,unsafe_op_in_unsafe_fn,unused_imports,unused_variables,unused_assignments,unused_mut,clippy::approx_constant,clippy::enum_variant_names,clippy::let_unit_value,clippy::needless_return,clippy::too_many_arguments,clippy::unnecessary_cast,clippy::upper_case_acronyms)]
4
5use crate::codegen::GenericBindings::EventHandlerBinding::EventHandlerNonNull;
6use crate::codegen::GenericBindings::EventTargetBinding::EventTarget_Binding;
7use crate::import::base::*;
8
9
10#[repr(usize)]
11#[derive(Copy, Clone, Debug, JSTraceable, MallocSizeOf, PartialEq)]
12pub enum RTCDataChannelState {
13 Connecting,
14 Open,
15 Closing,
16 Closed
17}
18pub mod RTCDataChannelStateValues {
19
20 use crate::utils::find_enum_value;
21 use js::conversions::ConversionResult;
22 use js::conversions::FromJSValConvertible;
23 use js::conversions::ToJSValConvertible;
24 use js::context::RawJSContext;
25 use js::rust::HandleValue;
26 use js::rust::MutableHandleValue;
27 use js::jsval::JSVal;
28
29 pub(crate) const pairs: &[(&str, super::RTCDataChannelState)] = &[
30 ("connecting", super::RTCDataChannelState::Connecting),
31 ("open", super::RTCDataChannelState::Open),
32 ("closing", super::RTCDataChannelState::Closing),
33 ("closed", super::RTCDataChannelState::Closed),
34 ];
35
36 impl super::RTCDataChannelState {
37 pub fn as_str(&self) -> &'static str {
38 pairs[*self as usize].0
39 }
40 }
41
42 impl Default for super::RTCDataChannelState {
43 fn default() -> super::RTCDataChannelState {
44 pairs[0].1
45 }
46 }
47
48 impl std::str::FromStr for super::RTCDataChannelState {
49 type Err = ();
50
51 fn from_str(s: &str) -> Result<Self, Self::Err> {
52 pairs
53 .iter()
54 .find(|&&(key, _)| s == key)
55 .map(|&(_, ev)| ev)
56 .ok_or(())
57 }
58 }
59
60 impl ToJSValConvertible for super::RTCDataChannelState {
61 unsafe fn to_jsval(&self, cx: *mut RawJSContext, rval: MutableHandleValue) {
62 pairs[*self as usize].0.to_jsval(cx, rval);
63 }
64 }
65
66 impl FromJSValConvertible for super::RTCDataChannelState {
67 type Config = ();
68 unsafe fn from_jsval(cx: *mut RawJSContext, value: HandleValue, _option: ())
69 -> Result<ConversionResult<super::RTCDataChannelState>, ()> {
70 match find_enum_value(cx, value, pairs) {
71 Err(_) => Err(()),
72 Ok((None, search)) => {
73 Ok(ConversionResult::Failure(
74 format!("'{}' is not a valid enum value for enumeration 'RTCDataChannelState'.", search).into()
75 ))
76 }
77 Ok((Some(&value), _)) => Ok(ConversionResult::Success(value)),
78 }
79 }
80 }
81 } #[derive(JSTraceable)]
84pub struct RTCDataChannelInit {
85 pub id: Option<u16>,
86 pub maxPacketLifeTime: Option<u16>,
87 pub maxRetransmits: Option<u16>,
88 pub negotiated: bool,
89 pub ordered: bool,
90 pub protocol: USVString,
91}
92impl Default for RTCDataChannelInit {
93 fn default() -> Self {
94 Self::empty()
95 }
96}
97
98impl RTCDataChannelInit {
99 pub fn empty() -> Self {
100 Self {
101 id: None,
102 maxPacketLifeTime: None,
103 maxRetransmits: None,
104 negotiated: false,
105 ordered: true,
106 protocol: USVString("".to_owned()),
107 }
108 }
109 pub fn new(cx: SafeJSContext, val: HandleValue, can_gc: CanGc)
110 -> Result<ConversionResult<RTCDataChannelInit>, ()> {
111 unsafe {
112 let object = if val.get().is_null_or_undefined() {
113 ptr::null_mut()
114 } else if val.get().is_object() {
115 val.get().to_object()
116 } else {
117 return Ok(ConversionResult::Failure("Value is not an object.".into()));
118 };
119 rooted!(&in(cx) let object = object);
120 let dictionary = RTCDataChannelInit {
121 id: {
122 rooted!(&in(cx) let mut rval = UndefinedValue());
123 if get_dictionary_property(cx.raw_cx(), object.handle(), "id", rval.handle_mut(), can_gc)? && !rval.is_undefined() {
124 Some(match FromJSValConvertible::from_jsval(cx.raw_cx(), rval.handle(), ConversionBehavior::Default) {
125 Ok(ConversionResult::Success(value)) => value,
126 Ok(ConversionResult::Failure(error)) => {
127 throw_type_error(cx.raw_cx(), &error);
128 return Err(());
129
130 }
131 _ => {
132 return Err(());
133
134 },
135 }
136 )
137 } else {
138 None
139 }
140 },
141 maxPacketLifeTime: {
142 rooted!(&in(cx) let mut rval = UndefinedValue());
143 if get_dictionary_property(cx.raw_cx(), object.handle(), "maxPacketLifeTime", rval.handle_mut(), can_gc)? && !rval.is_undefined() {
144 Some(match FromJSValConvertible::from_jsval(cx.raw_cx(), rval.handle(), ConversionBehavior::Default) {
145 Ok(ConversionResult::Success(value)) => value,
146 Ok(ConversionResult::Failure(error)) => {
147 throw_type_error(cx.raw_cx(), &error);
148 return Err(());
149
150 }
151 _ => {
152 return Err(());
153
154 },
155 }
156 )
157 } else {
158 None
159 }
160 },
161 maxRetransmits: {
162 rooted!(&in(cx) let mut rval = UndefinedValue());
163 if get_dictionary_property(cx.raw_cx(), object.handle(), "maxRetransmits", rval.handle_mut(), can_gc)? && !rval.is_undefined() {
164 Some(match FromJSValConvertible::from_jsval(cx.raw_cx(), rval.handle(), ConversionBehavior::Default) {
165 Ok(ConversionResult::Success(value)) => value,
166 Ok(ConversionResult::Failure(error)) => {
167 throw_type_error(cx.raw_cx(), &error);
168 return Err(());
169
170 }
171 _ => {
172 return Err(());
173
174 },
175 }
176 )
177 } else {
178 None
179 }
180 },
181 negotiated: {
182 rooted!(&in(cx) let mut rval = UndefinedValue());
183 if get_dictionary_property(cx.raw_cx(), object.handle(), "negotiated", rval.handle_mut(), can_gc)? && !rval.is_undefined() {
184 match FromJSValConvertible::from_jsval(cx.raw_cx(), rval.handle(), ()) {
185 Ok(ConversionResult::Success(value)) => value,
186 Ok(ConversionResult::Failure(error)) => {
187 throw_type_error(cx.raw_cx(), &error);
188 return Err(());
189
190 }
191 _ => {
192 return Err(());
193
194 },
195 }
196
197 } else {
198 false
199 }
200 },
201 ordered: {
202 rooted!(&in(cx) let mut rval = UndefinedValue());
203 if get_dictionary_property(cx.raw_cx(), object.handle(), "ordered", rval.handle_mut(), can_gc)? && !rval.is_undefined() {
204 match FromJSValConvertible::from_jsval(cx.raw_cx(), rval.handle(), ()) {
205 Ok(ConversionResult::Success(value)) => value,
206 Ok(ConversionResult::Failure(error)) => {
207 throw_type_error(cx.raw_cx(), &error);
208 return Err(());
209
210 }
211 _ => {
212 return Err(());
213
214 },
215 }
216
217 } else {
218 true
219 }
220 },
221 protocol: {
222 rooted!(&in(cx) let mut rval = UndefinedValue());
223 if get_dictionary_property(cx.raw_cx(), object.handle(), "protocol", rval.handle_mut(), can_gc)? && !rval.is_undefined() {
224 match FromJSValConvertible::from_jsval(cx.raw_cx(), rval.handle(), ()) {
225 Ok(ConversionResult::Success(value)) => value,
226 Ok(ConversionResult::Failure(error)) => {
227 throw_type_error(cx.raw_cx(), &error);
228 return Err(());
229
230 }
231 _ => {
232 return Err(());
233
234 },
235 }
236
237 } else {
238 USVString("".to_owned())
239 }
240 },
241 };
242 Ok(ConversionResult::Success(dictionary))
243 }
244 }
245}
246
247impl FromJSValConvertible for RTCDataChannelInit {
248 type Config = ();
249 unsafe fn from_jsval(cx: *mut RawJSContext, value: HandleValue, _option: ())
250 -> Result<ConversionResult<RTCDataChannelInit>, ()> {
251 RTCDataChannelInit::new(SafeJSContext::from_ptr(cx), value, CanGc::note())
252 }
253}
254
255impl RTCDataChannelInit {
256 #[allow(clippy::wrong_self_convention)]
257 pub unsafe fn to_jsobject(&self, cx: *mut RawJSContext, mut obj: MutableHandleObject) {
258 if let Some(ref id) = self.id {
259 rooted!(in(cx) let mut id_js = UndefinedValue());
260 id.to_jsval(cx, id_js.handle_mut());
261 set_dictionary_property(SafeJSContext::from_ptr(cx), obj.handle(), "id", id_js.handle()).unwrap();
262 }
263 if let Some(ref maxPacketLifeTime) = self.maxPacketLifeTime {
264 rooted!(in(cx) let mut maxPacketLifeTime_js = UndefinedValue());
265 maxPacketLifeTime.to_jsval(cx, maxPacketLifeTime_js.handle_mut());
266 set_dictionary_property(SafeJSContext::from_ptr(cx), obj.handle(), "maxPacketLifeTime", maxPacketLifeTime_js.handle()).unwrap();
267 }
268 if let Some(ref maxRetransmits) = self.maxRetransmits {
269 rooted!(in(cx) let mut maxRetransmits_js = UndefinedValue());
270 maxRetransmits.to_jsval(cx, maxRetransmits_js.handle_mut());
271 set_dictionary_property(SafeJSContext::from_ptr(cx), obj.handle(), "maxRetransmits", maxRetransmits_js.handle()).unwrap();
272 }
273 let negotiated = &self.negotiated;
274 rooted!(in(cx) let mut negotiated_js = UndefinedValue());
275 negotiated.to_jsval(cx, negotiated_js.handle_mut());
276 set_dictionary_property(SafeJSContext::from_ptr(cx), obj.handle(), "negotiated", negotiated_js.handle()).unwrap();
277 let ordered = &self.ordered;
278 rooted!(in(cx) let mut ordered_js = UndefinedValue());
279 ordered.to_jsval(cx, ordered_js.handle_mut());
280 set_dictionary_property(SafeJSContext::from_ptr(cx), obj.handle(), "ordered", ordered_js.handle()).unwrap();
281 let protocol = &self.protocol;
282 rooted!(in(cx) let mut protocol_js = UndefinedValue());
283 protocol.to_jsval(cx, protocol_js.handle_mut());
284 set_dictionary_property(SafeJSContext::from_ptr(cx), obj.handle(), "protocol", protocol_js.handle()).unwrap();
285 }
286}
287
288impl ToJSValConvertible for RTCDataChannelInit {
289 unsafe fn to_jsval(&self, cx: *mut RawJSContext, mut rval: MutableHandleValue) {
290 rooted!(in(cx) let mut obj = JS_NewObject(cx, ptr::null()));
291 self.to_jsobject(cx, obj.handle_mut());
292 rval.set(ObjectOrNullValue(obj.get()))
293 }
294}
295
296
297pub use self::RTCDataChannel_Binding::{Wrap, RTCDataChannelMethods, GetProtoObject, DefineDOMInterface};
298pub mod RTCDataChannel_Binding {
299use crate::codegen::GenericBindings::EventHandlerBinding::EventHandlerNonNull;
300use crate::codegen::GenericBindings::EventTargetBinding::EventTarget_Binding;
301use crate::codegen::GenericBindings::RTCDataChannelBinding::RTCDataChannelState;
302use crate::codegen::GenericBindings::RTCDataChannelBinding::RTCDataChannelStateValues;
303use crate::import::module::*;
304
305unsafe extern "C" fn get_label<D: DomTypes>
306(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool{
307 let mut result = false;
308 wrap_panic(&mut || result = (|| {
309 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
310 let this = &*(this as *const D::RTCDataChannel);
311 let result: USVString = this.Label();
312
313 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
314 return true;
315 })());
316 result
317}
318
319
320static label_getterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
321
322pub(crate) fn init_label_getterinfo<D: DomTypes>() {
323 label_getterinfo.set(JSJitInfo {
324 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
325 getter: Some(get_label::<D>)
326 },
327 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
328 protoID: PrototypeList::ID::RTCDataChannel as u16,
329 },
330 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 1 },
331 _bitfield_align_1: [],
332 _bitfield_1: __BindgenBitfieldUnit::new(
333 new_jsjitinfo_bitfield_1!(
334 JSJitInfo_OpType::Getter as u8,
335 JSJitInfo_AliasSet::AliasEverything as u8,
336 JSValueType::JSVAL_TYPE_STRING as u8,
337 true,
338 false,
339 false,
340 false,
341 false,
342 false,
343 0,
344 ).to_ne_bytes()
345 ),
346});
347}
348unsafe extern "C" fn get_ordered<D: DomTypes>
349(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool{
350 let mut result = false;
351 wrap_panic(&mut || result = (|| {
352 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
353 let this = &*(this as *const D::RTCDataChannel);
354 let result: bool = this.Ordered();
355
356 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
357 return true;
358 })());
359 result
360}
361
362
363static ordered_getterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
364
365pub(crate) fn init_ordered_getterinfo<D: DomTypes>() {
366 ordered_getterinfo.set(JSJitInfo {
367 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
368 getter: Some(get_ordered::<D>)
369 },
370 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
371 protoID: PrototypeList::ID::RTCDataChannel as u16,
372 },
373 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 1 },
374 _bitfield_align_1: [],
375 _bitfield_1: __BindgenBitfieldUnit::new(
376 new_jsjitinfo_bitfield_1!(
377 JSJitInfo_OpType::Getter as u8,
378 JSJitInfo_AliasSet::AliasEverything as u8,
379 JSValueType::JSVAL_TYPE_BOOLEAN as u8,
380 true,
381 false,
382 false,
383 false,
384 false,
385 false,
386 0,
387 ).to_ne_bytes()
388 ),
389});
390}
391unsafe extern "C" fn get_maxPacketLifeTime<D: DomTypes>
392(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool{
393 let mut result = false;
394 wrap_panic(&mut || result = (|| {
395 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
396 let this = &*(this as *const D::RTCDataChannel);
397 let result: Option<u16> = this.GetMaxPacketLifeTime();
398
399 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
400 return true;
401 })());
402 result
403}
404
405
406static maxPacketLifeTime_getterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
407
408pub(crate) fn init_maxPacketLifeTime_getterinfo<D: DomTypes>() {
409 maxPacketLifeTime_getterinfo.set(JSJitInfo {
410 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
411 getter: Some(get_maxPacketLifeTime::<D>)
412 },
413 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
414 protoID: PrototypeList::ID::RTCDataChannel as u16,
415 },
416 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 1 },
417 _bitfield_align_1: [],
418 _bitfield_1: __BindgenBitfieldUnit::new(
419 new_jsjitinfo_bitfield_1!(
420 JSJitInfo_OpType::Getter as u8,
421 JSJitInfo_AliasSet::AliasEverything as u8,
422 JSValueType::JSVAL_TYPE_UNKNOWN as u8,
423 true,
424 false,
425 false,
426 false,
427 false,
428 false,
429 0,
430 ).to_ne_bytes()
431 ),
432});
433}
434unsafe extern "C" fn get_maxRetransmits<D: DomTypes>
435(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool{
436 let mut result = false;
437 wrap_panic(&mut || result = (|| {
438 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
439 let this = &*(this as *const D::RTCDataChannel);
440 let result: Option<u16> = this.GetMaxRetransmits();
441
442 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
443 return true;
444 })());
445 result
446}
447
448
449static maxRetransmits_getterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
450
451pub(crate) fn init_maxRetransmits_getterinfo<D: DomTypes>() {
452 maxRetransmits_getterinfo.set(JSJitInfo {
453 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
454 getter: Some(get_maxRetransmits::<D>)
455 },
456 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
457 protoID: PrototypeList::ID::RTCDataChannel as u16,
458 },
459 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 1 },
460 _bitfield_align_1: [],
461 _bitfield_1: __BindgenBitfieldUnit::new(
462 new_jsjitinfo_bitfield_1!(
463 JSJitInfo_OpType::Getter as u8,
464 JSJitInfo_AliasSet::AliasEverything as u8,
465 JSValueType::JSVAL_TYPE_UNKNOWN as u8,
466 true,
467 false,
468 false,
469 false,
470 false,
471 false,
472 0,
473 ).to_ne_bytes()
474 ),
475});
476}
477unsafe extern "C" fn get_protocol<D: DomTypes>
478(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool{
479 let mut result = false;
480 wrap_panic(&mut || result = (|| {
481 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
482 let this = &*(this as *const D::RTCDataChannel);
483 let result: USVString = this.Protocol();
484
485 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
486 return true;
487 })());
488 result
489}
490
491
492static protocol_getterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
493
494pub(crate) fn init_protocol_getterinfo<D: DomTypes>() {
495 protocol_getterinfo.set(JSJitInfo {
496 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
497 getter: Some(get_protocol::<D>)
498 },
499 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
500 protoID: PrototypeList::ID::RTCDataChannel as u16,
501 },
502 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 1 },
503 _bitfield_align_1: [],
504 _bitfield_1: __BindgenBitfieldUnit::new(
505 new_jsjitinfo_bitfield_1!(
506 JSJitInfo_OpType::Getter as u8,
507 JSJitInfo_AliasSet::AliasEverything as u8,
508 JSValueType::JSVAL_TYPE_STRING as u8,
509 true,
510 false,
511 false,
512 false,
513 false,
514 false,
515 0,
516 ).to_ne_bytes()
517 ),
518});
519}
520unsafe extern "C" fn get_negotiated<D: DomTypes>
521(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool{
522 let mut result = false;
523 wrap_panic(&mut || result = (|| {
524 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
525 let this = &*(this as *const D::RTCDataChannel);
526 let result: bool = this.Negotiated();
527
528 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
529 return true;
530 })());
531 result
532}
533
534
535static negotiated_getterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
536
537pub(crate) fn init_negotiated_getterinfo<D: DomTypes>() {
538 negotiated_getterinfo.set(JSJitInfo {
539 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
540 getter: Some(get_negotiated::<D>)
541 },
542 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
543 protoID: PrototypeList::ID::RTCDataChannel as u16,
544 },
545 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 1 },
546 _bitfield_align_1: [],
547 _bitfield_1: __BindgenBitfieldUnit::new(
548 new_jsjitinfo_bitfield_1!(
549 JSJitInfo_OpType::Getter as u8,
550 JSJitInfo_AliasSet::AliasEverything as u8,
551 JSValueType::JSVAL_TYPE_BOOLEAN as u8,
552 true,
553 false,
554 false,
555 false,
556 false,
557 false,
558 0,
559 ).to_ne_bytes()
560 ),
561});
562}
563unsafe extern "C" fn get_id<D: DomTypes>
564(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool{
565 let mut result = false;
566 wrap_panic(&mut || result = (|| {
567 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
568 let this = &*(this as *const D::RTCDataChannel);
569 let result: Option<u16> = this.GetId();
570
571 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
572 return true;
573 })());
574 result
575}
576
577
578static id_getterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
579
580pub(crate) fn init_id_getterinfo<D: DomTypes>() {
581 id_getterinfo.set(JSJitInfo {
582 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
583 getter: Some(get_id::<D>)
584 },
585 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
586 protoID: PrototypeList::ID::RTCDataChannel as u16,
587 },
588 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 1 },
589 _bitfield_align_1: [],
590 _bitfield_1: __BindgenBitfieldUnit::new(
591 new_jsjitinfo_bitfield_1!(
592 JSJitInfo_OpType::Getter as u8,
593 JSJitInfo_AliasSet::AliasEverything as u8,
594 JSValueType::JSVAL_TYPE_UNKNOWN as u8,
595 true,
596 false,
597 false,
598 false,
599 false,
600 false,
601 0,
602 ).to_ne_bytes()
603 ),
604});
605}
606unsafe extern "C" fn get_readyState<D: DomTypes>
607(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool{
608 let mut result = false;
609 wrap_panic(&mut || result = (|| {
610 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
611 let this = &*(this as *const D::RTCDataChannel);
612 let result: RTCDataChannelState = this.ReadyState();
613
614 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
615 return true;
616 })());
617 result
618}
619
620
621static readyState_getterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
622
623pub(crate) fn init_readyState_getterinfo<D: DomTypes>() {
624 readyState_getterinfo.set(JSJitInfo {
625 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
626 getter: Some(get_readyState::<D>)
627 },
628 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
629 protoID: PrototypeList::ID::RTCDataChannel as u16,
630 },
631 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 1 },
632 _bitfield_align_1: [],
633 _bitfield_1: __BindgenBitfieldUnit::new(
634 new_jsjitinfo_bitfield_1!(
635 JSJitInfo_OpType::Getter as u8,
636 JSJitInfo_AliasSet::AliasEverything as u8,
637 JSValueType::JSVAL_TYPE_STRING as u8,
638 true,
639 false,
640 false,
641 false,
642 false,
643 false,
644 0,
645 ).to_ne_bytes()
646 ),
647});
648}
649unsafe extern "C" fn get_onopen<D: DomTypes>
650(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool{
651 let mut result = false;
652 wrap_panic(&mut || result = (|| {
653 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
654 let this = &*(this as *const D::RTCDataChannel);
655 let result: Option<Rc<crate::codegen::GenericBindings::EventHandlerBinding::EventHandlerNonNull<D>>> = this.GetOnopen();
656
657 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
658 return true;
659 })());
660 result
661}
662
663unsafe extern "C" fn set_onopen<D: DomTypes>
664(cx: *mut RawJSContext, obj: RawHandleObject, this: *mut libc::c_void, args: JSJitSetterCallArgs) -> bool{
665 let mut result = false;
666 wrap_panic(&mut || result = {
667 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
668 let this = &*(this as *const D::RTCDataChannel);
669 let arg0: Option<Rc<EventHandlerNonNull<D>>> = if HandleValue::from_raw(args.get(0)).get().is_object() {
670 Some(EventHandlerNonNull::<D>::new(SafeJSContext::from_ptr(cx.raw_cx()), HandleValue::from_raw(args.get(0)).get().to_object()))
671 } else {
672 None
673 };
674 let result: () = this.SetOnopen(arg0);
675
676 true
677 });
678 result
679}
680
681
682static onopen_getterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
683
684pub(crate) fn init_onopen_getterinfo<D: DomTypes>() {
685 onopen_getterinfo.set(JSJitInfo {
686 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
687 getter: Some(get_onopen::<D>)
688 },
689 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
690 protoID: PrototypeList::ID::RTCDataChannel as u16,
691 },
692 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 1 },
693 _bitfield_align_1: [],
694 _bitfield_1: __BindgenBitfieldUnit::new(
695 new_jsjitinfo_bitfield_1!(
696 JSJitInfo_OpType::Getter as u8,
697 JSJitInfo_AliasSet::AliasEverything as u8,
698 JSValueType::JSVAL_TYPE_UNKNOWN as u8,
699 true,
700 false,
701 false,
702 false,
703 false,
704 false,
705 0,
706 ).to_ne_bytes()
707 ),
708});
709}
710static onopen_setterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
711
712pub(crate) fn init_onopen_setterinfo<D: DomTypes>() {
713 onopen_setterinfo.set(JSJitInfo {
714 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
715 setter: Some(set_onopen::<D>)
716 },
717 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
718 protoID: PrototypeList::ID::RTCDataChannel as u16,
719 },
720 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 1 },
721 _bitfield_align_1: [],
722 _bitfield_1: __BindgenBitfieldUnit::new(
723 new_jsjitinfo_bitfield_1!(
724 JSJitInfo_OpType::Setter as u8,
725 JSJitInfo_AliasSet::AliasEverything as u8,
726 JSValueType::JSVAL_TYPE_UNDEFINED as u8,
727 false,
728 false,
729 false,
730 false,
731 false,
732 false,
733 0,
734 ).to_ne_bytes()
735 ),
736});
737}
738unsafe extern "C" fn get_onbufferedamountlow<D: DomTypes>
739(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool{
740 let mut result = false;
741 wrap_panic(&mut || result = (|| {
742 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
743 let this = &*(this as *const D::RTCDataChannel);
744 let result: Option<Rc<crate::codegen::GenericBindings::EventHandlerBinding::EventHandlerNonNull<D>>> = this.GetOnbufferedamountlow();
745
746 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
747 return true;
748 })());
749 result
750}
751
752unsafe extern "C" fn set_onbufferedamountlow<D: DomTypes>
753(cx: *mut RawJSContext, obj: RawHandleObject, this: *mut libc::c_void, args: JSJitSetterCallArgs) -> bool{
754 let mut result = false;
755 wrap_panic(&mut || result = {
756 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
757 let this = &*(this as *const D::RTCDataChannel);
758 let arg0: Option<Rc<EventHandlerNonNull<D>>> = if HandleValue::from_raw(args.get(0)).get().is_object() {
759 Some(EventHandlerNonNull::<D>::new(SafeJSContext::from_ptr(cx.raw_cx()), HandleValue::from_raw(args.get(0)).get().to_object()))
760 } else {
761 None
762 };
763 let result: () = this.SetOnbufferedamountlow(arg0);
764
765 true
766 });
767 result
768}
769
770
771static onbufferedamountlow_getterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
772
773pub(crate) fn init_onbufferedamountlow_getterinfo<D: DomTypes>() {
774 onbufferedamountlow_getterinfo.set(JSJitInfo {
775 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
776 getter: Some(get_onbufferedamountlow::<D>)
777 },
778 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
779 protoID: PrototypeList::ID::RTCDataChannel as u16,
780 },
781 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 1 },
782 _bitfield_align_1: [],
783 _bitfield_1: __BindgenBitfieldUnit::new(
784 new_jsjitinfo_bitfield_1!(
785 JSJitInfo_OpType::Getter as u8,
786 JSJitInfo_AliasSet::AliasEverything as u8,
787 JSValueType::JSVAL_TYPE_UNKNOWN as u8,
788 true,
789 false,
790 false,
791 false,
792 false,
793 false,
794 0,
795 ).to_ne_bytes()
796 ),
797});
798}
799static onbufferedamountlow_setterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
800
801pub(crate) fn init_onbufferedamountlow_setterinfo<D: DomTypes>() {
802 onbufferedamountlow_setterinfo.set(JSJitInfo {
803 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
804 setter: Some(set_onbufferedamountlow::<D>)
805 },
806 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
807 protoID: PrototypeList::ID::RTCDataChannel as u16,
808 },
809 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 1 },
810 _bitfield_align_1: [],
811 _bitfield_1: __BindgenBitfieldUnit::new(
812 new_jsjitinfo_bitfield_1!(
813 JSJitInfo_OpType::Setter as u8,
814 JSJitInfo_AliasSet::AliasEverything as u8,
815 JSValueType::JSVAL_TYPE_UNDEFINED as u8,
816 false,
817 false,
818 false,
819 false,
820 false,
821 false,
822 0,
823 ).to_ne_bytes()
824 ),
825});
826}
827unsafe extern "C" fn get_onerror<D: DomTypes>
828(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool{
829 let mut result = false;
830 wrap_panic(&mut || result = (|| {
831 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
832 let this = &*(this as *const D::RTCDataChannel);
833 let result: Option<Rc<crate::codegen::GenericBindings::EventHandlerBinding::EventHandlerNonNull<D>>> = this.GetOnerror();
834
835 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
836 return true;
837 })());
838 result
839}
840
841unsafe extern "C" fn set_onerror<D: DomTypes>
842(cx: *mut RawJSContext, obj: RawHandleObject, this: *mut libc::c_void, args: JSJitSetterCallArgs) -> bool{
843 let mut result = false;
844 wrap_panic(&mut || result = {
845 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
846 let this = &*(this as *const D::RTCDataChannel);
847 let arg0: Option<Rc<EventHandlerNonNull<D>>> = if HandleValue::from_raw(args.get(0)).get().is_object() {
848 Some(EventHandlerNonNull::<D>::new(SafeJSContext::from_ptr(cx.raw_cx()), HandleValue::from_raw(args.get(0)).get().to_object()))
849 } else {
850 None
851 };
852 let result: () = this.SetOnerror(arg0);
853
854 true
855 });
856 result
857}
858
859
860static onerror_getterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
861
862pub(crate) fn init_onerror_getterinfo<D: DomTypes>() {
863 onerror_getterinfo.set(JSJitInfo {
864 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
865 getter: Some(get_onerror::<D>)
866 },
867 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
868 protoID: PrototypeList::ID::RTCDataChannel as u16,
869 },
870 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 1 },
871 _bitfield_align_1: [],
872 _bitfield_1: __BindgenBitfieldUnit::new(
873 new_jsjitinfo_bitfield_1!(
874 JSJitInfo_OpType::Getter as u8,
875 JSJitInfo_AliasSet::AliasEverything as u8,
876 JSValueType::JSVAL_TYPE_UNKNOWN as u8,
877 true,
878 false,
879 false,
880 false,
881 false,
882 false,
883 0,
884 ).to_ne_bytes()
885 ),
886});
887}
888static onerror_setterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
889
890pub(crate) fn init_onerror_setterinfo<D: DomTypes>() {
891 onerror_setterinfo.set(JSJitInfo {
892 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
893 setter: Some(set_onerror::<D>)
894 },
895 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
896 protoID: PrototypeList::ID::RTCDataChannel as u16,
897 },
898 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 1 },
899 _bitfield_align_1: [],
900 _bitfield_1: __BindgenBitfieldUnit::new(
901 new_jsjitinfo_bitfield_1!(
902 JSJitInfo_OpType::Setter as u8,
903 JSJitInfo_AliasSet::AliasEverything as u8,
904 JSValueType::JSVAL_TYPE_UNDEFINED as u8,
905 false,
906 false,
907 false,
908 false,
909 false,
910 false,
911 0,
912 ).to_ne_bytes()
913 ),
914});
915}
916unsafe extern "C" fn get_onclosing<D: DomTypes>
917(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool{
918 let mut result = false;
919 wrap_panic(&mut || result = (|| {
920 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
921 let this = &*(this as *const D::RTCDataChannel);
922 let result: Option<Rc<crate::codegen::GenericBindings::EventHandlerBinding::EventHandlerNonNull<D>>> = this.GetOnclosing();
923
924 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
925 return true;
926 })());
927 result
928}
929
930unsafe extern "C" fn set_onclosing<D: DomTypes>
931(cx: *mut RawJSContext, obj: RawHandleObject, this: *mut libc::c_void, args: JSJitSetterCallArgs) -> bool{
932 let mut result = false;
933 wrap_panic(&mut || result = {
934 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
935 let this = &*(this as *const D::RTCDataChannel);
936 let arg0: Option<Rc<EventHandlerNonNull<D>>> = if HandleValue::from_raw(args.get(0)).get().is_object() {
937 Some(EventHandlerNonNull::<D>::new(SafeJSContext::from_ptr(cx.raw_cx()), HandleValue::from_raw(args.get(0)).get().to_object()))
938 } else {
939 None
940 };
941 let result: () = this.SetOnclosing(arg0);
942
943 true
944 });
945 result
946}
947
948
949static onclosing_getterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
950
951pub(crate) fn init_onclosing_getterinfo<D: DomTypes>() {
952 onclosing_getterinfo.set(JSJitInfo {
953 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
954 getter: Some(get_onclosing::<D>)
955 },
956 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
957 protoID: PrototypeList::ID::RTCDataChannel as u16,
958 },
959 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 1 },
960 _bitfield_align_1: [],
961 _bitfield_1: __BindgenBitfieldUnit::new(
962 new_jsjitinfo_bitfield_1!(
963 JSJitInfo_OpType::Getter as u8,
964 JSJitInfo_AliasSet::AliasEverything as u8,
965 JSValueType::JSVAL_TYPE_UNKNOWN as u8,
966 true,
967 false,
968 false,
969 false,
970 false,
971 false,
972 0,
973 ).to_ne_bytes()
974 ),
975});
976}
977static onclosing_setterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
978
979pub(crate) fn init_onclosing_setterinfo<D: DomTypes>() {
980 onclosing_setterinfo.set(JSJitInfo {
981 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
982 setter: Some(set_onclosing::<D>)
983 },
984 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
985 protoID: PrototypeList::ID::RTCDataChannel as u16,
986 },
987 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 1 },
988 _bitfield_align_1: [],
989 _bitfield_1: __BindgenBitfieldUnit::new(
990 new_jsjitinfo_bitfield_1!(
991 JSJitInfo_OpType::Setter as u8,
992 JSJitInfo_AliasSet::AliasEverything as u8,
993 JSValueType::JSVAL_TYPE_UNDEFINED as u8,
994 false,
995 false,
996 false,
997 false,
998 false,
999 false,
1000 0,
1001 ).to_ne_bytes()
1002 ),
1003});
1004}
1005unsafe extern "C" fn get_onclose<D: DomTypes>
1006(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool{
1007 let mut result = false;
1008 wrap_panic(&mut || result = (|| {
1009 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
1010 let this = &*(this as *const D::RTCDataChannel);
1011 let result: Option<Rc<crate::codegen::GenericBindings::EventHandlerBinding::EventHandlerNonNull<D>>> = this.GetOnclose();
1012
1013 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
1014 return true;
1015 })());
1016 result
1017}
1018
1019unsafe extern "C" fn set_onclose<D: DomTypes>
1020(cx: *mut RawJSContext, obj: RawHandleObject, this: *mut libc::c_void, args: JSJitSetterCallArgs) -> bool{
1021 let mut result = false;
1022 wrap_panic(&mut || result = {
1023 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
1024 let this = &*(this as *const D::RTCDataChannel);
1025 let arg0: Option<Rc<EventHandlerNonNull<D>>> = if HandleValue::from_raw(args.get(0)).get().is_object() {
1026 Some(EventHandlerNonNull::<D>::new(SafeJSContext::from_ptr(cx.raw_cx()), HandleValue::from_raw(args.get(0)).get().to_object()))
1027 } else {
1028 None
1029 };
1030 let result: () = this.SetOnclose(arg0);
1031
1032 true
1033 });
1034 result
1035}
1036
1037
1038static onclose_getterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
1039
1040pub(crate) fn init_onclose_getterinfo<D: DomTypes>() {
1041 onclose_getterinfo.set(JSJitInfo {
1042 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
1043 getter: Some(get_onclose::<D>)
1044 },
1045 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
1046 protoID: PrototypeList::ID::RTCDataChannel as u16,
1047 },
1048 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 1 },
1049 _bitfield_align_1: [],
1050 _bitfield_1: __BindgenBitfieldUnit::new(
1051 new_jsjitinfo_bitfield_1!(
1052 JSJitInfo_OpType::Getter as u8,
1053 JSJitInfo_AliasSet::AliasEverything as u8,
1054 JSValueType::JSVAL_TYPE_UNKNOWN as u8,
1055 true,
1056 false,
1057 false,
1058 false,
1059 false,
1060 false,
1061 0,
1062 ).to_ne_bytes()
1063 ),
1064});
1065}
1066static onclose_setterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
1067
1068pub(crate) fn init_onclose_setterinfo<D: DomTypes>() {
1069 onclose_setterinfo.set(JSJitInfo {
1070 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
1071 setter: Some(set_onclose::<D>)
1072 },
1073 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
1074 protoID: PrototypeList::ID::RTCDataChannel as u16,
1075 },
1076 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 1 },
1077 _bitfield_align_1: [],
1078 _bitfield_1: __BindgenBitfieldUnit::new(
1079 new_jsjitinfo_bitfield_1!(
1080 JSJitInfo_OpType::Setter as u8,
1081 JSJitInfo_AliasSet::AliasEverything as u8,
1082 JSValueType::JSVAL_TYPE_UNDEFINED as u8,
1083 false,
1084 false,
1085 false,
1086 false,
1087 false,
1088 false,
1089 0,
1090 ).to_ne_bytes()
1091 ),
1092});
1093}
1094unsafe extern "C" fn close<D: DomTypes>
1095(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool{
1096 let mut result = false;
1097 wrap_panic(&mut || result = (|| {
1098 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
1099 let this = &*(this as *const D::RTCDataChannel);
1100 let args = &*args;
1101 let argc = args.argc_;
1102 let result: () = this.Close();
1103
1104 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
1105 return true;
1106 })());
1107 result
1108}
1109
1110
1111static close_methodinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
1112
1113pub(crate) fn init_close_methodinfo<D: DomTypes>() {
1114 close_methodinfo.set(JSJitInfo {
1115 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
1116 method: Some(close::<D>)
1117 },
1118 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
1119 protoID: PrototypeList::ID::RTCDataChannel as u16,
1120 },
1121 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 1 },
1122 _bitfield_align_1: [],
1123 _bitfield_1: __BindgenBitfieldUnit::new(
1124 new_jsjitinfo_bitfield_1!(
1125 JSJitInfo_OpType::Method as u8,
1126 JSJitInfo_AliasSet::AliasEverything as u8,
1127 JSValueType::JSVAL_TYPE_UNDEFINED as u8,
1128 true,
1129 false,
1130 false,
1131 false,
1132 false,
1133 false,
1134 0,
1135 ).to_ne_bytes()
1136 ),
1137});
1138}
1139unsafe extern "C" fn get_onmessage<D: DomTypes>
1140(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool{
1141 let mut result = false;
1142 wrap_panic(&mut || result = (|| {
1143 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
1144 let this = &*(this as *const D::RTCDataChannel);
1145 let result: Option<Rc<crate::codegen::GenericBindings::EventHandlerBinding::EventHandlerNonNull<D>>> = this.GetOnmessage();
1146
1147 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
1148 return true;
1149 })());
1150 result
1151}
1152
1153unsafe extern "C" fn set_onmessage<D: DomTypes>
1154(cx: *mut RawJSContext, obj: RawHandleObject, this: *mut libc::c_void, args: JSJitSetterCallArgs) -> bool{
1155 let mut result = false;
1156 wrap_panic(&mut || result = {
1157 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
1158 let this = &*(this as *const D::RTCDataChannel);
1159 let arg0: Option<Rc<EventHandlerNonNull<D>>> = if HandleValue::from_raw(args.get(0)).get().is_object() {
1160 Some(EventHandlerNonNull::<D>::new(SafeJSContext::from_ptr(cx.raw_cx()), HandleValue::from_raw(args.get(0)).get().to_object()))
1161 } else {
1162 None
1163 };
1164 let result: () = this.SetOnmessage(arg0);
1165
1166 true
1167 });
1168 result
1169}
1170
1171
1172static onmessage_getterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
1173
1174pub(crate) fn init_onmessage_getterinfo<D: DomTypes>() {
1175 onmessage_getterinfo.set(JSJitInfo {
1176 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
1177 getter: Some(get_onmessage::<D>)
1178 },
1179 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
1180 protoID: PrototypeList::ID::RTCDataChannel as u16,
1181 },
1182 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 1 },
1183 _bitfield_align_1: [],
1184 _bitfield_1: __BindgenBitfieldUnit::new(
1185 new_jsjitinfo_bitfield_1!(
1186 JSJitInfo_OpType::Getter as u8,
1187 JSJitInfo_AliasSet::AliasEverything as u8,
1188 JSValueType::JSVAL_TYPE_UNKNOWN as u8,
1189 true,
1190 false,
1191 false,
1192 false,
1193 false,
1194 false,
1195 0,
1196 ).to_ne_bytes()
1197 ),
1198});
1199}
1200static onmessage_setterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
1201
1202pub(crate) fn init_onmessage_setterinfo<D: DomTypes>() {
1203 onmessage_setterinfo.set(JSJitInfo {
1204 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
1205 setter: Some(set_onmessage::<D>)
1206 },
1207 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
1208 protoID: PrototypeList::ID::RTCDataChannel as u16,
1209 },
1210 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 1 },
1211 _bitfield_align_1: [],
1212 _bitfield_1: __BindgenBitfieldUnit::new(
1213 new_jsjitinfo_bitfield_1!(
1214 JSJitInfo_OpType::Setter as u8,
1215 JSJitInfo_AliasSet::AliasEverything as u8,
1216 JSValueType::JSVAL_TYPE_UNDEFINED as u8,
1217 false,
1218 false,
1219 false,
1220 false,
1221 false,
1222 false,
1223 0,
1224 ).to_ne_bytes()
1225 ),
1226});
1227}
1228unsafe extern "C" fn get_binaryType<D: DomTypes>
1229(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool{
1230 let mut result = false;
1231 wrap_panic(&mut || result = (|| {
1232 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
1233 let this = &*(this as *const D::RTCDataChannel);
1234 let result: DOMString = this.BinaryType();
1235
1236 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
1237 return true;
1238 })());
1239 result
1240}
1241
1242unsafe extern "C" fn set_binaryType<D: DomTypes>
1243(cx: *mut RawJSContext, obj: RawHandleObject, this: *mut libc::c_void, args: JSJitSetterCallArgs) -> bool{
1244 let mut result = false;
1245 wrap_panic(&mut || result = (|| {
1246 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
1247 let this = &*(this as *const D::RTCDataChannel);
1248 let arg0: DOMString = match FromJSValConvertible::from_jsval(cx.raw_cx(), HandleValue::from_raw(args.get(0)), StringificationBehavior::Default) {
1249 Ok(ConversionResult::Success(value)) => value,
1250 Ok(ConversionResult::Failure(error)) => {
1251 throw_type_error(cx.raw_cx(), &error);
1252 return false;
1253
1254 }
1255 _ => {
1256 return false;
1257
1258 },
1259 }
1260 ;
1261 let result: Result<(), Error> = this.SetBinaryType(arg0);
1262 let result = match result {
1263 Ok(result) => result,
1264 Err(e) => {
1265 <D as DomHelpers<D>>::throw_dom_exception(SafeJSContext::from_ptr(cx.raw_cx()), &this.global_(InRealm::already(&AlreadyInRealm::assert_for_cx(SafeJSContext::from_ptr(cx.raw_cx())))), e, CanGc::note());
1266 return false;
1267 },
1268 };
1269
1270 true
1271 })());
1272 result
1273}
1274
1275
1276static binaryType_getterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
1277
1278pub(crate) fn init_binaryType_getterinfo<D: DomTypes>() {
1279 binaryType_getterinfo.set(JSJitInfo {
1280 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
1281 getter: Some(get_binaryType::<D>)
1282 },
1283 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
1284 protoID: PrototypeList::ID::RTCDataChannel as u16,
1285 },
1286 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 1 },
1287 _bitfield_align_1: [],
1288 _bitfield_1: __BindgenBitfieldUnit::new(
1289 new_jsjitinfo_bitfield_1!(
1290 JSJitInfo_OpType::Getter as u8,
1291 JSJitInfo_AliasSet::AliasEverything as u8,
1292 JSValueType::JSVAL_TYPE_STRING as u8,
1293 true,
1294 false,
1295 false,
1296 false,
1297 false,
1298 false,
1299 0,
1300 ).to_ne_bytes()
1301 ),
1302});
1303}
1304static binaryType_setterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
1305
1306pub(crate) fn init_binaryType_setterinfo<D: DomTypes>() {
1307 binaryType_setterinfo.set(JSJitInfo {
1308 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
1309 setter: Some(set_binaryType::<D>)
1310 },
1311 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
1312 protoID: PrototypeList::ID::RTCDataChannel as u16,
1313 },
1314 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 1 },
1315 _bitfield_align_1: [],
1316 _bitfield_1: __BindgenBitfieldUnit::new(
1317 new_jsjitinfo_bitfield_1!(
1318 JSJitInfo_OpType::Setter as u8,
1319 JSJitInfo_AliasSet::AliasEverything as u8,
1320 JSValueType::JSVAL_TYPE_UNDEFINED as u8,
1321 false,
1322 false,
1323 false,
1324 false,
1325 false,
1326 false,
1327 0,
1328 ).to_ne_bytes()
1329 ),
1330});
1331}
1332unsafe extern "C" fn send<D: DomTypes>
1333(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool{
1334 let mut result = false;
1335 wrap_panic(&mut || result = (|| {
1336 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
1337 let this = &*(this as *const D::RTCDataChannel);
1338 let args = &*args;
1339 let argc = args.argc_;
1340
1341 let argcount = cmp::min(argc, 1);
1342 match argcount {
1343 1 => {
1344 if HandleValue::from_raw(args.get(0)).get().is_object() {
1345 '_block: {
1346 let arg0: DomRoot<D::Blob> = match root_from_handlevalue(HandleValue::from_raw(args.get(0)), SafeJSContext::from_ptr(cx.raw_cx())) {
1347 Ok(val) => val,
1348 Err(()) => {
1349 break '_block;
1350 }
1351 }
1352 ;
1353 let result: Result<(), Error> = this.Send_(&arg0);
1354 let result = match result {
1355 Ok(result) => result,
1356 Err(e) => {
1357 <D as DomHelpers<D>>::throw_dom_exception(SafeJSContext::from_ptr(cx.raw_cx()), &this.global_(InRealm::already(&AlreadyInRealm::assert_for_cx(SafeJSContext::from_ptr(cx.raw_cx())))), e, CanGc::note());
1358 return false;
1359 },
1360 };
1361
1362 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
1363 return true;
1364 }
1365 '_block: {
1366 let arg0: typedarray::ArrayBuffer = match typedarray::ArrayBuffer::from(HandleValue::from_raw(args.get(0)).get().to_object()) {
1367 Ok(val) => val,
1368 Err(()) => {
1369 break '_block;
1370 }
1371 }
1372 ;
1373 auto_root!(&in(cx) let arg0 = arg0);
1374 let result: Result<(), Error> = this.Send__(arg0);
1375 let result = match result {
1376 Ok(result) => result,
1377 Err(e) => {
1378 <D as DomHelpers<D>>::throw_dom_exception(SafeJSContext::from_ptr(cx.raw_cx()), &this.global_(InRealm::already(&AlreadyInRealm::assert_for_cx(SafeJSContext::from_ptr(cx.raw_cx())))), e, CanGc::note());
1379 return false;
1380 },
1381 };
1382
1383 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
1384 return true;
1385 }
1386 '_block: {
1387 let arg0: typedarray::ArrayBufferView = match typedarray::ArrayBufferView::from(HandleValue::from_raw(args.get(0)).get().to_object()) {
1388 Ok(val) => val,
1389 Err(()) => {
1390 break '_block;
1391 }
1392 }
1393 ;
1394 auto_root!(&in(cx) let arg0 = arg0);
1395 let result: Result<(), Error> = this.Send___(arg0);
1396 let result = match result {
1397 Ok(result) => result,
1398 Err(e) => {
1399 <D as DomHelpers<D>>::throw_dom_exception(SafeJSContext::from_ptr(cx.raw_cx()), &this.global_(InRealm::already(&AlreadyInRealm::assert_for_cx(SafeJSContext::from_ptr(cx.raw_cx())))), e, CanGc::note());
1400 return false;
1401 },
1402 };
1403
1404 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
1405 return true;
1406 }
1407 }
1408 let arg0: USVString = match FromJSValConvertible::from_jsval(cx.raw_cx(), HandleValue::from_raw(args.get(0)), ()) {
1409 Ok(ConversionResult::Success(value)) => value,
1410 Ok(ConversionResult::Failure(error)) => {
1411 throw_type_error(cx.raw_cx(), &error);
1412 return false;
1413
1414 }
1415 _ => {
1416 return false;
1417
1418 },
1419 }
1420 ;
1421 let result: Result<(), Error> = this.Send(arg0);
1422 let result = match result {
1423 Ok(result) => result,
1424 Err(e) => {
1425 <D as DomHelpers<D>>::throw_dom_exception(SafeJSContext::from_ptr(cx.raw_cx()), &this.global_(InRealm::already(&AlreadyInRealm::assert_for_cx(SafeJSContext::from_ptr(cx.raw_cx())))), e, CanGc::note());
1426 return false;
1427 },
1428 };
1429
1430 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
1431 return true;
1432 }
1433 _ => {
1434 throw_type_error(cx.raw_cx(), "Not enough arguments to \"RTCDataChannel.send\".");
1435 return false;
1436 }
1437 }
1438 })());
1439 result
1440}
1441
1442
1443static send_methodinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
1444
1445pub(crate) fn init_send_methodinfo<D: DomTypes>() {
1446 send_methodinfo.set(JSJitInfo {
1447 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
1448 method: Some(send::<D>)
1449 },
1450 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
1451 protoID: PrototypeList::ID::RTCDataChannel as u16,
1452 },
1453 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 1 },
1454 _bitfield_align_1: [],
1455 _bitfield_1: __BindgenBitfieldUnit::new(
1456 new_jsjitinfo_bitfield_1!(
1457 JSJitInfo_OpType::Method as u8,
1458 JSJitInfo_AliasSet::AliasEverything as u8,
1459 JSValueType::JSVAL_TYPE_UNDEFINED as u8,
1460 false,
1461 false,
1462 false,
1463 false,
1464 false,
1465 false,
1466 0,
1467 ).to_ne_bytes()
1468 ),
1469});
1470}
1471unsafe extern "C" fn _finalize<D: DomTypes>
1472(_cx: *mut GCContext, obj: *mut JSObject){
1473 wrap_panic(&mut || {
1474
1475 let this = native_from_object_static::<D::RTCDataChannel>(obj).unwrap();
1476 finalize_common(this);
1477 })
1478}
1479
1480unsafe extern "C" fn _trace<D: DomTypes>
1481(trc: *mut JSTracer, obj: *mut JSObject){
1482 wrap_panic(&mut || {
1483
1484 let this = native_from_object_static::<D::RTCDataChannel>(obj).unwrap();
1485 if this.is_null() { return; } (*this).trace(trc);
1487 })
1488}
1489
1490
1491static CLASS_OPS: ThreadUnsafeOnceLock<JSClassOps> = ThreadUnsafeOnceLock::new();
1492
1493pub(crate) fn init_class_ops<D: DomTypes>() {
1494 CLASS_OPS.set(JSClassOps {
1495 addProperty: None,
1496 delProperty: None,
1497 enumerate: None,
1498 newEnumerate: None,
1499 resolve: None,
1500 mayResolve: None,
1501 finalize: Some(_finalize::<D>),
1502 call: None,
1503 construct: None,
1504 trace: Some(_trace::<D>),
1505 });
1506}
1507
1508pub static Class: ThreadUnsafeOnceLock<DOMJSClass> = ThreadUnsafeOnceLock::new();
1509
1510pub(crate) fn init_domjs_class<D: DomTypes>() {
1511 init_class_ops::<D>();
1512 Class.set(DOMJSClass {
1513 base: JSClass {
1514 name: c"RTCDataChannel".as_ptr(),
1515 flags: JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE |
1516 (((1) & JSCLASS_RESERVED_SLOTS_MASK) << JSCLASS_RESERVED_SLOTS_SHIFT)
1517 ,
1518 cOps: unsafe { CLASS_OPS.get() },
1519 spec: ptr::null(),
1520 ext: ptr::null(),
1521 oOps: ptr::null(),
1522 },
1523 dom_class:
1524DOMClass {
1525 interface_chain: [ PrototypeList::ID::EventTarget, PrototypeList::ID::RTCDataChannel, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last ],
1526 depth: 1,
1527 type_id: crate::codegen::InheritTypes::TopTypeId { eventtarget: (crate::codegen::InheritTypes::EventTargetTypeId::RTCDataChannel) },
1528 malloc_size_of: malloc_size_of_including_raw_self::<D::RTCDataChannel> as unsafe fn(&mut _, _) -> _,
1529 global: Globals::EMPTY,
1530},
1531 });
1532}
1533
1534#[cfg_attr(crown, allow(crown::unrooted_must_root))] pub unsafe fn Wrap<D: DomTypes>
1535(cx: SafeJSContext, scope: &D::GlobalScope, given_proto: Option<HandleObject>, object: Box<D::RTCDataChannel>, _can_gc: CanGc) -> DomRoot<D::RTCDataChannel>{
1536
1537 let raw = Root::new(MaybeUnreflectedDom::from_box(object));
1538
1539 let scope = scope.reflector().get_jsobject();
1540 assert!(!scope.get().is_null());
1541 assert!(((*get_object_class(scope.get())).flags & JSCLASS_IS_GLOBAL) != 0);
1542 let _ac = JSAutoRealm::new(cx.raw_cx(), scope.get());
1543
1544 rooted!(&in(cx) let mut canonical_proto = ptr::null_mut::<JSObject>());
1545 GetProtoObject::<D>(cx, scope, canonical_proto.handle_mut());
1546 assert!(!canonical_proto.is_null());
1547
1548
1549 rooted!(&in(cx) let mut proto = ptr::null_mut::<JSObject>());
1550 if let Some(given) = given_proto {
1551 proto.set(*given);
1552 if get_context_realm(cx.raw_cx()) != get_object_realm(*given) {
1553 assert!(JS_WrapObject(cx.raw_cx(), proto.handle_mut()));
1554 }
1555 } else {
1556 proto.set(*canonical_proto);
1557 }
1558 rooted!(&in(cx) let obj = JS_NewObjectWithGivenProto(
1559 cx.raw_cx(),
1560 &Class.get().base,
1561 proto.handle(),
1562 ));
1563 assert!(!obj.is_null());
1564 JS_SetReservedSlot(
1565 obj.get(),
1566 DOM_OBJECT_SLOT,
1567 &PrivateValue(raw.as_ptr() as *const libc::c_void),
1568 );
1569
1570 let root = raw.reflect_with(obj.get());
1571
1572
1573
1574 DomRoot::from_ref(&*root)
1575}
1576
1577pub trait RTCDataChannelMethods<D: DomTypes> {
1578 fn Label(&self, ) -> USVString;
1579 fn Ordered(&self, ) -> bool;
1580 fn GetMaxPacketLifeTime(&self, ) -> Option<u16>;
1581 fn GetMaxRetransmits(&self, ) -> Option<u16>;
1582 fn Protocol(&self, ) -> USVString;
1583 fn Negotiated(&self, ) -> bool;
1584 fn GetId(&self, ) -> Option<u16>;
1585 fn ReadyState(&self, ) -> RTCDataChannelState;
1586 fn GetOnopen(&self, ) -> Option<Rc<crate::codegen::GenericBindings::EventHandlerBinding::EventHandlerNonNull<D>>>;
1587 fn SetOnopen(&self, r#value: Option<Rc<EventHandlerNonNull<D>>>);
1588 fn GetOnbufferedamountlow(&self, ) -> Option<Rc<crate::codegen::GenericBindings::EventHandlerBinding::EventHandlerNonNull<D>>>;
1589 fn SetOnbufferedamountlow(&self, r#value: Option<Rc<EventHandlerNonNull<D>>>);
1590 fn GetOnerror(&self, ) -> Option<Rc<crate::codegen::GenericBindings::EventHandlerBinding::EventHandlerNonNull<D>>>;
1591 fn SetOnerror(&self, r#value: Option<Rc<EventHandlerNonNull<D>>>);
1592 fn GetOnclosing(&self, ) -> Option<Rc<crate::codegen::GenericBindings::EventHandlerBinding::EventHandlerNonNull<D>>>;
1593 fn SetOnclosing(&self, r#value: Option<Rc<EventHandlerNonNull<D>>>);
1594 fn GetOnclose(&self, ) -> Option<Rc<crate::codegen::GenericBindings::EventHandlerBinding::EventHandlerNonNull<D>>>;
1595 fn SetOnclose(&self, r#value: Option<Rc<EventHandlerNonNull<D>>>);
1596 fn Close(&self, );
1597 fn GetOnmessage(&self, ) -> Option<Rc<crate::codegen::GenericBindings::EventHandlerBinding::EventHandlerNonNull<D>>>;
1598 fn SetOnmessage(&self, r#value: Option<Rc<EventHandlerNonNull<D>>>);
1599 fn BinaryType(&self, ) -> DOMString;
1600 fn SetBinaryType(&self, r#value: DOMString) -> ErrorResult;
1601 fn Send(&self, r#data: USVString) -> Fallible<()>;
1602 fn Send_(&self, r#data: &D::Blob) -> Fallible<()>;
1603 fn Send__(&self, r#data: CustomAutoRooterGuard<typedarray::ArrayBuffer>) -> Fallible<()>;
1604 fn Send___(&self, r#data: CustomAutoRooterGuard<typedarray::ArrayBufferView>) -> Fallible<()>;
1605}
1606static sMethods_specs: ThreadUnsafeOnceLock<&[&[JSFunctionSpec]]> = ThreadUnsafeOnceLock::new();
1607
1608pub(crate) fn init_sMethods_specs<D: DomTypes>() {
1609 sMethods_specs.set(Box::leak(Box::new([&Box::leak(Box::new([
1610 JSFunctionSpec {
1611 name: JSPropertySpec_Name { string_: c"close".as_ptr() },
1612 call: JSNativeWrapper { op: Some(generic_method::<false>), info: unsafe { close_methodinfo.get() } as *const _ as *const JSJitInfo },
1613 nargs: 0,
1614 flags: (JSPROP_ENUMERATE) as u16,
1615 selfHostedName: ptr::null()
1616 },
1617 JSFunctionSpec {
1618 name: JSPropertySpec_Name { string_: c"send".as_ptr() },
1619 call: JSNativeWrapper { op: Some(generic_method::<false>), info: unsafe { send_methodinfo.get() } as *const _ as *const JSJitInfo },
1620 nargs: 1,
1621 flags: (JSPROP_ENUMERATE) as u16,
1622 selfHostedName: ptr::null()
1623 },
1624 JSFunctionSpec {
1625 name: JSPropertySpec_Name { string_: ptr::null() },
1626 call: JSNativeWrapper { op: None, info: ptr::null() },
1627 nargs: 0,
1628 flags: 0,
1629 selfHostedName: ptr::null()
1630 }]))[..]
1631])));
1632}static sMethods: ThreadUnsafeOnceLock<&[Guard<&[JSFunctionSpec]>]> = ThreadUnsafeOnceLock::new();
1633
1634pub(crate) fn init_sMethods_prefs<D: DomTypes>() {
1635 sMethods.set(Box::leak(Box::new([ Guard::new(&[Condition::Exposed(Globals::WINDOW)], (unsafe { sMethods_specs.get() })[0])])));
1636}static sAttributes_specs: ThreadUnsafeOnceLock<&[&[JSPropertySpec]]> = ThreadUnsafeOnceLock::new();
1637
1638pub(crate) fn init_sAttributes_specs<D: DomTypes>() {
1639 sAttributes_specs.set(Box::leak(Box::new([&Box::leak(Box::new([
1640 JSPropertySpec {
1641 name: JSPropertySpec_Name { string_: c"label".as_ptr() },
1642 attributes_: (JSPROP_ENUMERATE),
1643 kind_: (JSPropertySpec_Kind::NativeAccessor),
1644 u: JSPropertySpec_AccessorsOrValue {
1645 accessors: JSPropertySpec_AccessorsOrValue_Accessors {
1646 getter: JSPropertySpec_Accessor {
1647 native: JSNativeWrapper { op: Some(generic_getter::<false>), info: unsafe { label_getterinfo.get() } },
1648 },
1649 setter: JSPropertySpec_Accessor {
1650 native: JSNativeWrapper { op: None, info: ptr::null() },
1651 }
1652 }
1653 }
1654 }
1655,
1656 JSPropertySpec {
1657 name: JSPropertySpec_Name { string_: c"ordered".as_ptr() },
1658 attributes_: (JSPROP_ENUMERATE),
1659 kind_: (JSPropertySpec_Kind::NativeAccessor),
1660 u: JSPropertySpec_AccessorsOrValue {
1661 accessors: JSPropertySpec_AccessorsOrValue_Accessors {
1662 getter: JSPropertySpec_Accessor {
1663 native: JSNativeWrapper { op: Some(generic_getter::<false>), info: unsafe { ordered_getterinfo.get() } },
1664 },
1665 setter: JSPropertySpec_Accessor {
1666 native: JSNativeWrapper { op: None, info: ptr::null() },
1667 }
1668 }
1669 }
1670 }
1671,
1672 JSPropertySpec {
1673 name: JSPropertySpec_Name { string_: c"maxPacketLifeTime".as_ptr() },
1674 attributes_: (JSPROP_ENUMERATE),
1675 kind_: (JSPropertySpec_Kind::NativeAccessor),
1676 u: JSPropertySpec_AccessorsOrValue {
1677 accessors: JSPropertySpec_AccessorsOrValue_Accessors {
1678 getter: JSPropertySpec_Accessor {
1679 native: JSNativeWrapper { op: Some(generic_getter::<false>), info: unsafe { maxPacketLifeTime_getterinfo.get() } },
1680 },
1681 setter: JSPropertySpec_Accessor {
1682 native: JSNativeWrapper { op: None, info: ptr::null() },
1683 }
1684 }
1685 }
1686 }
1687,
1688 JSPropertySpec {
1689 name: JSPropertySpec_Name { string_: c"maxRetransmits".as_ptr() },
1690 attributes_: (JSPROP_ENUMERATE),
1691 kind_: (JSPropertySpec_Kind::NativeAccessor),
1692 u: JSPropertySpec_AccessorsOrValue {
1693 accessors: JSPropertySpec_AccessorsOrValue_Accessors {
1694 getter: JSPropertySpec_Accessor {
1695 native: JSNativeWrapper { op: Some(generic_getter::<false>), info: unsafe { maxRetransmits_getterinfo.get() } },
1696 },
1697 setter: JSPropertySpec_Accessor {
1698 native: JSNativeWrapper { op: None, info: ptr::null() },
1699 }
1700 }
1701 }
1702 }
1703,
1704 JSPropertySpec {
1705 name: JSPropertySpec_Name { string_: c"protocol".as_ptr() },
1706 attributes_: (JSPROP_ENUMERATE),
1707 kind_: (JSPropertySpec_Kind::NativeAccessor),
1708 u: JSPropertySpec_AccessorsOrValue {
1709 accessors: JSPropertySpec_AccessorsOrValue_Accessors {
1710 getter: JSPropertySpec_Accessor {
1711 native: JSNativeWrapper { op: Some(generic_getter::<false>), info: unsafe { protocol_getterinfo.get() } },
1712 },
1713 setter: JSPropertySpec_Accessor {
1714 native: JSNativeWrapper { op: None, info: ptr::null() },
1715 }
1716 }
1717 }
1718 }
1719,
1720 JSPropertySpec {
1721 name: JSPropertySpec_Name { string_: c"negotiated".as_ptr() },
1722 attributes_: (JSPROP_ENUMERATE),
1723 kind_: (JSPropertySpec_Kind::NativeAccessor),
1724 u: JSPropertySpec_AccessorsOrValue {
1725 accessors: JSPropertySpec_AccessorsOrValue_Accessors {
1726 getter: JSPropertySpec_Accessor {
1727 native: JSNativeWrapper { op: Some(generic_getter::<false>), info: unsafe { negotiated_getterinfo.get() } },
1728 },
1729 setter: JSPropertySpec_Accessor {
1730 native: JSNativeWrapper { op: None, info: ptr::null() },
1731 }
1732 }
1733 }
1734 }
1735,
1736 JSPropertySpec {
1737 name: JSPropertySpec_Name { string_: c"id".as_ptr() },
1738 attributes_: (JSPROP_ENUMERATE),
1739 kind_: (JSPropertySpec_Kind::NativeAccessor),
1740 u: JSPropertySpec_AccessorsOrValue {
1741 accessors: JSPropertySpec_AccessorsOrValue_Accessors {
1742 getter: JSPropertySpec_Accessor {
1743 native: JSNativeWrapper { op: Some(generic_getter::<false>), info: unsafe { id_getterinfo.get() } },
1744 },
1745 setter: JSPropertySpec_Accessor {
1746 native: JSNativeWrapper { op: None, info: ptr::null() },
1747 }
1748 }
1749 }
1750 }
1751,
1752 JSPropertySpec {
1753 name: JSPropertySpec_Name { string_: c"readyState".as_ptr() },
1754 attributes_: (JSPROP_ENUMERATE),
1755 kind_: (JSPropertySpec_Kind::NativeAccessor),
1756 u: JSPropertySpec_AccessorsOrValue {
1757 accessors: JSPropertySpec_AccessorsOrValue_Accessors {
1758 getter: JSPropertySpec_Accessor {
1759 native: JSNativeWrapper { op: Some(generic_getter::<false>), info: unsafe { readyState_getterinfo.get() } },
1760 },
1761 setter: JSPropertySpec_Accessor {
1762 native: JSNativeWrapper { op: None, info: ptr::null() },
1763 }
1764 }
1765 }
1766 }
1767,
1768 JSPropertySpec {
1769 name: JSPropertySpec_Name { string_: c"onopen".as_ptr() },
1770 attributes_: (JSPROP_ENUMERATE),
1771 kind_: (JSPropertySpec_Kind::NativeAccessor),
1772 u: JSPropertySpec_AccessorsOrValue {
1773 accessors: JSPropertySpec_AccessorsOrValue_Accessors {
1774 getter: JSPropertySpec_Accessor {
1775 native: JSNativeWrapper { op: Some(generic_getter::<false>), info: unsafe { onopen_getterinfo.get() } },
1776 },
1777 setter: JSPropertySpec_Accessor {
1778 native: JSNativeWrapper { op: Some(generic_setter), info: unsafe { onopen_setterinfo.get() } },
1779 }
1780 }
1781 }
1782 }
1783,
1784 JSPropertySpec {
1785 name: JSPropertySpec_Name { string_: c"onbufferedamountlow".as_ptr() },
1786 attributes_: (JSPROP_ENUMERATE),
1787 kind_: (JSPropertySpec_Kind::NativeAccessor),
1788 u: JSPropertySpec_AccessorsOrValue {
1789 accessors: JSPropertySpec_AccessorsOrValue_Accessors {
1790 getter: JSPropertySpec_Accessor {
1791 native: JSNativeWrapper { op: Some(generic_getter::<false>), info: unsafe { onbufferedamountlow_getterinfo.get() } },
1792 },
1793 setter: JSPropertySpec_Accessor {
1794 native: JSNativeWrapper { op: Some(generic_setter), info: unsafe { onbufferedamountlow_setterinfo.get() } },
1795 }
1796 }
1797 }
1798 }
1799,
1800 JSPropertySpec {
1801 name: JSPropertySpec_Name { string_: c"onerror".as_ptr() },
1802 attributes_: (JSPROP_ENUMERATE),
1803 kind_: (JSPropertySpec_Kind::NativeAccessor),
1804 u: JSPropertySpec_AccessorsOrValue {
1805 accessors: JSPropertySpec_AccessorsOrValue_Accessors {
1806 getter: JSPropertySpec_Accessor {
1807 native: JSNativeWrapper { op: Some(generic_getter::<false>), info: unsafe { onerror_getterinfo.get() } },
1808 },
1809 setter: JSPropertySpec_Accessor {
1810 native: JSNativeWrapper { op: Some(generic_setter), info: unsafe { onerror_setterinfo.get() } },
1811 }
1812 }
1813 }
1814 }
1815,
1816 JSPropertySpec {
1817 name: JSPropertySpec_Name { string_: c"onclosing".as_ptr() },
1818 attributes_: (JSPROP_ENUMERATE),
1819 kind_: (JSPropertySpec_Kind::NativeAccessor),
1820 u: JSPropertySpec_AccessorsOrValue {
1821 accessors: JSPropertySpec_AccessorsOrValue_Accessors {
1822 getter: JSPropertySpec_Accessor {
1823 native: JSNativeWrapper { op: Some(generic_getter::<false>), info: unsafe { onclosing_getterinfo.get() } },
1824 },
1825 setter: JSPropertySpec_Accessor {
1826 native: JSNativeWrapper { op: Some(generic_setter), info: unsafe { onclosing_setterinfo.get() } },
1827 }
1828 }
1829 }
1830 }
1831,
1832 JSPropertySpec {
1833 name: JSPropertySpec_Name { string_: c"onclose".as_ptr() },
1834 attributes_: (JSPROP_ENUMERATE),
1835 kind_: (JSPropertySpec_Kind::NativeAccessor),
1836 u: JSPropertySpec_AccessorsOrValue {
1837 accessors: JSPropertySpec_AccessorsOrValue_Accessors {
1838 getter: JSPropertySpec_Accessor {
1839 native: JSNativeWrapper { op: Some(generic_getter::<false>), info: unsafe { onclose_getterinfo.get() } },
1840 },
1841 setter: JSPropertySpec_Accessor {
1842 native: JSNativeWrapper { op: Some(generic_setter), info: unsafe { onclose_setterinfo.get() } },
1843 }
1844 }
1845 }
1846 }
1847,
1848 JSPropertySpec {
1849 name: JSPropertySpec_Name { string_: c"onmessage".as_ptr() },
1850 attributes_: (JSPROP_ENUMERATE),
1851 kind_: (JSPropertySpec_Kind::NativeAccessor),
1852 u: JSPropertySpec_AccessorsOrValue {
1853 accessors: JSPropertySpec_AccessorsOrValue_Accessors {
1854 getter: JSPropertySpec_Accessor {
1855 native: JSNativeWrapper { op: Some(generic_getter::<false>), info: unsafe { onmessage_getterinfo.get() } },
1856 },
1857 setter: JSPropertySpec_Accessor {
1858 native: JSNativeWrapper { op: Some(generic_setter), info: unsafe { onmessage_setterinfo.get() } },
1859 }
1860 }
1861 }
1862 }
1863,
1864 JSPropertySpec {
1865 name: JSPropertySpec_Name { string_: c"binaryType".as_ptr() },
1866 attributes_: (JSPROP_ENUMERATE),
1867 kind_: (JSPropertySpec_Kind::NativeAccessor),
1868 u: JSPropertySpec_AccessorsOrValue {
1869 accessors: JSPropertySpec_AccessorsOrValue_Accessors {
1870 getter: JSPropertySpec_Accessor {
1871 native: JSNativeWrapper { op: Some(generic_getter::<false>), info: unsafe { binaryType_getterinfo.get() } },
1872 },
1873 setter: JSPropertySpec_Accessor {
1874 native: JSNativeWrapper { op: Some(generic_setter), info: unsafe { binaryType_setterinfo.get() } },
1875 }
1876 }
1877 }
1878 }
1879,
1880 JSPropertySpec::ZERO]))[..]
1881,
1882&Box::leak(Box::new([
1883 JSPropertySpec {
1884 name: JSPropertySpec_Name { symbol_: SymbolCode::toStringTag as usize + 1 },
1885 attributes_: (JSPROP_READONLY),
1886 kind_: (JSPropertySpec_Kind::Value),
1887 u: JSPropertySpec_AccessorsOrValue {
1888 value: JSPropertySpec_ValueWrapper {
1889 type_: JSPropertySpec_ValueWrapper_Type::String,
1890 __bindgen_anon_1: JSPropertySpec_ValueWrapper__bindgen_ty_1 {
1891 string: c"RTCDataChannel".as_ptr(),
1892 }
1893 }
1894 }
1895 }
1896,
1897 JSPropertySpec::ZERO]))[..]
1898])));
1899}static sAttributes: ThreadUnsafeOnceLock<&[Guard<&[JSPropertySpec]>]> = ThreadUnsafeOnceLock::new();
1900
1901pub(crate) fn init_sAttributes_prefs<D: DomTypes>() {
1902 sAttributes.set(Box::leak(Box::new([ Guard::new(&[Condition::Exposed(Globals::WINDOW)], (unsafe { sAttributes_specs.get() })[0]),
1903 Guard::new(&[Condition::Satisfied], (unsafe { sAttributes_specs.get() })[1])])));
1904}
1905pub fn GetProtoObject<D: DomTypes>
1906(cx: SafeJSContext, global: HandleObject, mut rval: MutableHandleObject){
1907 get_per_interface_object_handle(cx, global, ProtoOrIfaceIndex::ID(PrototypeList::ID::RTCDataChannel), CreateInterfaceObjects::<D>, rval)
1909}
1910
1911
1912static PrototypeClass: JSClass = JSClass {
1913 name: c"RTCDataChannelPrototype".as_ptr(),
1914 flags:
1915 (0 ) << JSCLASS_RESERVED_SLOTS_SHIFT,
1917 cOps: ptr::null(),
1918 spec: ptr::null(),
1919 ext: ptr::null(),
1920 oOps: ptr::null(),
1921};
1922
1923
1924static INTERFACE_OBJECT_CLASS: ThreadUnsafeOnceLock<NonCallbackInterfaceObjectClass> = ThreadUnsafeOnceLock::new();
1925
1926pub(crate) fn init_interface_object<D: DomTypes>() {
1927 INTERFACE_OBJECT_CLASS.set(NonCallbackInterfaceObjectClass::new(
1928 Box::leak(Box::new(InterfaceConstructorBehavior::throw())),
1929 b"function RTCDataChannel() {\n [native code]\n}",
1930 PrototypeList::ID::RTCDataChannel,
1931 1,
1932 ));
1933}
1934
1935pub fn DefineDOMInterface<D: DomTypes>
1936(cx: SafeJSContext, global: HandleObject){
1937 define_dom_interface(cx, global, ProtoOrIfaceIndex::ID(PrototypeList::ID::RTCDataChannel),CreateInterfaceObjects::<D>, ConstructorEnabled::<D>)
1938}
1939
1940pub fn ConstructorEnabled<D: DomTypes>
1941(aCx: SafeJSContext, aObj: HandleObject) -> bool{
1942 is_exposed_in(aObj, Globals::WINDOW) &&
1943 pref!(dom_webrtc_enabled)
1944}
1945
1946unsafe fn CreateInterfaceObjects<D: DomTypes>
1947(cx: SafeJSContext, global: HandleObject, cache: *mut ProtoOrIfaceArray){
1948
1949 rooted!(&in(cx) let mut prototype_proto = ptr::null_mut::<JSObject>());
1950 EventTarget_Binding::GetProtoObject::<D>(cx, global, prototype_proto.handle_mut());
1951 assert!(!prototype_proto.is_null());
1952
1953 rooted!(&in(cx) let mut prototype = ptr::null_mut::<JSObject>());
1954 create_interface_prototype_object::<D>(cx,
1955 global,
1956 prototype_proto.handle(),
1957 &PrototypeClass,
1958 sMethods.get(),
1959 sAttributes.get(),
1960 &[],
1961 &[],
1962 prototype.handle_mut());
1963 assert!(!prototype.is_null());
1964 assert!((*cache)[PrototypeList::ID::RTCDataChannel as usize].is_null());
1965 (*cache)[PrototypeList::ID::RTCDataChannel as usize] = prototype.get();
1966 <*mut JSObject>::post_barrier((*cache).as_mut_ptr().offset(PrototypeList::ID::RTCDataChannel as isize),
1967 ptr::null_mut(),
1968 prototype.get());
1969
1970 rooted!(&in(cx) let mut interface_proto = ptr::null_mut::<JSObject>());
1971
1972 EventTarget_Binding::GetConstructorObject::<D>(cx, global, interface_proto.handle_mut());
1973
1974 assert!(!interface_proto.is_null());
1975
1976 rooted!(&in(cx) let mut interface = ptr::null_mut::<JSObject>());
1977 create_noncallback_interface_object::<D>(cx,
1978 global,
1979 interface_proto.handle(),
1980 INTERFACE_OBJECT_CLASS.get(),
1981 &[],
1982 &[],
1983 &[],
1984 prototype.handle(),
1985 c"RTCDataChannel",
1986 0,
1987 &[],
1988 interface.handle_mut());
1989 assert!(!interface.is_null());
1990}
1991
1992
1993 pub(crate) fn init_statics<D: DomTypes>() {
1994 init_interface_object::<D>();
1995 init_domjs_class::<D>();
1996 crate::codegen::GenericBindings::RTCDataChannelBinding::RTCDataChannel_Binding::init_close_methodinfo::<D>();
1997crate::codegen::GenericBindings::RTCDataChannelBinding::RTCDataChannel_Binding::init_send_methodinfo::<D>();
1998 init_label_getterinfo::<D>();
1999init_ordered_getterinfo::<D>();
2000init_maxPacketLifeTime_getterinfo::<D>();
2001init_maxRetransmits_getterinfo::<D>();
2002init_protocol_getterinfo::<D>();
2003init_negotiated_getterinfo::<D>();
2004init_id_getterinfo::<D>();
2005init_readyState_getterinfo::<D>();
2006init_onopen_getterinfo::<D>();
2007init_onbufferedamountlow_getterinfo::<D>();
2008init_onerror_getterinfo::<D>();
2009init_onclosing_getterinfo::<D>();
2010init_onclose_getterinfo::<D>();
2011init_onmessage_getterinfo::<D>();
2012init_binaryType_getterinfo::<D>();
2013 init_onopen_setterinfo::<D>();
2014init_onbufferedamountlow_setterinfo::<D>();
2015init_onerror_setterinfo::<D>();
2016init_onclosing_setterinfo::<D>();
2017init_onclose_setterinfo::<D>();
2018init_onmessage_setterinfo::<D>();
2019init_binaryType_setterinfo::<D>();
2020
2021 init_sMethods_specs::<D>();
2022init_sMethods_prefs::<D>();
2023init_sAttributes_specs::<D>();
2024init_sAttributes_prefs::<D>();
2025 }
2026 }