LCOV - code coverage report
Current view: top level - obj-x86_64-pc-linux-gnu/dom/bindings - PeerConnectionImplBinding.cpp (source / functions) Hit Total Coverage
Test: output.info Lines: 0 636 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 49 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* THIS FILE IS AUTOGENERATED FROM PeerConnectionImpl.webidl BY Codegen.py - DO NOT EDIT */
       2             : 
       3             : #include "DOMMediaStream.h"
       4             : #include "PeerConnectionImpl.h"
       5             : #include "PeerConnectionImplBinding.h"
       6             : #include "PeerConnectionObserverBinding.h"
       7             : #include "RTCConfigurationBinding.h"
       8             : #include "RTCPeerConnectionBinding.h"
       9             : #include "RTCRtpSenderBinding.h"
      10             : #include "WrapperFactory.h"
      11             : #include "mozilla/OwningNonNull.h"
      12             : #include "mozilla/dom/BindingUtils.h"
      13             : #include "mozilla/dom/DOMJSClass.h"
      14             : #include "mozilla/dom/MediaStreamTrack.h"
      15             : #include "mozilla/dom/NonRefcountedDOMObject.h"
      16             : #include "mozilla/dom/Nullable.h"
      17             : #include "mozilla/dom/PrimitiveConversions.h"
      18             : #include "mozilla/dom/RTCCertificate.h"
      19             : #include "mozilla/dom/XrayExpandoClass.h"
      20             : #include "nsContentUtils.h"
      21             : #include "nsDOMDataChannel.h"
      22             : #include "nsGlobalWindow.h"
      23             : #include "nsISupports.h"
      24             : 
      25             : namespace mozilla {
      26             : namespace dom {
      27             : 
      28             : namespace PeerConnectionImplBinding {
      29             : 
      30             : static bool
      31           0 : initialize(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::PeerConnectionImpl* self, const JSJitMethodCallArgs& args)
      32             : {
      33           0 :   if (MOZ_UNLIKELY(args.length() < 4)) {
      34           0 :     return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "PeerConnectionImpl.initialize");
      35             :   }
      36           0 :   NonNull<mozilla::dom::PeerConnectionObserver> arg0;
      37           0 :   if (args[0].isObject()) {
      38             :     {
      39           0 :       nsresult rv = UnwrapObject<prototypes::id::PeerConnectionObserver, mozilla::dom::PeerConnectionObserver>(args[0], arg0);
      40           0 :       if (NS_FAILED(rv)) {
      41           0 :         ThrowErrorMessage(cx, MSG_DOES_NOT_IMPLEMENT_INTERFACE, "Argument 1 of PeerConnectionImpl.initialize", "PeerConnectionObserver");
      42           0 :         return false;
      43             :       }
      44             :     }
      45             :   } else {
      46           0 :     ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 1 of PeerConnectionImpl.initialize");
      47           0 :     return false;
      48             :   }
      49           0 :   NonNull<nsGlobalWindow> arg1;
      50           0 :   if (args[1].isObject()) {
      51             :     {
      52           0 :       nsresult rv = UnwrapObject<prototypes::id::Window, nsGlobalWindow>(args[1], arg1);
      53           0 :       if (NS_FAILED(rv)) {
      54           0 :         ThrowErrorMessage(cx, MSG_DOES_NOT_IMPLEMENT_INTERFACE, "Argument 2 of PeerConnectionImpl.initialize", "Window");
      55           0 :         return false;
      56             :       }
      57             :     }
      58             :   } else {
      59           0 :     ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 2 of PeerConnectionImpl.initialize");
      60           0 :     return false;
      61             :   }
      62           0 :   binding_detail::FastRTCConfiguration arg2;
      63           0 :   if (!arg2.Init(cx, args[2],  "Argument 3 of PeerConnectionImpl.initialize", false)) {
      64           0 :     return false;
      65             :   }
      66             :   nsISupports* arg3;
      67           0 :   RefPtr<nsISupports> arg3_holder;
      68           0 :   if (args[3].isObject()) {
      69           0 :     JS::Rooted<JSObject*> source(cx, &args[3].toObject());
      70           0 :     if (NS_FAILED(UnwrapArg<nsISupports>(cx, source, getter_AddRefs(arg3_holder)))) {
      71           0 :       ThrowErrorMessage(cx, MSG_DOES_NOT_IMPLEMENT_INTERFACE, "Argument 4 of PeerConnectionImpl.initialize", "nsISupports");
      72           0 :       return false;
      73             :     }
      74           0 :     MOZ_ASSERT(arg3_holder);
      75           0 :     arg3 = arg3_holder;
      76             :   } else {
      77           0 :     ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 4 of PeerConnectionImpl.initialize");
      78           0 :     return false;
      79             :   }
      80           0 :   binding_detail::FastErrorResult rv;
      81           0 :   self->Initialize(NonNullHelper(arg0), NonNullHelper(arg1), Constify(arg2), NonNullHelper(arg3), rv);
      82           0 :   if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
      83           0 :     return false;
      84             :   }
      85           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
      86           0 :   args.rval().setUndefined();
      87           0 :   return true;
      88             : }
      89             : 
      90             : static const JSJitInfo initialize_methodinfo = {
      91             :   { (JSJitGetterOp)initialize },
      92             :   { prototypes::id::PeerConnectionImpl },
      93             :   { PrototypeTraits<prototypes::id::PeerConnectionImpl>::Depth },
      94             :   JSJitInfo::Method,
      95             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
      96             :   JSVAL_TYPE_UNDEFINED,  /* returnType.  Not relevant for setters. */
      97             :   false,  /* isInfallible. False in setters. */
      98             :   false,  /* isMovable.  Not relevant for setters. */
      99             :   false, /* isEliminatable.  Not relevant for setters. */
     100             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     101             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     102             :   false,  /* isTypedMethod.  Only relevant for methods. */
     103             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     104             : };
     105             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     106             : static_assert(0 < 1, "There is no slot for us");
     107             : 
     108             : static bool
     109           0 : createOffer(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::PeerConnectionImpl* self, const JSJitMethodCallArgs& args)
     110             : {
     111           0 :   binding_detail::FastRTCOfferOptions arg0;
     112           0 :   if (!arg0.Init(cx, (args.hasDefined(0)) ? args[0] : JS::NullHandleValue,  "Argument 1 of PeerConnectionImpl.createOffer", false)) {
     113           0 :     return false;
     114             :   }
     115           0 :   binding_detail::FastErrorResult rv;
     116           0 :   self->CreateOffer(Constify(arg0), rv);
     117           0 :   if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
     118           0 :     return false;
     119             :   }
     120           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     121           0 :   args.rval().setUndefined();
     122           0 :   return true;
     123             : }
     124             : 
     125             : static const JSJitInfo createOffer_methodinfo = {
     126             :   { (JSJitGetterOp)createOffer },
     127             :   { prototypes::id::PeerConnectionImpl },
     128             :   { PrototypeTraits<prototypes::id::PeerConnectionImpl>::Depth },
     129             :   JSJitInfo::Method,
     130             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
     131             :   JSVAL_TYPE_UNDEFINED,  /* returnType.  Not relevant for setters. */
     132             :   false,  /* isInfallible. False in setters. */
     133             :   false,  /* isMovable.  Not relevant for setters. */
     134             :   false, /* isEliminatable.  Not relevant for setters. */
     135             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     136             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     137             :   false,  /* isTypedMethod.  Only relevant for methods. */
     138             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     139             : };
     140             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     141             : static_assert(0 < 1, "There is no slot for us");
     142             : 
     143             : static bool
     144           0 : createAnswer(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::PeerConnectionImpl* self, const JSJitMethodCallArgs& args)
     145             : {
     146           0 :   binding_detail::FastErrorResult rv;
     147           0 :   self->CreateAnswer(rv);
     148           0 :   if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
     149           0 :     return false;
     150             :   }
     151           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     152           0 :   args.rval().setUndefined();
     153           0 :   return true;
     154             : }
     155             : 
     156             : static const JSJitInfo createAnswer_methodinfo = {
     157             :   { (JSJitGetterOp)createAnswer },
     158             :   { prototypes::id::PeerConnectionImpl },
     159             :   { PrototypeTraits<prototypes::id::PeerConnectionImpl>::Depth },
     160             :   JSJitInfo::Method,
     161             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
     162             :   JSVAL_TYPE_UNDEFINED,  /* returnType.  Not relevant for setters. */
     163             :   false,  /* isInfallible. False in setters. */
     164             :   false,  /* isMovable.  Not relevant for setters. */
     165             :   false, /* isEliminatable.  Not relevant for setters. */
     166             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     167             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     168             :   false,  /* isTypedMethod.  Only relevant for methods. */
     169             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     170             : };
     171             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     172             : static_assert(0 < 1, "There is no slot for us");
     173             : 
     174             : static bool
     175           0 : setLocalDescription(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::PeerConnectionImpl* self, const JSJitMethodCallArgs& args)
     176             : {
     177           0 :   if (MOZ_UNLIKELY(args.length() < 2)) {
     178           0 :     return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "PeerConnectionImpl.setLocalDescription");
     179             :   }
     180             :   int32_t arg0;
     181           0 :   if (!ValueToPrimitive<int32_t, eDefault>(cx, args[0], &arg0)) {
     182           0 :     return false;
     183             :   }
     184           0 :   binding_detail::FakeString arg1;
     185           0 :   if (!ConvertJSValueToString(cx, args[1], eStringify, eStringify, arg1)) {
     186           0 :     return false;
     187             :   }
     188           0 :   binding_detail::FastErrorResult rv;
     189           0 :   self->SetLocalDescription(arg0, NonNullHelper(Constify(arg1)), rv);
     190           0 :   if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
     191           0 :     return false;
     192             :   }
     193           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     194           0 :   args.rval().setUndefined();
     195           0 :   return true;
     196             : }
     197             : 
     198             : static const JSJitInfo setLocalDescription_methodinfo = {
     199             :   { (JSJitGetterOp)setLocalDescription },
     200             :   { prototypes::id::PeerConnectionImpl },
     201             :   { PrototypeTraits<prototypes::id::PeerConnectionImpl>::Depth },
     202             :   JSJitInfo::Method,
     203             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
     204             :   JSVAL_TYPE_UNDEFINED,  /* returnType.  Not relevant for setters. */
     205             :   false,  /* isInfallible. False in setters. */
     206             :   false,  /* isMovable.  Not relevant for setters. */
     207             :   false, /* isEliminatable.  Not relevant for setters. */
     208             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     209             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     210             :   false,  /* isTypedMethod.  Only relevant for methods. */
     211             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     212             : };
     213             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     214             : static_assert(0 < 1, "There is no slot for us");
     215             : 
     216             : static bool
     217           0 : setRemoteDescription(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::PeerConnectionImpl* self, const JSJitMethodCallArgs& args)
     218             : {
     219           0 :   if (MOZ_UNLIKELY(args.length() < 2)) {
     220           0 :     return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "PeerConnectionImpl.setRemoteDescription");
     221             :   }
     222             :   int32_t arg0;
     223           0 :   if (!ValueToPrimitive<int32_t, eDefault>(cx, args[0], &arg0)) {
     224           0 :     return false;
     225             :   }
     226           0 :   binding_detail::FakeString arg1;
     227           0 :   if (!ConvertJSValueToString(cx, args[1], eStringify, eStringify, arg1)) {
     228           0 :     return false;
     229             :   }
     230           0 :   binding_detail::FastErrorResult rv;
     231           0 :   self->SetRemoteDescription(arg0, NonNullHelper(Constify(arg1)), rv);
     232           0 :   if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
     233           0 :     return false;
     234             :   }
     235           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     236           0 :   args.rval().setUndefined();
     237           0 :   return true;
     238             : }
     239             : 
     240             : static const JSJitInfo setRemoteDescription_methodinfo = {
     241             :   { (JSJitGetterOp)setRemoteDescription },
     242             :   { prototypes::id::PeerConnectionImpl },
     243             :   { PrototypeTraits<prototypes::id::PeerConnectionImpl>::Depth },
     244             :   JSJitInfo::Method,
     245             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
     246             :   JSVAL_TYPE_UNDEFINED,  /* returnType.  Not relevant for setters. */
     247             :   false,  /* isInfallible. False in setters. */
     248             :   false,  /* isMovable.  Not relevant for setters. */
     249             :   false, /* isEliminatable.  Not relevant for setters. */
     250             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     251             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     252             :   false,  /* isTypedMethod.  Only relevant for methods. */
     253             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     254             : };
     255             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     256             : static_assert(0 < 1, "There is no slot for us");
     257             : 
     258             : static bool
     259           0 : getStats(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::PeerConnectionImpl* self, const JSJitMethodCallArgs& args)
     260             : {
     261           0 :   if (MOZ_UNLIKELY(args.length() < 1)) {
     262           0 :     return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "PeerConnectionImpl.getStats");
     263             :   }
     264             :   mozilla::dom::MediaStreamTrack* arg0;
     265           0 :   if (args[0].isObject()) {
     266             :     {
     267           0 :       nsresult rv = UnwrapObject<prototypes::id::MediaStreamTrack, mozilla::dom::MediaStreamTrack>(args[0], arg0);
     268           0 :       if (NS_FAILED(rv)) {
     269           0 :         ThrowErrorMessage(cx, MSG_DOES_NOT_IMPLEMENT_INTERFACE, "Argument 1 of PeerConnectionImpl.getStats", "MediaStreamTrack");
     270           0 :         return false;
     271             :       }
     272             :     }
     273           0 :   } else if (args[0].isNullOrUndefined()) {
     274           0 :     arg0 = nullptr;
     275             :   } else {
     276           0 :     ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 1 of PeerConnectionImpl.getStats");
     277           0 :     return false;
     278             :   }
     279           0 :   binding_detail::FastErrorResult rv;
     280           0 :   self->GetStats(Constify(arg0), rv);
     281           0 :   if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
     282           0 :     return false;
     283             :   }
     284           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     285           0 :   args.rval().setUndefined();
     286           0 :   return true;
     287             : }
     288             : 
     289             : static const JSJitInfo getStats_methodinfo = {
     290             :   { (JSJitGetterOp)getStats },
     291             :   { prototypes::id::PeerConnectionImpl },
     292             :   { PrototypeTraits<prototypes::id::PeerConnectionImpl>::Depth },
     293             :   JSJitInfo::Method,
     294             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
     295             :   JSVAL_TYPE_UNDEFINED,  /* returnType.  Not relevant for setters. */
     296             :   false,  /* isInfallible. False in setters. */
     297             :   false,  /* isMovable.  Not relevant for setters. */
     298             :   false, /* isEliminatable.  Not relevant for setters. */
     299             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     300             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     301             :   false,  /* isTypedMethod.  Only relevant for methods. */
     302             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     303             : };
     304             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     305             : static_assert(0 < 1, "There is no slot for us");
     306             : 
     307             : static bool
     308           0 : addTrack(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::PeerConnectionImpl* self, const JSJitMethodCallArgs& args)
     309             : {
     310           0 :   if (MOZ_UNLIKELY(args.length() < 1)) {
     311           0 :     return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "PeerConnectionImpl.addTrack");
     312             :   }
     313           0 :   NonNull<mozilla::dom::MediaStreamTrack> arg0;
     314           0 :   if (args[0].isObject()) {
     315             :     {
     316           0 :       nsresult rv = UnwrapObject<prototypes::id::MediaStreamTrack, mozilla::dom::MediaStreamTrack>(args[0], arg0);
     317           0 :       if (NS_FAILED(rv)) {
     318           0 :         ThrowErrorMessage(cx, MSG_DOES_NOT_IMPLEMENT_INTERFACE, "Argument 1 of PeerConnectionImpl.addTrack", "MediaStreamTrack");
     319           0 :         return false;
     320             :       }
     321             :     }
     322             :   } else {
     323           0 :     ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 1 of PeerConnectionImpl.addTrack");
     324           0 :     return false;
     325             :   }
     326           0 :   binding_detail::AutoSequence<OwningNonNull<mozilla::DOMMediaStream>> arg1;
     327           0 :   if (args.length() > 1) {
     328           0 :     if (!arg1.SetCapacity(args.length() - 1, mozilla::fallible)) {
     329           0 :       JS_ReportOutOfMemory(cx);
     330           0 :       return false;
     331             :     }
     332           0 :     for (uint32_t variadicArg = 1; variadicArg < args.length(); ++variadicArg) {
     333           0 :       OwningNonNull<mozilla::DOMMediaStream>& slot = *arg1.AppendElement(mozilla::fallible);
     334           0 :       if (args[variadicArg].isObject()) {
     335             :         static_assert(IsRefcounted<mozilla::DOMMediaStream>::value, "We can only store refcounted classes.");{
     336           0 :           nsresult rv = UnwrapObject<prototypes::id::MediaStream, mozilla::DOMMediaStream>(args[variadicArg], slot);
     337           0 :           if (NS_FAILED(rv)) {
     338           0 :             ThrowErrorMessage(cx, MSG_DOES_NOT_IMPLEMENT_INTERFACE, "Argument 2 of PeerConnectionImpl.addTrack", "MediaStream");
     339           0 :             return false;
     340             :           }
     341             :         }
     342             :       } else {
     343           0 :         ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 2 of PeerConnectionImpl.addTrack");
     344           0 :         return false;
     345             :       }
     346             :     }
     347             :   }
     348           0 :   binding_detail::FastErrorResult rv;
     349           0 :   self->AddTrack(NonNullHelper(arg0), NonNullHelper(Constify(arg1)), rv);
     350           0 :   if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
     351           0 :     return false;
     352             :   }
     353           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     354           0 :   args.rval().setUndefined();
     355           0 :   return true;
     356             : }
     357             : 
     358             : static const JSJitInfo addTrack_methodinfo = {
     359             :   { (JSJitGetterOp)addTrack },
     360             :   { prototypes::id::PeerConnectionImpl },
     361             :   { PrototypeTraits<prototypes::id::PeerConnectionImpl>::Depth },
     362             :   JSJitInfo::Method,
     363             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
     364             :   JSVAL_TYPE_UNDEFINED,  /* returnType.  Not relevant for setters. */
     365             :   false,  /* isInfallible. False in setters. */
     366             :   false,  /* isMovable.  Not relevant for setters. */
     367             :   false, /* isEliminatable.  Not relevant for setters. */
     368             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     369             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     370             :   false,  /* isTypedMethod.  Only relevant for methods. */
     371             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     372             : };
     373             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     374             : static_assert(0 < 1, "There is no slot for us");
     375             : 
     376             : static bool
     377           0 : removeTrack(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::PeerConnectionImpl* self, const JSJitMethodCallArgs& args)
     378             : {
     379           0 :   if (MOZ_UNLIKELY(args.length() < 1)) {
     380           0 :     return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "PeerConnectionImpl.removeTrack");
     381             :   }
     382           0 :   NonNull<mozilla::dom::MediaStreamTrack> arg0;
     383           0 :   if (args[0].isObject()) {
     384             :     {
     385           0 :       nsresult rv = UnwrapObject<prototypes::id::MediaStreamTrack, mozilla::dom::MediaStreamTrack>(args[0], arg0);
     386           0 :       if (NS_FAILED(rv)) {
     387           0 :         ThrowErrorMessage(cx, MSG_DOES_NOT_IMPLEMENT_INTERFACE, "Argument 1 of PeerConnectionImpl.removeTrack", "MediaStreamTrack");
     388           0 :         return false;
     389             :       }
     390             :     }
     391             :   } else {
     392           0 :     ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 1 of PeerConnectionImpl.removeTrack");
     393           0 :     return false;
     394             :   }
     395           0 :   binding_detail::FastErrorResult rv;
     396           0 :   self->RemoveTrack(NonNullHelper(arg0), rv);
     397           0 :   if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
     398           0 :     return false;
     399             :   }
     400           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     401           0 :   args.rval().setUndefined();
     402           0 :   return true;
     403             : }
     404             : 
     405             : static const JSJitInfo removeTrack_methodinfo = {
     406             :   { (JSJitGetterOp)removeTrack },
     407             :   { prototypes::id::PeerConnectionImpl },
     408             :   { PrototypeTraits<prototypes::id::PeerConnectionImpl>::Depth },
     409             :   JSJitInfo::Method,
     410             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
     411             :   JSVAL_TYPE_UNDEFINED,  /* returnType.  Not relevant for setters. */
     412             :   false,  /* isInfallible. False in setters. */
     413             :   false,  /* isMovable.  Not relevant for setters. */
     414             :   false, /* isEliminatable.  Not relevant for setters. */
     415             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     416             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     417             :   false,  /* isTypedMethod.  Only relevant for methods. */
     418             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     419             : };
     420             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     421             : static_assert(0 < 1, "There is no slot for us");
     422             : 
     423             : static bool
     424           0 : insertDTMF(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::PeerConnectionImpl* self, const JSJitMethodCallArgs& args)
     425             : {
     426           0 :   if (MOZ_UNLIKELY(args.length() < 2)) {
     427           0 :     return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "PeerConnectionImpl.insertDTMF");
     428             :   }
     429           0 :   NonNull<mozilla::dom::RTCRtpSender> arg0;
     430           0 :   if (args[0].isObject()) {
     431             :     {
     432           0 :       nsresult rv = UnwrapObject<prototypes::id::RTCRtpSender, mozilla::dom::RTCRtpSender>(args[0], arg0);
     433           0 :       if (NS_FAILED(rv)) {
     434           0 :         ThrowErrorMessage(cx, MSG_DOES_NOT_IMPLEMENT_INTERFACE, "Argument 1 of PeerConnectionImpl.insertDTMF", "RTCRtpSender");
     435           0 :         return false;
     436             :       }
     437             :     }
     438             :   } else {
     439           0 :     ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 1 of PeerConnectionImpl.insertDTMF");
     440           0 :     return false;
     441             :   }
     442           0 :   binding_detail::FakeString arg1;
     443           0 :   if (!ConvertJSValueToString(cx, args[1], eStringify, eStringify, arg1)) {
     444           0 :     return false;
     445             :   }
     446             :   uint32_t arg2;
     447           0 :   if (args.hasDefined(2)) {
     448           0 :     if (!ValueToPrimitive<uint32_t, eDefault>(cx, args[2], &arg2)) {
     449           0 :       return false;
     450             :     }
     451             :   } else {
     452           0 :     arg2 = 100U;
     453             :   }
     454             :   uint32_t arg3;
     455           0 :   if (args.hasDefined(3)) {
     456           0 :     if (!ValueToPrimitive<uint32_t, eDefault>(cx, args[3], &arg3)) {
     457           0 :       return false;
     458             :     }
     459             :   } else {
     460           0 :     arg3 = 70U;
     461             :   }
     462           0 :   binding_detail::FastErrorResult rv;
     463           0 :   self->InsertDTMF(NonNullHelper(arg0), NonNullHelper(Constify(arg1)), arg2, arg3, rv);
     464           0 :   if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
     465           0 :     return false;
     466             :   }
     467           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     468           0 :   args.rval().setUndefined();
     469           0 :   return true;
     470             : }
     471             : 
     472             : static const JSJitInfo insertDTMF_methodinfo = {
     473             :   { (JSJitGetterOp)insertDTMF },
     474             :   { prototypes::id::PeerConnectionImpl },
     475             :   { PrototypeTraits<prototypes::id::PeerConnectionImpl>::Depth },
     476             :   JSJitInfo::Method,
     477             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
     478             :   JSVAL_TYPE_UNDEFINED,  /* returnType.  Not relevant for setters. */
     479             :   false,  /* isInfallible. False in setters. */
     480             :   false,  /* isMovable.  Not relevant for setters. */
     481             :   false, /* isEliminatable.  Not relevant for setters. */
     482             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     483             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     484             :   false,  /* isTypedMethod.  Only relevant for methods. */
     485             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     486             : };
     487             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     488             : static_assert(0 < 1, "There is no slot for us");
     489             : 
     490             : static bool
     491           0 : getDTMFToneBuffer(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::PeerConnectionImpl* self, const JSJitMethodCallArgs& args)
     492             : {
     493           0 :   if (MOZ_UNLIKELY(args.length() < 1)) {
     494           0 :     return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "PeerConnectionImpl.getDTMFToneBuffer");
     495             :   }
     496           0 :   NonNull<mozilla::dom::RTCRtpSender> arg0;
     497           0 :   if (args[0].isObject()) {
     498             :     {
     499           0 :       nsresult rv = UnwrapObject<prototypes::id::RTCRtpSender, mozilla::dom::RTCRtpSender>(args[0], arg0);
     500           0 :       if (NS_FAILED(rv)) {
     501           0 :         ThrowErrorMessage(cx, MSG_DOES_NOT_IMPLEMENT_INTERFACE, "Argument 1 of PeerConnectionImpl.getDTMFToneBuffer", "RTCRtpSender");
     502           0 :         return false;
     503             :       }
     504             :     }
     505             :   } else {
     506           0 :     ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 1 of PeerConnectionImpl.getDTMFToneBuffer");
     507           0 :     return false;
     508             :   }
     509           0 :   binding_detail::FastErrorResult rv;
     510           0 :   DOMString result;
     511           0 :   self->GetDTMFToneBuffer(NonNullHelper(arg0), result, rv);
     512           0 :   if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
     513           0 :     return false;
     514             :   }
     515           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     516           0 :   if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) {
     517           0 :     return false;
     518             :   }
     519           0 :   return true;
     520             : }
     521             : 
     522             : static const JSJitInfo getDTMFToneBuffer_methodinfo = {
     523             :   { (JSJitGetterOp)getDTMFToneBuffer },
     524             :   { prototypes::id::PeerConnectionImpl },
     525             :   { PrototypeTraits<prototypes::id::PeerConnectionImpl>::Depth },
     526             :   JSJitInfo::Method,
     527             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
     528             :   JSVAL_TYPE_STRING,  /* returnType.  Not relevant for setters. */
     529             :   false,  /* isInfallible. False in setters. */
     530             :   false,  /* isMovable.  Not relevant for setters. */
     531             :   false, /* isEliminatable.  Not relevant for setters. */
     532             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     533             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     534             :   false,  /* isTypedMethod.  Only relevant for methods. */
     535             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     536             : };
     537             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     538             : static_assert(0 < 1, "There is no slot for us");
     539             : 
     540             : static bool
     541           0 : replaceTrack(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::PeerConnectionImpl* self, const JSJitMethodCallArgs& args)
     542             : {
     543           0 :   if (MOZ_UNLIKELY(args.length() < 2)) {
     544           0 :     return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "PeerConnectionImpl.replaceTrack");
     545             :   }
     546           0 :   NonNull<mozilla::dom::MediaStreamTrack> arg0;
     547           0 :   if (args[0].isObject()) {
     548             :     {
     549           0 :       nsresult rv = UnwrapObject<prototypes::id::MediaStreamTrack, mozilla::dom::MediaStreamTrack>(args[0], arg0);
     550           0 :       if (NS_FAILED(rv)) {
     551           0 :         ThrowErrorMessage(cx, MSG_DOES_NOT_IMPLEMENT_INTERFACE, "Argument 1 of PeerConnectionImpl.replaceTrack", "MediaStreamTrack");
     552           0 :         return false;
     553             :       }
     554             :     }
     555             :   } else {
     556           0 :     ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 1 of PeerConnectionImpl.replaceTrack");
     557           0 :     return false;
     558             :   }
     559           0 :   NonNull<mozilla::dom::MediaStreamTrack> arg1;
     560           0 :   if (args[1].isObject()) {
     561             :     {
     562           0 :       nsresult rv = UnwrapObject<prototypes::id::MediaStreamTrack, mozilla::dom::MediaStreamTrack>(args[1], arg1);
     563           0 :       if (NS_FAILED(rv)) {
     564           0 :         ThrowErrorMessage(cx, MSG_DOES_NOT_IMPLEMENT_INTERFACE, "Argument 2 of PeerConnectionImpl.replaceTrack", "MediaStreamTrack");
     565           0 :         return false;
     566             :       }
     567             :     }
     568             :   } else {
     569           0 :     ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 2 of PeerConnectionImpl.replaceTrack");
     570           0 :     return false;
     571             :   }
     572           0 :   binding_detail::FastErrorResult rv;
     573           0 :   self->ReplaceTrack(NonNullHelper(arg0), NonNullHelper(arg1), rv);
     574           0 :   if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
     575           0 :     return false;
     576             :   }
     577           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     578           0 :   args.rval().setUndefined();
     579           0 :   return true;
     580             : }
     581             : 
     582             : static const JSJitInfo replaceTrack_methodinfo = {
     583             :   { (JSJitGetterOp)replaceTrack },
     584             :   { prototypes::id::PeerConnectionImpl },
     585             :   { PrototypeTraits<prototypes::id::PeerConnectionImpl>::Depth },
     586             :   JSJitInfo::Method,
     587             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
     588             :   JSVAL_TYPE_UNDEFINED,  /* returnType.  Not relevant for setters. */
     589             :   false,  /* isInfallible. False in setters. */
     590             :   false,  /* isMovable.  Not relevant for setters. */
     591             :   false, /* isEliminatable.  Not relevant for setters. */
     592             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     593             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     594             :   false,  /* isTypedMethod.  Only relevant for methods. */
     595             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     596             : };
     597             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     598             : static_assert(0 < 1, "There is no slot for us");
     599             : 
     600             : static bool
     601           0 : setParameters(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::PeerConnectionImpl* self, const JSJitMethodCallArgs& args)
     602             : {
     603           0 :   if (MOZ_UNLIKELY(args.length() < 1)) {
     604           0 :     return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "PeerConnectionImpl.setParameters");
     605             :   }
     606           0 :   NonNull<mozilla::dom::MediaStreamTrack> arg0;
     607           0 :   if (args[0].isObject()) {
     608             :     {
     609           0 :       nsresult rv = UnwrapObject<prototypes::id::MediaStreamTrack, mozilla::dom::MediaStreamTrack>(args[0], arg0);
     610           0 :       if (NS_FAILED(rv)) {
     611           0 :         ThrowErrorMessage(cx, MSG_DOES_NOT_IMPLEMENT_INTERFACE, "Argument 1 of PeerConnectionImpl.setParameters", "MediaStreamTrack");
     612           0 :         return false;
     613             :       }
     614             :     }
     615             :   } else {
     616           0 :     ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 1 of PeerConnectionImpl.setParameters");
     617           0 :     return false;
     618             :   }
     619           0 :   binding_detail::FastRTCRtpParameters arg1;
     620           0 :   if (!arg1.Init(cx, (args.hasDefined(1)) ? args[1] : JS::NullHandleValue,  "Argument 2 of PeerConnectionImpl.setParameters", false)) {
     621           0 :     return false;
     622             :   }
     623           0 :   binding_detail::FastErrorResult rv;
     624           0 :   self->SetParameters(NonNullHelper(arg0), Constify(arg1), rv);
     625           0 :   if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
     626           0 :     return false;
     627             :   }
     628           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     629           0 :   args.rval().setUndefined();
     630           0 :   return true;
     631             : }
     632             : 
     633             : static const JSJitInfo setParameters_methodinfo = {
     634             :   { (JSJitGetterOp)setParameters },
     635             :   { prototypes::id::PeerConnectionImpl },
     636             :   { PrototypeTraits<prototypes::id::PeerConnectionImpl>::Depth },
     637             :   JSJitInfo::Method,
     638             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
     639             :   JSVAL_TYPE_UNDEFINED,  /* returnType.  Not relevant for setters. */
     640             :   false,  /* isInfallible. False in setters. */
     641             :   false,  /* isMovable.  Not relevant for setters. */
     642             :   false, /* isEliminatable.  Not relevant for setters. */
     643             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     644             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     645             :   false,  /* isTypedMethod.  Only relevant for methods. */
     646             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     647             : };
     648             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     649             : static_assert(0 < 1, "There is no slot for us");
     650             : 
     651             : static bool
     652           0 : getParameters(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::PeerConnectionImpl* self, const JSJitMethodCallArgs& args)
     653             : {
     654           0 :   if (MOZ_UNLIKELY(args.length() < 1)) {
     655           0 :     return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "PeerConnectionImpl.getParameters");
     656             :   }
     657           0 :   NonNull<mozilla::dom::MediaStreamTrack> arg0;
     658           0 :   if (args[0].isObject()) {
     659             :     {
     660           0 :       nsresult rv = UnwrapObject<prototypes::id::MediaStreamTrack, mozilla::dom::MediaStreamTrack>(args[0], arg0);
     661           0 :       if (NS_FAILED(rv)) {
     662           0 :         ThrowErrorMessage(cx, MSG_DOES_NOT_IMPLEMENT_INTERFACE, "Argument 1 of PeerConnectionImpl.getParameters", "MediaStreamTrack");
     663           0 :         return false;
     664             :       }
     665             :     }
     666             :   } else {
     667           0 :     ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 1 of PeerConnectionImpl.getParameters");
     668           0 :     return false;
     669             :   }
     670           0 :   binding_detail::FastErrorResult rv;
     671           0 :   RTCRtpParameters result;
     672           0 :   self->GetParameters(NonNullHelper(arg0), result, rv);
     673           0 :   if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
     674           0 :     return false;
     675             :   }
     676           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     677           0 :   if (!result.ToObjectInternal(cx, args.rval())) {
     678           0 :     return false;
     679             :   }
     680           0 :   return true;
     681             : }
     682             : 
     683             : static const JSJitInfo getParameters_methodinfo = {
     684             :   { (JSJitGetterOp)getParameters },
     685             :   { prototypes::id::PeerConnectionImpl },
     686             :   { PrototypeTraits<prototypes::id::PeerConnectionImpl>::Depth },
     687             :   JSJitInfo::Method,
     688             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
     689             :   JSVAL_TYPE_OBJECT,  /* returnType.  Not relevant for setters. */
     690             :   false,  /* isInfallible. False in setters. */
     691             :   false,  /* isMovable.  Not relevant for setters. */
     692             :   false, /* isEliminatable.  Not relevant for setters. */
     693             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     694             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     695             :   false,  /* isTypedMethod.  Only relevant for methods. */
     696             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     697             : };
     698             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     699             : static_assert(0 < 1, "There is no slot for us");
     700             : 
     701             : static bool
     702           0 : closeStreams(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::PeerConnectionImpl* self, const JSJitMethodCallArgs& args)
     703             : {
     704           0 :   binding_detail::FastErrorResult rv;
     705           0 :   self->CloseStreams(rv);
     706           0 :   if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
     707           0 :     return false;
     708             :   }
     709           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     710           0 :   args.rval().setUndefined();
     711           0 :   return true;
     712             : }
     713             : 
     714             : static const JSJitInfo closeStreams_methodinfo = {
     715             :   { (JSJitGetterOp)closeStreams },
     716             :   { prototypes::id::PeerConnectionImpl },
     717             :   { PrototypeTraits<prototypes::id::PeerConnectionImpl>::Depth },
     718             :   JSJitInfo::Method,
     719             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
     720             :   JSVAL_TYPE_UNDEFINED,  /* returnType.  Not relevant for setters. */
     721             :   false,  /* isInfallible. False in setters. */
     722             :   false,  /* isMovable.  Not relevant for setters. */
     723             :   false, /* isEliminatable.  Not relevant for setters. */
     724             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     725             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     726             :   false,  /* isTypedMethod.  Only relevant for methods. */
     727             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     728             : };
     729             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     730             : static_assert(0 < 1, "There is no slot for us");
     731             : 
     732             : static bool
     733           0 : getLocalStreams(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::PeerConnectionImpl* self, const JSJitMethodCallArgs& args)
     734             : {
     735           0 :   nsTArray<StrongPtrForMember<mozilla::DOMMediaStream>::Type> result;
     736           0 :   self->GetLocalStreams(result);
     737           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     738             : 
     739           0 :   uint32_t length = result.Length();
     740           0 :   JS::Rooted<JSObject*> returnArray(cx, JS_NewArrayObject(cx, length));
     741           0 :   if (!returnArray) {
     742           0 :     return false;
     743             :   }
     744             :   // Scope for 'tmp'
     745             :   {
     746           0 :     JS::Rooted<JS::Value> tmp(cx);
     747           0 :     for (uint32_t sequenceIdx0 = 0; sequenceIdx0 < length; ++sequenceIdx0) {
     748             :       // Control block to let us common up the JS_DefineElement calls when there
     749             :       // are different ways to succeed at wrapping the object.
     750             :       do {
     751           0 :         if (!GetOrCreateDOMReflector(cx, result[sequenceIdx0], &tmp)) {
     752           0 :           MOZ_ASSERT(true || JS_IsExceptionPending(cx));
     753           0 :           return false;
     754             :         }
     755           0 :         break;
     756             :       } while (0);
     757           0 :       if (!JS_DefineElement(cx, returnArray, sequenceIdx0, tmp,
     758             :                             JSPROP_ENUMERATE)) {
     759           0 :         return false;
     760             :       }
     761             :     }
     762             :   }
     763           0 :   args.rval().setObject(*returnArray);
     764           0 :   return true;
     765             : }
     766             : 
     767             : static const JSJitInfo getLocalStreams_methodinfo = {
     768             :   { (JSJitGetterOp)getLocalStreams },
     769             :   { prototypes::id::PeerConnectionImpl },
     770             :   { PrototypeTraits<prototypes::id::PeerConnectionImpl>::Depth },
     771             :   JSJitInfo::Method,
     772             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
     773             :   JSVAL_TYPE_OBJECT,  /* returnType.  Not relevant for setters. */
     774             :   false,  /* isInfallible. False in setters. */
     775             :   false,  /* isMovable.  Not relevant for setters. */
     776             :   false, /* isEliminatable.  Not relevant for setters. */
     777             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     778             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     779             :   false,  /* isTypedMethod.  Only relevant for methods. */
     780             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     781             : };
     782             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     783             : static_assert(0 < 1, "There is no slot for us");
     784             : 
     785             : static bool
     786           0 : getRemoteStreams(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::PeerConnectionImpl* self, const JSJitMethodCallArgs& args)
     787             : {
     788           0 :   nsTArray<StrongPtrForMember<mozilla::DOMMediaStream>::Type> result;
     789           0 :   self->GetRemoteStreams(result);
     790           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     791             : 
     792           0 :   uint32_t length = result.Length();
     793           0 :   JS::Rooted<JSObject*> returnArray(cx, JS_NewArrayObject(cx, length));
     794           0 :   if (!returnArray) {
     795           0 :     return false;
     796             :   }
     797             :   // Scope for 'tmp'
     798             :   {
     799           0 :     JS::Rooted<JS::Value> tmp(cx);
     800           0 :     for (uint32_t sequenceIdx0 = 0; sequenceIdx0 < length; ++sequenceIdx0) {
     801             :       // Control block to let us common up the JS_DefineElement calls when there
     802             :       // are different ways to succeed at wrapping the object.
     803             :       do {
     804           0 :         if (!GetOrCreateDOMReflector(cx, result[sequenceIdx0], &tmp)) {
     805           0 :           MOZ_ASSERT(true || JS_IsExceptionPending(cx));
     806           0 :           return false;
     807             :         }
     808           0 :         break;
     809             :       } while (0);
     810           0 :       if (!JS_DefineElement(cx, returnArray, sequenceIdx0, tmp,
     811             :                             JSPROP_ENUMERATE)) {
     812           0 :         return false;
     813             :       }
     814             :     }
     815             :   }
     816           0 :   args.rval().setObject(*returnArray);
     817           0 :   return true;
     818             : }
     819             : 
     820             : static const JSJitInfo getRemoteStreams_methodinfo = {
     821             :   { (JSJitGetterOp)getRemoteStreams },
     822             :   { prototypes::id::PeerConnectionImpl },
     823             :   { PrototypeTraits<prototypes::id::PeerConnectionImpl>::Depth },
     824             :   JSJitInfo::Method,
     825             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
     826             :   JSVAL_TYPE_OBJECT,  /* returnType.  Not relevant for setters. */
     827             :   false,  /* isInfallible. False in setters. */
     828             :   false,  /* isMovable.  Not relevant for setters. */
     829             :   false, /* isEliminatable.  Not relevant for setters. */
     830             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     831             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     832             :   false,  /* isTypedMethod.  Only relevant for methods. */
     833             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     834             : };
     835             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     836             : static_assert(0 < 1, "There is no slot for us");
     837             : 
     838             : static bool
     839           0 : addRIDExtension(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::PeerConnectionImpl* self, const JSJitMethodCallArgs& args)
     840             : {
     841           0 :   if (MOZ_UNLIKELY(args.length() < 2)) {
     842           0 :     return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "PeerConnectionImpl.addRIDExtension");
     843             :   }
     844           0 :   NonNull<mozilla::dom::MediaStreamTrack> arg0;
     845           0 :   if (args[0].isObject()) {
     846             :     {
     847           0 :       nsresult rv = UnwrapObject<prototypes::id::MediaStreamTrack, mozilla::dom::MediaStreamTrack>(args[0], arg0);
     848           0 :       if (NS_FAILED(rv)) {
     849           0 :         ThrowErrorMessage(cx, MSG_DOES_NOT_IMPLEMENT_INTERFACE, "Argument 1 of PeerConnectionImpl.addRIDExtension", "MediaStreamTrack");
     850           0 :         return false;
     851             :       }
     852             :     }
     853             :   } else {
     854           0 :     ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 1 of PeerConnectionImpl.addRIDExtension");
     855           0 :     return false;
     856             :   }
     857             :   uint16_t arg1;
     858           0 :   if (!ValueToPrimitive<uint16_t, eDefault>(cx, args[1], &arg1)) {
     859           0 :     return false;
     860             :   }
     861           0 :   self->AddRIDExtension(NonNullHelper(arg0), arg1);
     862           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     863           0 :   args.rval().setUndefined();
     864           0 :   return true;
     865             : }
     866             : 
     867             : static const JSJitInfo addRIDExtension_methodinfo = {
     868             :   { (JSJitGetterOp)addRIDExtension },
     869             :   { prototypes::id::PeerConnectionImpl },
     870             :   { PrototypeTraits<prototypes::id::PeerConnectionImpl>::Depth },
     871             :   JSJitInfo::Method,
     872             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
     873             :   JSVAL_TYPE_UNDEFINED,  /* returnType.  Not relevant for setters. */
     874             :   false,  /* isInfallible. False in setters. */
     875             :   false,  /* isMovable.  Not relevant for setters. */
     876             :   false, /* isEliminatable.  Not relevant for setters. */
     877             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     878             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     879             :   false,  /* isTypedMethod.  Only relevant for methods. */
     880             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     881             : };
     882             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     883             : static_assert(0 < 1, "There is no slot for us");
     884             : 
     885             : static bool
     886           0 : addRIDFilter(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::PeerConnectionImpl* self, const JSJitMethodCallArgs& args)
     887             : {
     888           0 :   if (MOZ_UNLIKELY(args.length() < 2)) {
     889           0 :     return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "PeerConnectionImpl.addRIDFilter");
     890             :   }
     891           0 :   NonNull<mozilla::dom::MediaStreamTrack> arg0;
     892           0 :   if (args[0].isObject()) {
     893             :     {
     894           0 :       nsresult rv = UnwrapObject<prototypes::id::MediaStreamTrack, mozilla::dom::MediaStreamTrack>(args[0], arg0);
     895           0 :       if (NS_FAILED(rv)) {
     896           0 :         ThrowErrorMessage(cx, MSG_DOES_NOT_IMPLEMENT_INTERFACE, "Argument 1 of PeerConnectionImpl.addRIDFilter", "MediaStreamTrack");
     897           0 :         return false;
     898             :       }
     899             :     }
     900             :   } else {
     901           0 :     ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 1 of PeerConnectionImpl.addRIDFilter");
     902           0 :     return false;
     903             :   }
     904           0 :   binding_detail::FakeString arg1;
     905           0 :   if (!ConvertJSValueToString(cx, args[1], eStringify, eStringify, arg1)) {
     906           0 :     return false;
     907             :   }
     908           0 :   self->AddRIDFilter(NonNullHelper(arg0), NonNullHelper(Constify(arg1)));
     909           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     910           0 :   args.rval().setUndefined();
     911           0 :   return true;
     912             : }
     913             : 
     914             : static const JSJitInfo addRIDFilter_methodinfo = {
     915             :   { (JSJitGetterOp)addRIDFilter },
     916             :   { prototypes::id::PeerConnectionImpl },
     917             :   { PrototypeTraits<prototypes::id::PeerConnectionImpl>::Depth },
     918             :   JSJitInfo::Method,
     919             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
     920             :   JSVAL_TYPE_UNDEFINED,  /* returnType.  Not relevant for setters. */
     921             :   false,  /* isInfallible. False in setters. */
     922             :   false,  /* isMovable.  Not relevant for setters. */
     923             :   false, /* isEliminatable.  Not relevant for setters. */
     924             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     925             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     926             :   false,  /* isTypedMethod.  Only relevant for methods. */
     927             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     928             : };
     929             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     930             : static_assert(0 < 1, "There is no slot for us");
     931             : 
     932             : static bool
     933           0 : addIceCandidate(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::PeerConnectionImpl* self, const JSJitMethodCallArgs& args)
     934             : {
     935           0 :   if (MOZ_UNLIKELY(args.length() < 3)) {
     936           0 :     return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "PeerConnectionImpl.addIceCandidate");
     937             :   }
     938           0 :   binding_detail::FakeString arg0;
     939           0 :   if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) {
     940           0 :     return false;
     941             :   }
     942           0 :   binding_detail::FakeString arg1;
     943           0 :   if (!ConvertJSValueToString(cx, args[1], eStringify, eStringify, arg1)) {
     944           0 :     return false;
     945             :   }
     946             :   uint16_t arg2;
     947           0 :   if (!ValueToPrimitive<uint16_t, eDefault>(cx, args[2], &arg2)) {
     948           0 :     return false;
     949             :   }
     950           0 :   binding_detail::FastErrorResult rv;
     951           0 :   self->AddIceCandidate(NonNullHelper(Constify(arg0)), NonNullHelper(Constify(arg1)), arg2, rv);
     952           0 :   if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
     953           0 :     return false;
     954             :   }
     955           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     956           0 :   args.rval().setUndefined();
     957           0 :   return true;
     958             : }
     959             : 
     960             : static const JSJitInfo addIceCandidate_methodinfo = {
     961             :   { (JSJitGetterOp)addIceCandidate },
     962             :   { prototypes::id::PeerConnectionImpl },
     963             :   { PrototypeTraits<prototypes::id::PeerConnectionImpl>::Depth },
     964             :   JSJitInfo::Method,
     965             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
     966             :   JSVAL_TYPE_UNDEFINED,  /* returnType.  Not relevant for setters. */
     967             :   false,  /* isInfallible. False in setters. */
     968             :   false,  /* isMovable.  Not relevant for setters. */
     969             :   false, /* isEliminatable.  Not relevant for setters. */
     970             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     971             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     972             :   false,  /* isTypedMethod.  Only relevant for methods. */
     973             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     974             : };
     975             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     976             : static_assert(0 < 1, "There is no slot for us");
     977             : 
     978             : static bool
     979           0 : close(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::PeerConnectionImpl* self, const JSJitMethodCallArgs& args)
     980             : {
     981           0 :   self->Close();
     982           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     983           0 :   args.rval().setUndefined();
     984           0 :   return true;
     985             : }
     986             : 
     987             : static const JSJitInfo close_methodinfo = {
     988             :   { (JSJitGetterOp)close },
     989             :   { prototypes::id::PeerConnectionImpl },
     990             :   { PrototypeTraits<prototypes::id::PeerConnectionImpl>::Depth },
     991             :   JSJitInfo::Method,
     992             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
     993             :   JSVAL_TYPE_UNDEFINED,  /* returnType.  Not relevant for setters. */
     994             :   true,  /* isInfallible. False in setters. */
     995             :   false,  /* isMovable.  Not relevant for setters. */
     996             :   false, /* isEliminatable.  Not relevant for setters. */
     997             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     998             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     999             :   false,  /* isTypedMethod.  Only relevant for methods. */
    1000             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
    1001             : };
    1002             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
    1003             : static_assert(0 < 1, "There is no slot for us");
    1004             : 
    1005             : static bool
    1006           0 : pluginCrash(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::PeerConnectionImpl* self, const JSJitMethodCallArgs& args)
    1007             : {
    1008           0 :   if (MOZ_UNLIKELY(args.length() < 2)) {
    1009           0 :     return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "PeerConnectionImpl.pluginCrash");
    1010             :   }
    1011             :   uint64_t arg0;
    1012           0 :   if (!ValueToPrimitive<uint64_t, eDefault>(cx, args[0], &arg0)) {
    1013           0 :     return false;
    1014             :   }
    1015           0 :   binding_detail::FakeString arg1;
    1016           0 :   if (!ConvertJSValueToString(cx, args[1], eStringify, eStringify, arg1)) {
    1017           0 :     return false;
    1018             :   }
    1019           0 :   bool result(self->PluginCrash(arg0, NonNullHelper(Constify(arg1))));
    1020           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
    1021           0 :   args.rval().setBoolean(result);
    1022           0 :   return true;
    1023             : }
    1024             : 
    1025             : static const JSJitInfo pluginCrash_methodinfo = {
    1026             :   { (JSJitGetterOp)pluginCrash },
    1027             :   { prototypes::id::PeerConnectionImpl },
    1028             :   { PrototypeTraits<prototypes::id::PeerConnectionImpl>::Depth },
    1029             :   JSJitInfo::Method,
    1030             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
    1031             :   JSVAL_TYPE_BOOLEAN,  /* returnType.  Not relevant for setters. */
    1032             :   false,  /* isInfallible. False in setters. */
    1033             :   false,  /* isMovable.  Not relevant for setters. */
    1034             :   false, /* isEliminatable.  Not relevant for setters. */
    1035             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
    1036             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
    1037             :   false,  /* isTypedMethod.  Only relevant for methods. */
    1038             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
    1039             : };
    1040             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
    1041             : static_assert(0 < 1, "There is no slot for us");
    1042             : 
    1043             : static bool
    1044           0 : get_certificate(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::PeerConnectionImpl* self, JSJitGetterCallArgs args)
    1045             : {
    1046           0 :   auto result(StrongOrRawPtr<mozilla::dom::RTCCertificate>(self->Certificate()));
    1047           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
    1048           0 :   if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
    1049           0 :     MOZ_ASSERT(true || JS_IsExceptionPending(cx));
    1050           0 :     return false;
    1051             :   }
    1052           0 :   return true;
    1053             : }
    1054             : 
    1055             : static bool
    1056           0 : set_certificate(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::PeerConnectionImpl* self, JSJitSetterCallArgs args)
    1057             : {
    1058           0 :   NonNull<mozilla::dom::RTCCertificate> arg0;
    1059           0 :   if (args[0].isObject()) {
    1060             :     {
    1061           0 :       nsresult rv = UnwrapObject<prototypes::id::RTCCertificate, mozilla::dom::RTCCertificate>(args[0], arg0);
    1062           0 :       if (NS_FAILED(rv)) {
    1063           0 :         ThrowErrorMessage(cx, MSG_DOES_NOT_IMPLEMENT_INTERFACE, "Value being assigned to PeerConnectionImpl.certificate", "RTCCertificate");
    1064           0 :         return false;
    1065             :       }
    1066             :     }
    1067             :   } else {
    1068           0 :     ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Value being assigned to PeerConnectionImpl.certificate");
    1069           0 :     return false;
    1070             :   }
    1071           0 :   self->SetCertificate(NonNullHelper(arg0));
    1072           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
    1073             : 
    1074           0 :   return true;
    1075             : }
    1076             : 
    1077             : static const JSJitInfo certificate_getterinfo = {
    1078             :   { (JSJitGetterOp)get_certificate },
    1079             :   { prototypes::id::PeerConnectionImpl },
    1080             :   { PrototypeTraits<prototypes::id::PeerConnectionImpl>::Depth },
    1081             :   JSJitInfo::Getter,
    1082             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
    1083             :   JSVAL_TYPE_OBJECT,  /* returnType.  Not relevant for setters. */
    1084             :   false,  /* isInfallible. False in setters. */
    1085             :   false,  /* isMovable.  Not relevant for setters. */
    1086             :   false, /* isEliminatable.  Not relevant for setters. */
    1087             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
    1088             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
    1089             :   false,  /* isTypedMethod.  Only relevant for methods. */
    1090             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
    1091             : };
    1092             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
    1093             : static_assert(0 < 1, "There is no slot for us");
    1094             : static const JSJitInfo certificate_setterinfo = {
    1095             :   { (JSJitGetterOp)set_certificate },
    1096             :   { prototypes::id::PeerConnectionImpl },
    1097             :   { PrototypeTraits<prototypes::id::PeerConnectionImpl>::Depth },
    1098             :   JSJitInfo::Setter,
    1099             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
    1100             :   JSVAL_TYPE_UNDEFINED,  /* returnType.  Not relevant for setters. */
    1101             :   false,  /* isInfallible. False in setters. */
    1102             :   false,  /* isMovable.  Not relevant for setters. */
    1103             :   false, /* isEliminatable.  Not relevant for setters. */
    1104             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
    1105             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
    1106             :   false,  /* isTypedMethod.  Only relevant for methods. */
    1107             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
    1108             : };
    1109             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
    1110             : static_assert(0 < 1, "There is no slot for us");
    1111             : 
    1112             : static bool
    1113           0 : get_fingerprint(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::PeerConnectionImpl* self, JSJitGetterCallArgs args)
    1114             : {
    1115           0 :   DOMString result;
    1116           0 :   self->GetFingerprint(result);
    1117           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
    1118           0 :   if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) {
    1119           0 :     return false;
    1120             :   }
    1121           0 :   return true;
    1122             : }
    1123             : 
    1124             : static const JSJitInfo fingerprint_getterinfo = {
    1125             :   { (JSJitGetterOp)get_fingerprint },
    1126             :   { prototypes::id::PeerConnectionImpl },
    1127             :   { PrototypeTraits<prototypes::id::PeerConnectionImpl>::Depth },
    1128             :   JSJitInfo::Getter,
    1129             :   JSJitInfo::AliasNone, /* aliasSet.  Not relevant for setters. */
    1130             :   JSVAL_TYPE_STRING,  /* returnType.  Not relevant for setters. */
    1131             :   false,  /* isInfallible. False in setters. */
    1132             :   true,  /* isMovable.  Not relevant for setters. */
    1133             :   true, /* isEliminatable.  Not relevant for setters. */
    1134             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
    1135             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
    1136             :   false,  /* isTypedMethod.  Only relevant for methods. */
    1137             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
    1138             : };
    1139             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
    1140             : static_assert(0 < 1, "There is no slot for us");
    1141             : 
    1142             : static bool
    1143           0 : get_localDescription(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::PeerConnectionImpl* self, JSJitGetterCallArgs args)
    1144             : {
    1145           0 :   DOMString result;
    1146           0 :   self->GetLocalDescription(result);
    1147           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
    1148           0 :   if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) {
    1149           0 :     return false;
    1150             :   }
    1151           0 :   return true;
    1152             : }
    1153             : 
    1154             : static const JSJitInfo localDescription_getterinfo = {
    1155             :   { (JSJitGetterOp)get_localDescription },
    1156             :   { prototypes::id::PeerConnectionImpl },
    1157             :   { PrototypeTraits<prototypes::id::PeerConnectionImpl>::Depth },
    1158             :   JSJitInfo::Getter,
    1159             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
    1160             :   JSVAL_TYPE_STRING,  /* returnType.  Not relevant for setters. */
    1161             :   false,  /* isInfallible. False in setters. */
    1162             :   false,  /* isMovable.  Not relevant for setters. */
    1163             :   false, /* isEliminatable.  Not relevant for setters. */
    1164             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
    1165             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
    1166             :   false,  /* isTypedMethod.  Only relevant for methods. */
    1167             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
    1168             : };
    1169             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
    1170             : static_assert(0 < 1, "There is no slot for us");
    1171             : 
    1172             : static bool
    1173           0 : get_currentLocalDescription(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::PeerConnectionImpl* self, JSJitGetterCallArgs args)
    1174             : {
    1175           0 :   DOMString result;
    1176           0 :   self->GetCurrentLocalDescription(result);
    1177           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
    1178           0 :   if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) {
    1179           0 :     return false;
    1180             :   }
    1181           0 :   return true;
    1182             : }
    1183             : 
    1184             : static const JSJitInfo currentLocalDescription_getterinfo = {
    1185             :   { (JSJitGetterOp)get_currentLocalDescription },
    1186             :   { prototypes::id::PeerConnectionImpl },
    1187             :   { PrototypeTraits<prototypes::id::PeerConnectionImpl>::Depth },
    1188             :   JSJitInfo::Getter,
    1189             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
    1190             :   JSVAL_TYPE_STRING,  /* returnType.  Not relevant for setters. */
    1191             :   false,  /* isInfallible. False in setters. */
    1192             :   false,  /* isMovable.  Not relevant for setters. */
    1193             :   false, /* isEliminatable.  Not relevant for setters. */
    1194             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
    1195             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
    1196             :   false,  /* isTypedMethod.  Only relevant for methods. */
    1197             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
    1198             : };
    1199             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
    1200             : static_assert(0 < 1, "There is no slot for us");
    1201             : 
    1202             : static bool
    1203           0 : get_pendingLocalDescription(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::PeerConnectionImpl* self, JSJitGetterCallArgs args)
    1204             : {
    1205           0 :   DOMString result;
    1206           0 :   self->GetPendingLocalDescription(result);
    1207           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
    1208           0 :   if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) {
    1209           0 :     return false;
    1210             :   }
    1211           0 :   return true;
    1212             : }
    1213             : 
    1214             : static const JSJitInfo pendingLocalDescription_getterinfo = {
    1215             :   { (JSJitGetterOp)get_pendingLocalDescription },
    1216             :   { prototypes::id::PeerConnectionImpl },
    1217             :   { PrototypeTraits<prototypes::id::PeerConnectionImpl>::Depth },
    1218             :   JSJitInfo::Getter,
    1219             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
    1220             :   JSVAL_TYPE_STRING,  /* returnType.  Not relevant for setters. */
    1221             :   false,  /* isInfallible. False in setters. */
    1222             :   false,  /* isMovable.  Not relevant for setters. */
    1223             :   false, /* isEliminatable.  Not relevant for setters. */
    1224             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
    1225             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
    1226             :   false,  /* isTypedMethod.  Only relevant for methods. */
    1227             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
    1228             : };
    1229             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
    1230             : static_assert(0 < 1, "There is no slot for us");
    1231             : 
    1232             : static bool
    1233           0 : get_remoteDescription(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::PeerConnectionImpl* self, JSJitGetterCallArgs args)
    1234             : {
    1235           0 :   DOMString result;
    1236           0 :   self->GetRemoteDescription(result);
    1237           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
    1238           0 :   if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) {
    1239           0 :     return false;
    1240             :   }
    1241           0 :   return true;
    1242             : }
    1243             : 
    1244             : static const JSJitInfo remoteDescription_getterinfo = {
    1245             :   { (JSJitGetterOp)get_remoteDescription },
    1246             :   { prototypes::id::PeerConnectionImpl },
    1247             :   { PrototypeTraits<prototypes::id::PeerConnectionImpl>::Depth },
    1248             :   JSJitInfo::Getter,
    1249             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
    1250             :   JSVAL_TYPE_STRING,  /* returnType.  Not relevant for setters. */
    1251             :   false,  /* isInfallible. False in setters. */
    1252             :   false,  /* isMovable.  Not relevant for setters. */
    1253             :   false, /* isEliminatable.  Not relevant for setters. */
    1254             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
    1255             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
    1256             :   false,  /* isTypedMethod.  Only relevant for methods. */
    1257             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
    1258             : };
    1259             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
    1260             : static_assert(0 < 1, "There is no slot for us");
    1261             : 
    1262             : static bool
    1263           0 : get_currentRemoteDescription(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::PeerConnectionImpl* self, JSJitGetterCallArgs args)
    1264             : {
    1265           0 :   DOMString result;
    1266           0 :   self->GetCurrentRemoteDescription(result);
    1267           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
    1268           0 :   if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) {
    1269           0 :     return false;
    1270             :   }
    1271           0 :   return true;
    1272             : }
    1273             : 
    1274             : static const JSJitInfo currentRemoteDescription_getterinfo = {
    1275             :   { (JSJitGetterOp)get_currentRemoteDescription },
    1276             :   { prototypes::id::PeerConnectionImpl },
    1277             :   { PrototypeTraits<prototypes::id::PeerConnectionImpl>::Depth },
    1278             :   JSJitInfo::Getter,
    1279             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
    1280             :   JSVAL_TYPE_STRING,  /* returnType.  Not relevant for setters. */
    1281             :   false,  /* isInfallible. False in setters. */
    1282             :   false,  /* isMovable.  Not relevant for setters. */
    1283             :   false, /* isEliminatable.  Not relevant for setters. */
    1284             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
    1285             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
    1286             :   false,  /* isTypedMethod.  Only relevant for methods. */
    1287             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
    1288             : };
    1289             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
    1290             : static_assert(0 < 1, "There is no slot for us");
    1291             : 
    1292             : static bool
    1293           0 : get_pendingRemoteDescription(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::PeerConnectionImpl* self, JSJitGetterCallArgs args)
    1294             : {
    1295           0 :   DOMString result;
    1296           0 :   self->GetPendingRemoteDescription(result);
    1297           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
    1298           0 :   if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) {
    1299           0 :     return false;
    1300             :   }
    1301           0 :   return true;
    1302             : }
    1303             : 
    1304             : static const JSJitInfo pendingRemoteDescription_getterinfo = {
    1305             :   { (JSJitGetterOp)get_pendingRemoteDescription },
    1306             :   { prototypes::id::PeerConnectionImpl },
    1307             :   { PrototypeTraits<prototypes::id::PeerConnectionImpl>::Depth },
    1308             :   JSJitInfo::Getter,
    1309             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
    1310             :   JSVAL_TYPE_STRING,  /* returnType.  Not relevant for setters. */
    1311             :   false,  /* isInfallible. False in setters. */
    1312             :   false,  /* isMovable.  Not relevant for setters. */
    1313             :   false, /* isEliminatable.  Not relevant for setters. */
    1314             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
    1315             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
    1316             :   false,  /* isTypedMethod.  Only relevant for methods. */
    1317             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
    1318             : };
    1319             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
    1320             : static_assert(0 < 1, "There is no slot for us");
    1321             : 
    1322             : static bool
    1323           0 : get_iceConnectionState(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::PeerConnectionImpl* self, JSJitGetterCallArgs args)
    1324             : {
    1325           0 :   PCImplIceConnectionState result(self->IceConnectionState());
    1326           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
    1327           0 :   if (!ToJSValue(cx, result, args.rval())) {
    1328           0 :     return false;
    1329             :   }
    1330           0 :   return true;
    1331             : }
    1332             : 
    1333             : static const JSJitInfo iceConnectionState_getterinfo = {
    1334             :   { (JSJitGetterOp)get_iceConnectionState },
    1335             :   { prototypes::id::PeerConnectionImpl },
    1336             :   { PrototypeTraits<prototypes::id::PeerConnectionImpl>::Depth },
    1337             :   JSJitInfo::Getter,
    1338             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
    1339             :   JSVAL_TYPE_STRING,  /* returnType.  Not relevant for setters. */
    1340             :   false,  /* isInfallible. False in setters. */
    1341             :   false,  /* isMovable.  Not relevant for setters. */
    1342             :   false, /* isEliminatable.  Not relevant for setters. */
    1343             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
    1344             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
    1345             :   false,  /* isTypedMethod.  Only relevant for methods. */
    1346             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
    1347             : };
    1348             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
    1349             : static_assert(0 < 1, "There is no slot for us");
    1350             : 
    1351             : static bool
    1352           0 : get_iceGatheringState(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::PeerConnectionImpl* self, JSJitGetterCallArgs args)
    1353             : {
    1354           0 :   PCImplIceGatheringState result(self->IceGatheringState());
    1355           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
    1356           0 :   if (!ToJSValue(cx, result, args.rval())) {
    1357           0 :     return false;
    1358             :   }
    1359           0 :   return true;
    1360             : }
    1361             : 
    1362             : static const JSJitInfo iceGatheringState_getterinfo = {
    1363             :   { (JSJitGetterOp)get_iceGatheringState },
    1364             :   { prototypes::id::PeerConnectionImpl },
    1365             :   { PrototypeTraits<prototypes::id::PeerConnectionImpl>::Depth },
    1366             :   JSJitInfo::Getter,
    1367             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
    1368             :   JSVAL_TYPE_STRING,  /* returnType.  Not relevant for setters. */
    1369             :   false,  /* isInfallible. False in setters. */
    1370             :   false,  /* isMovable.  Not relevant for setters. */
    1371             :   false, /* isEliminatable.  Not relevant for setters. */
    1372             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
    1373             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
    1374             :   false,  /* isTypedMethod.  Only relevant for methods. */
    1375             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
    1376             : };
    1377             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
    1378             : static_assert(0 < 1, "There is no slot for us");
    1379             : 
    1380             : static bool
    1381           0 : get_signalingState(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::PeerConnectionImpl* self, JSJitGetterCallArgs args)
    1382             : {
    1383           0 :   PCImplSignalingState result(self->SignalingState());
    1384           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
    1385           0 :   if (!ToJSValue(cx, result, args.rval())) {
    1386           0 :     return false;
    1387             :   }
    1388           0 :   return true;
    1389             : }
    1390             : 
    1391             : static const JSJitInfo signalingState_getterinfo = {
    1392             :   { (JSJitGetterOp)get_signalingState },
    1393             :   { prototypes::id::PeerConnectionImpl },
    1394             :   { PrototypeTraits<prototypes::id::PeerConnectionImpl>::Depth },
    1395             :   JSJitInfo::Getter,
    1396             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
    1397             :   JSVAL_TYPE_STRING,  /* returnType.  Not relevant for setters. */
    1398             :   false,  /* isInfallible. False in setters. */
    1399             :   false,  /* isMovable.  Not relevant for setters. */
    1400             :   false, /* isEliminatable.  Not relevant for setters. */
    1401             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
    1402             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
    1403             :   false,  /* isTypedMethod.  Only relevant for methods. */
    1404             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
    1405             : };
    1406             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
    1407             : static_assert(0 < 1, "There is no slot for us");
    1408             : 
    1409             : static bool
    1410           0 : get_id(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::PeerConnectionImpl* self, JSJitGetterCallArgs args)
    1411             : {
    1412           0 :   DOMString result;
    1413           0 :   self->GetId(result);
    1414           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
    1415           0 :   if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) {
    1416           0 :     return false;
    1417             :   }
    1418           0 :   return true;
    1419             : }
    1420             : 
    1421             : static bool
    1422           0 : set_id(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::PeerConnectionImpl* self, JSJitSetterCallArgs args)
    1423             : {
    1424           0 :   binding_detail::FakeString arg0;
    1425           0 :   if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) {
    1426           0 :     return false;
    1427             :   }
    1428           0 :   self->SetId(NonNullHelper(Constify(arg0)));
    1429           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
    1430             : 
    1431           0 :   return true;
    1432             : }
    1433             : 
    1434             : static const JSJitInfo id_getterinfo = {
    1435             :   { (JSJitGetterOp)get_id },
    1436             :   { prototypes::id::PeerConnectionImpl },
    1437             :   { PrototypeTraits<prototypes::id::PeerConnectionImpl>::Depth },
    1438             :   JSJitInfo::Getter,
    1439             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
    1440             :   JSVAL_TYPE_STRING,  /* returnType.  Not relevant for setters. */
    1441             :   false,  /* isInfallible. False in setters. */
    1442             :   false,  /* isMovable.  Not relevant for setters. */
    1443             :   false, /* isEliminatable.  Not relevant for setters. */
    1444             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
    1445             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
    1446             :   false,  /* isTypedMethod.  Only relevant for methods. */
    1447             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
    1448             : };
    1449             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
    1450             : static_assert(0 < 1, "There is no slot for us");
    1451             : static const JSJitInfo id_setterinfo = {
    1452             :   { (JSJitGetterOp)set_id },
    1453             :   { prototypes::id::PeerConnectionImpl },
    1454             :   { PrototypeTraits<prototypes::id::PeerConnectionImpl>::Depth },
    1455             :   JSJitInfo::Setter,
    1456             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
    1457             :   JSVAL_TYPE_UNDEFINED,  /* returnType.  Not relevant for setters. */
    1458             :   false,  /* isInfallible. False in setters. */
    1459             :   false,  /* isMovable.  Not relevant for setters. */
    1460             :   false, /* isEliminatable.  Not relevant for setters. */
    1461             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
    1462             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
    1463             :   false,  /* isTypedMethod.  Only relevant for methods. */
    1464             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
    1465             : };
    1466             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
    1467             : static_assert(0 < 1, "There is no slot for us");
    1468             : 
    1469             : static bool
    1470           0 : get_peerIdentity(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::PeerConnectionImpl* self, JSJitGetterCallArgs args)
    1471             : {
    1472           0 :   DOMString result;
    1473           0 :   self->GetPeerIdentity(result);
    1474           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
    1475           0 :   if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) {
    1476           0 :     return false;
    1477             :   }
    1478           0 :   return true;
    1479             : }
    1480             : 
    1481             : static bool
    1482           0 : set_peerIdentity(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::PeerConnectionImpl* self, JSJitSetterCallArgs args)
    1483             : {
    1484           0 :   binding_detail::FakeString arg0;
    1485           0 :   if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) {
    1486           0 :     return false;
    1487             :   }
    1488           0 :   self->SetPeerIdentity(NonNullHelper(Constify(arg0)));
    1489           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
    1490             : 
    1491           0 :   return true;
    1492             : }
    1493             : 
    1494             : static const JSJitInfo peerIdentity_getterinfo = {
    1495             :   { (JSJitGetterOp)get_peerIdentity },
    1496             :   { prototypes::id::PeerConnectionImpl },
    1497             :   { PrototypeTraits<prototypes::id::PeerConnectionImpl>::Depth },
    1498             :   JSJitInfo::Getter,
    1499             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
    1500             :   JSVAL_TYPE_STRING,  /* returnType.  Not relevant for setters. */
    1501             :   false,  /* isInfallible. False in setters. */
    1502             :   false,  /* isMovable.  Not relevant for setters. */
    1503             :   false, /* isEliminatable.  Not relevant for setters. */
    1504             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
    1505             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
    1506             :   false,  /* isTypedMethod.  Only relevant for methods. */
    1507             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
    1508             : };
    1509             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
    1510             : static_assert(0 < 1, "There is no slot for us");
    1511             : static const JSJitInfo peerIdentity_setterinfo = {
    1512             :   { (JSJitGetterOp)set_peerIdentity },
    1513             :   { prototypes::id::PeerConnectionImpl },
    1514             :   { PrototypeTraits<prototypes::id::PeerConnectionImpl>::Depth },
    1515             :   JSJitInfo::Setter,
    1516             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
    1517             :   JSVAL_TYPE_UNDEFINED,  /* returnType.  Not relevant for setters. */
    1518             :   false,  /* isInfallible. False in setters. */
    1519             :   false,  /* isMovable.  Not relevant for setters. */
    1520             :   false, /* isEliminatable.  Not relevant for setters. */
    1521             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
    1522             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
    1523             :   false,  /* isTypedMethod.  Only relevant for methods. */
    1524             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
    1525             : };
    1526             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
    1527             : static_assert(0 < 1, "There is no slot for us");
    1528             : 
    1529             : static bool
    1530           0 : get_privacyRequested(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::PeerConnectionImpl* self, JSJitGetterCallArgs args)
    1531             : {
    1532           0 :   bool result(self->PrivacyRequested());
    1533           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
    1534           0 :   args.rval().setBoolean(result);
    1535           0 :   return true;
    1536             : }
    1537             : 
    1538             : static const JSJitInfo privacyRequested_getterinfo = {
    1539             :   { (JSJitGetterOp)get_privacyRequested },
    1540             :   { prototypes::id::PeerConnectionImpl },
    1541             :   { PrototypeTraits<prototypes::id::PeerConnectionImpl>::Depth },
    1542             :   JSJitInfo::Getter,
    1543             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
    1544             :   JSVAL_TYPE_BOOLEAN,  /* returnType.  Not relevant for setters. */
    1545             :   true,  /* isInfallible. False in setters. */
    1546             :   false,  /* isMovable.  Not relevant for setters. */
    1547             :   false, /* isEliminatable.  Not relevant for setters. */
    1548             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
    1549             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
    1550             :   false,  /* isTypedMethod.  Only relevant for methods. */
    1551             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
    1552             : };
    1553             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
    1554             : static_assert(0 < 1, "There is no slot for us");
    1555             : 
    1556             : static bool
    1557           0 : createDataChannel(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::PeerConnectionImpl* self, const JSJitMethodCallArgs& args)
    1558             : {
    1559           0 :   if (MOZ_UNLIKELY(args.length() < 8)) {
    1560           0 :     return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "PeerConnectionImpl.createDataChannel");
    1561             :   }
    1562           0 :   binding_detail::FakeString arg0;
    1563           0 :   if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) {
    1564           0 :     return false;
    1565             :   }
    1566           0 :   binding_detail::FakeString arg1;
    1567           0 :   if (!ConvertJSValueToString(cx, args[1], eStringify, eStringify, arg1)) {
    1568           0 :     return false;
    1569             :   }
    1570             :   uint16_t arg2;
    1571           0 :   if (!ValueToPrimitive<uint16_t, eDefault>(cx, args[2], &arg2)) {
    1572           0 :     return false;
    1573             :   }
    1574             :   bool arg3;
    1575           0 :   if (!ValueToPrimitive<bool, eDefault>(cx, args[3], &arg3)) {
    1576           0 :     return false;
    1577             :   }
    1578             :   uint16_t arg4;
    1579           0 :   if (!ValueToPrimitive<uint16_t, eDefault>(cx, args[4], &arg4)) {
    1580           0 :     return false;
    1581             :   }
    1582             :   uint16_t arg5;
    1583           0 :   if (!ValueToPrimitive<uint16_t, eDefault>(cx, args[5], &arg5)) {
    1584           0 :     return false;
    1585             :   }
    1586             :   bool arg6;
    1587           0 :   if (!ValueToPrimitive<bool, eDefault>(cx, args[6], &arg6)) {
    1588           0 :     return false;
    1589             :   }
    1590             :   uint16_t arg7;
    1591           0 :   if (!ValueToPrimitive<uint16_t, eDefault>(cx, args[7], &arg7)) {
    1592           0 :     return false;
    1593             :   }
    1594           0 :   binding_detail::FastErrorResult rv;
    1595           0 :   auto result(StrongOrRawPtr<nsDOMDataChannel>(self->CreateDataChannel(NonNullHelper(Constify(arg0)), NonNullHelper(Constify(arg1)), arg2, arg3, arg4, arg5, arg6, arg7, rv)));
    1596           0 :   if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
    1597           0 :     return false;
    1598             :   }
    1599           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
    1600           0 :   if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
    1601           0 :     MOZ_ASSERT(true || JS_IsExceptionPending(cx));
    1602           0 :     return false;
    1603             :   }
    1604           0 :   return true;
    1605             : }
    1606             : 
    1607             : static const JSJitInfo createDataChannel_methodinfo = {
    1608             :   { (JSJitGetterOp)createDataChannel },
    1609             :   { prototypes::id::PeerConnectionImpl },
    1610             :   { PrototypeTraits<prototypes::id::PeerConnectionImpl>::Depth },
    1611             :   JSJitInfo::Method,
    1612             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
    1613             :   JSVAL_TYPE_OBJECT,  /* returnType.  Not relevant for setters. */
    1614             :   false,  /* isInfallible. False in setters. */
    1615             :   false,  /* isMovable.  Not relevant for setters. */
    1616             :   false, /* isEliminatable.  Not relevant for setters. */
    1617             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
    1618             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
    1619             :   false,  /* isTypedMethod.  Only relevant for methods. */
    1620             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
    1621             : };
    1622             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
    1623             : static_assert(0 < 1, "There is no slot for us");
    1624             : 
    1625             : static void
    1626           0 : _finalize(js::FreeOp* fop, JSObject* obj)
    1627             : {
    1628           0 :   mozilla::PeerConnectionImpl* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::PeerConnectionImpl>(obj);
    1629           0 :   if (self) {
    1630           0 :     AddForDeferredFinalization<mozilla::PeerConnectionImpl>(self);
    1631             :   }
    1632           0 : }
    1633             : 
    1634             : // We deliberately use brace-elision to make Visual Studio produce better initalization code.
    1635             : #if defined(__clang__)
    1636             : #pragma clang diagnostic push
    1637             : #pragma clang diagnostic ignored "-Wmissing-braces"
    1638             : #endif
    1639             : static const JSFunctionSpec sMethods_specs[] = {
    1640             :   JS_FNSPEC("initialize", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&initialize_methodinfo), 4, JSPROP_ENUMERATE, nullptr),
    1641             :   JS_FNSPEC("createOffer", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&createOffer_methodinfo), 0, JSPROP_ENUMERATE, nullptr),
    1642             :   JS_FNSPEC("createAnswer", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&createAnswer_methodinfo), 0, JSPROP_ENUMERATE, nullptr),
    1643             :   JS_FNSPEC("setLocalDescription", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&setLocalDescription_methodinfo), 2, JSPROP_ENUMERATE, nullptr),
    1644             :   JS_FNSPEC("setRemoteDescription", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&setRemoteDescription_methodinfo), 2, JSPROP_ENUMERATE, nullptr),
    1645             :   JS_FNSPEC("getStats", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&getStats_methodinfo), 1, JSPROP_ENUMERATE, nullptr),
    1646             :   JS_FNSPEC("addTrack", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&addTrack_methodinfo), 1, JSPROP_ENUMERATE, nullptr),
    1647             :   JS_FNSPEC("removeTrack", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&removeTrack_methodinfo), 1, JSPROP_ENUMERATE, nullptr),
    1648             :   JS_FNSPEC("insertDTMF", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&insertDTMF_methodinfo), 2, JSPROP_ENUMERATE, nullptr),
    1649             :   JS_FNSPEC("getDTMFToneBuffer", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&getDTMFToneBuffer_methodinfo), 1, JSPROP_ENUMERATE, nullptr),
    1650             :   JS_FNSPEC("replaceTrack", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&replaceTrack_methodinfo), 2, JSPROP_ENUMERATE, nullptr),
    1651             :   JS_FNSPEC("setParameters", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&setParameters_methodinfo), 1, JSPROP_ENUMERATE, nullptr),
    1652             :   JS_FNSPEC("getParameters", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&getParameters_methodinfo), 1, JSPROP_ENUMERATE, nullptr),
    1653             :   JS_FNSPEC("closeStreams", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&closeStreams_methodinfo), 0, JSPROP_ENUMERATE, nullptr),
    1654             :   JS_FNSPEC("getLocalStreams", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&getLocalStreams_methodinfo), 0, JSPROP_ENUMERATE, nullptr),
    1655             :   JS_FNSPEC("getRemoteStreams", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&getRemoteStreams_methodinfo), 0, JSPROP_ENUMERATE, nullptr),
    1656             :   JS_FNSPEC("addRIDExtension", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&addRIDExtension_methodinfo), 2, JSPROP_ENUMERATE, nullptr),
    1657             :   JS_FNSPEC("addRIDFilter", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&addRIDFilter_methodinfo), 2, JSPROP_ENUMERATE, nullptr),
    1658             :   JS_FNSPEC("addIceCandidate", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&addIceCandidate_methodinfo), 3, JSPROP_ENUMERATE, nullptr),
    1659             :   JS_FNSPEC("close", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&close_methodinfo), 0, JSPROP_ENUMERATE, nullptr),
    1660             :   JS_FNSPEC("pluginCrash", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&pluginCrash_methodinfo), 2, JSPROP_ENUMERATE, nullptr),
    1661             :   JS_FNSPEC("createDataChannel", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&createDataChannel_methodinfo), 8, JSPROP_ENUMERATE, nullptr),
    1662             :   JS_FS_END
    1663             : };
    1664             : #if defined(__clang__)
    1665             : #pragma clang diagnostic pop
    1666             : #endif
    1667             : 
    1668             : 
    1669             : // Can't be const because the pref-enabled boolean needs to be writable
    1670             : static Prefable<const JSFunctionSpec> sMethods[] = {
    1671             :   { nullptr, &sMethods_specs[0] },
    1672             :   { nullptr, nullptr }
    1673             : };
    1674             : 
    1675             : static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX,
    1676             :     "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)");
    1677             : static_assert(22 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX,
    1678             :     "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)");
    1679             : 
    1680             : // We deliberately use brace-elision to make Visual Studio produce better initalization code.
    1681             : #if defined(__clang__)
    1682             : #pragma clang diagnostic push
    1683             : #pragma clang diagnostic ignored "-Wmissing-braces"
    1684             : #endif
    1685             : static const JSPropertySpec sAttributes_specs[] = {
    1686             :   { "certificate", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &certificate_getterinfo, GenericBindingSetter, &certificate_setterinfo },
    1687             :   { "fingerprint", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &fingerprint_getterinfo, nullptr, nullptr },
    1688             :   { "localDescription", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &localDescription_getterinfo, nullptr, nullptr },
    1689             :   { "currentLocalDescription", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &currentLocalDescription_getterinfo, nullptr, nullptr },
    1690             :   { "pendingLocalDescription", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &pendingLocalDescription_getterinfo, nullptr, nullptr },
    1691             :   { "remoteDescription", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &remoteDescription_getterinfo, nullptr, nullptr },
    1692             :   { "currentRemoteDescription", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &currentRemoteDescription_getterinfo, nullptr, nullptr },
    1693             :   { "pendingRemoteDescription", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &pendingRemoteDescription_getterinfo, nullptr, nullptr },
    1694             :   { "iceConnectionState", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &iceConnectionState_getterinfo, nullptr, nullptr },
    1695             :   { "iceGatheringState", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &iceGatheringState_getterinfo, nullptr, nullptr },
    1696             :   { "signalingState", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &signalingState_getterinfo, nullptr, nullptr },
    1697             :   { "id", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &id_getterinfo, GenericBindingSetter, &id_setterinfo },
    1698             :   { "peerIdentity", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &peerIdentity_getterinfo, GenericBindingSetter, &peerIdentity_setterinfo },
    1699             :   { "privacyRequested", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &privacyRequested_getterinfo, nullptr, nullptr },
    1700             :   { nullptr, 0, nullptr, nullptr, nullptr, nullptr }
    1701             : };
    1702             : #if defined(__clang__)
    1703             : #pragma clang diagnostic pop
    1704             : #endif
    1705             : 
    1706             : 
    1707             : // Can't be const because the pref-enabled boolean needs to be writable
    1708             : static Prefable<const JSPropertySpec> sAttributes[] = {
    1709             :   { nullptr, &sAttributes_specs[0] },
    1710             :   { nullptr, nullptr }
    1711             : };
    1712             : 
    1713             : static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX,
    1714             :     "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)");
    1715             : static_assert(14 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX,
    1716             :     "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)");
    1717             : 
    1718             : 
    1719             : static uint16_t sNativeProperties_sortedPropertyIndices[36];
    1720             : static PropertyInfo sNativeProperties_propertyInfos[36];
    1721             : 
    1722             : static const NativePropertiesN<2> sNativeProperties = {
    1723             :   false, 0,
    1724             :   false, 0,
    1725             :   true,  0 /* sMethods */,
    1726             :   true,  1 /* sAttributes */,
    1727             :   false, 0,
    1728             :   false, 0,
    1729             :   false, 0,
    1730             :   -1,
    1731             :   36,
    1732             :   sNativeProperties_sortedPropertyIndices,
    1733             :   {
    1734             :     { sMethods, &sNativeProperties_propertyInfos[0] },
    1735             :     { sAttributes, &sNativeProperties_propertyInfos[22] }
    1736             :   }
    1737             : };
    1738             : static_assert(36 < 1ull << CHAR_BIT * sizeof(sNativeProperties.propertyInfoCount),
    1739             :     "We have a property info count that is oversized");
    1740             : 
    1741             : static bool
    1742           0 : _constructor(JSContext* cx, unsigned argc, JS::Value* vp)
    1743             : {
    1744           0 :   JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
    1745           0 :   JS::Rooted<JSObject*> obj(cx, &args.callee());
    1746           0 :   if (!args.isConstructing()) {
    1747             :     // XXXbz wish I could get the name from the callee instead of
    1748             :     // Adding more relocations
    1749           0 :     return ThrowConstructorWithoutNew(cx, "PeerConnectionImpl");
    1750             :   }
    1751             : 
    1752           0 :   GlobalObject global(cx, obj);
    1753           0 :   if (global.Failed()) {
    1754           0 :     return false;
    1755             :   }
    1756             : 
    1757           0 :   JS::Rooted<JSObject*> desiredProto(cx);
    1758           0 :   if (!GetDesiredProto(cx, args, &desiredProto)) {
    1759           0 :     return false;
    1760             :   }
    1761             : 
    1762           0 :   bool objIsXray = xpc::WrapperFactory::IsXrayWrapper(obj);
    1763           0 :   Maybe<JSAutoCompartment> ac;
    1764           0 :   if (objIsXray) {
    1765           0 :     obj = js::CheckedUnwrap(obj);
    1766           0 :     if (!obj) {
    1767           0 :       return false;
    1768             :     }
    1769           0 :     ac.emplace(cx, obj);
    1770           0 :     if (!JS_WrapObject(cx, &desiredProto)) {
    1771           0 :       return false;
    1772             :     }
    1773             :   }
    1774           0 :   binding_detail::FastErrorResult rv;
    1775           0 :   auto result(StrongOrRawPtr<mozilla::PeerConnectionImpl>(mozilla::PeerConnectionImpl::Constructor(global, rv)));
    1776           0 :   if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
    1777           0 :     return false;
    1778             :   }
    1779           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
    1780             :   static_assert(!IsPointer<decltype(result)>::value,
    1781             :                 "NewObject implies that we need to keep the object alive with a strong reference.");
    1782           0 :   if (!WrapNewBindingNonWrapperCachedObject(cx, obj, result, args.rval(), desiredProto)) {
    1783           0 :     MOZ_ASSERT(true || JS_IsExceptionPending(cx));
    1784           0 :     return false;
    1785             :   }
    1786           0 :   return true;
    1787             : }
    1788             : 
    1789             : static const js::ClassOps sInterfaceObjectClassOps = {
    1790             :     nullptr,               /* addProperty */
    1791             :     nullptr,               /* delProperty */
    1792             :     nullptr,               /* getProperty */
    1793             :     nullptr,               /* setProperty */
    1794             :     nullptr,               /* enumerate */
    1795             :     nullptr,               /* newEnumerate */
    1796             :     nullptr,               /* resolve */
    1797             :     nullptr,               /* mayResolve */
    1798             :     nullptr,               /* finalize */
    1799             :     _constructor, /* call */
    1800             :     nullptr,               /* hasInstance */
    1801             :     _constructor, /* construct */
    1802             :     nullptr,               /* trace */
    1803             : };
    1804             : 
    1805             : static const DOMIfaceAndProtoJSClass sInterfaceObjectClass = {
    1806             :   {
    1807             :     "Function",
    1808             :     JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_SLOTS_BASE),
    1809             :     &sInterfaceObjectClassOps,
    1810             :     JS_NULL_CLASS_SPEC,
    1811             :     JS_NULL_CLASS_EXT,
    1812             :     &sInterfaceObjectClassObjectOps
    1813             :   },
    1814             :   eInterface,
    1815             :   true,
    1816             :   prototypes::id::PeerConnectionImpl,
    1817             :   PrototypeTraits<prototypes::id::PeerConnectionImpl>::Depth,
    1818             :   sNativePropertyHooks,
    1819             :   "function PeerConnectionImpl() {\n    [native code]\n}",
    1820             :   JS::GetRealmFunctionPrototype
    1821             : };
    1822             : 
    1823             : static const DOMIfaceAndProtoJSClass sPrototypeClass = {
    1824             :   {
    1825             :     "PeerConnectionImplPrototype",
    1826             :     JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_PROTO_SLOTS_BASE),
    1827             :     JS_NULL_CLASS_OPS,
    1828             :     JS_NULL_CLASS_SPEC,
    1829             :     JS_NULL_CLASS_EXT,
    1830             :     JS_NULL_OBJECT_OPS
    1831             :   },
    1832             :   eInterfacePrototype,
    1833             :   false,
    1834             :   prototypes::id::PeerConnectionImpl,
    1835             :   PrototypeTraits<prototypes::id::PeerConnectionImpl>::Depth,
    1836             :   sNativePropertyHooks,
    1837             :   "[object PeerConnectionImplPrototype]",
    1838             :   JS::GetRealmObjectPrototype
    1839             : };
    1840             : 
    1841             : bool
    1842           0 : ConstructorEnabled(JSContext* aCx, JS::Handle<JSObject*> aObj)
    1843             : {
    1844           0 :   return nsContentUtils::ThreadsafeIsSystemCaller(aCx);
    1845             : }
    1846             : 
    1847             : JSObject*
    1848           0 : DefineDOMInterface(JSContext* aCx, JS::Handle<JSObject*> aGlobal, JS::Handle<jsid> id, bool aDefineOnGlobal)
    1849             : {
    1850           0 :   return GetConstructorObjectHandle(aCx, aDefineOnGlobal);
    1851             : }
    1852             : 
    1853             : static const js::ClassOps sClassOps = {
    1854             :   nullptr, /* addProperty */
    1855             :   nullptr,               /* delProperty */
    1856             :   nullptr,               /* getProperty */
    1857             :   nullptr,               /* setProperty */
    1858             :   nullptr,               /* enumerate */
    1859             :   nullptr, /* newEnumerate */
    1860             :   nullptr, /* resolve */
    1861             :   nullptr, /* mayResolve */
    1862             :   _finalize, /* finalize */
    1863             :   nullptr, /* call */
    1864             :   nullptr,               /* hasInstance */
    1865             :   nullptr,               /* construct */
    1866             :   nullptr, /* trace */
    1867             : };
    1868             : 
    1869             : static const js::ClassExtension sClassExtension = {
    1870             :   nullptr, /* weakmapKeyDelegateOp */
    1871             :   nullptr /* objectMovedOp */
    1872             : };
    1873             : 
    1874             : static const DOMJSClass sClass = {
    1875             :   { "PeerConnectionImpl",
    1876             :     JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE | JSCLASS_HAS_RESERVED_SLOTS(1),
    1877             :     &sClassOps,
    1878             :     JS_NULL_CLASS_SPEC,
    1879             :     &sClassExtension,
    1880             :     JS_NULL_OBJECT_OPS
    1881             :   },
    1882             :   { prototypes::id::PeerConnectionImpl, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count },
    1883             :   IsBaseOf<nsISupports, mozilla::PeerConnectionImpl >::value,
    1884             :   sNativePropertyHooks,
    1885             :   FindAssociatedGlobalForNative<mozilla::PeerConnectionImpl>::Get,
    1886             :   GetProtoObjectHandle,
    1887             :   GetCCParticipant<mozilla::PeerConnectionImpl>::Get()
    1888             : };
    1889             : static_assert(1 == DOM_INSTANCE_RESERVED_SLOTS,
    1890             :               "Must have the right minimal number of reserved slots.");
    1891             : static_assert(1 >= 1,
    1892             :               "Must have enough reserved slots.");
    1893             : 
    1894             : const JSClass*
    1895           0 : GetJSClass()
    1896             : {
    1897           0 :   return sClass.ToJSClass();
    1898             : }
    1899             : 
    1900             : bool
    1901           0 : Wrap(JSContext* aCx, mozilla::PeerConnectionImpl* aObject, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector)
    1902             : {
    1903             :   MOZ_ASSERT(static_cast<mozilla::PeerConnectionImpl*>(aObject) ==
    1904             :              reinterpret_cast<mozilla::PeerConnectionImpl*>(aObject),
    1905             :              "Multiple inheritance for mozilla::PeerConnectionImpl is broken.");
    1906           0 :   MOZ_ASSERT(ToSupportsIsCorrect(aObject));
    1907           0 :   MOZ_ASSERT_IF(aGivenProto, js::IsObjectInContextCompartment(aGivenProto, aCx));
    1908             : 
    1909           0 :   JS::Rooted<JSObject*> global(aCx, JS::CurrentGlobalOrNull(aCx));
    1910           0 :   JS::Handle<JSObject*> canonicalProto = GetProtoObjectHandle(aCx);
    1911           0 :   if (!canonicalProto) {
    1912           0 :     return false;
    1913             :   }
    1914           0 :   JS::Rooted<JSObject*> proto(aCx);
    1915           0 :   if (aGivenProto) {
    1916           0 :     proto = aGivenProto;
    1917             :     // Unfortunately, while aGivenProto was in the compartment of aCx
    1918             :     // coming in, we changed compartments to that of "parent" so may need
    1919             :     // to wrap the proto here.
    1920           0 :     if (js::GetContextCompartment(aCx) != js::GetObjectCompartment(proto)) {
    1921           0 :       if (!JS_WrapObject(aCx, &proto)) {
    1922           0 :         return false;
    1923             :       }
    1924             :     }
    1925             :   } else {
    1926           0 :     proto = canonicalProto;
    1927             :   }
    1928             : 
    1929           0 :   BindingJSObjectCreator<mozilla::PeerConnectionImpl> creator(aCx);
    1930           0 :   creator.CreateObject(aCx, sClass.ToJSClass(), proto, aObject, aReflector);
    1931           0 :   if (!aReflector) {
    1932           0 :     return false;
    1933             :   }
    1934             : 
    1935             : 
    1936             : 
    1937           0 :   creator.InitializationSucceeded();
    1938           0 :   return true;
    1939             : }
    1940             : 
    1941             : const NativePropertyHooks sNativePropertyHooks[] = { {
    1942             :   nullptr,
    1943             :   nullptr,
    1944             :   nullptr,
    1945             :   { sNativeProperties.Upcast(), nullptr },
    1946             :   prototypes::id::PeerConnectionImpl,
    1947             :   constructors::id::PeerConnectionImpl,
    1948             :   nullptr,
    1949             :   &DefaultXrayExpandoObjectClass
    1950             : } };
    1951             : 
    1952             : void
    1953           0 : CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal)
    1954             : {
    1955           0 :   JS::Rooted<JSObject*> parentProto(aCx, JS::GetRealmObjectPrototype(aCx));
    1956           0 :   if (!parentProto) {
    1957           0 :     return;
    1958             :   }
    1959             : 
    1960           0 :   JS::Rooted<JSObject*> constructorProto(aCx, JS::GetRealmFunctionPrototype(aCx));
    1961           0 :   if (!constructorProto) {
    1962           0 :     return;
    1963             :   }
    1964             : 
    1965             :   static bool sIdsInited = false;
    1966           0 :   if (!sIdsInited && NS_IsMainThread()) {
    1967           0 :     if (!InitIds(aCx, sNativeProperties.Upcast())) {
    1968           0 :       return;
    1969             :     }
    1970           0 :     sIdsInited = true;
    1971             :   }
    1972             : 
    1973           0 :   JS::Heap<JSObject*>* protoCache = &aProtoAndIfaceCache.EntrySlotOrCreate(prototypes::id::PeerConnectionImpl);
    1974           0 :   JS::Heap<JSObject*>* interfaceCache = &aProtoAndIfaceCache.EntrySlotOrCreate(constructors::id::PeerConnectionImpl);
    1975           0 :   dom::CreateInterfaceObjects(aCx, aGlobal, parentProto,
    1976             :                               &sPrototypeClass.mBase, protoCache,
    1977             :                               constructorProto, &sInterfaceObjectClass.mBase, 0, nullptr,
    1978             :                               interfaceCache,
    1979             :                               sNativeProperties.Upcast(),
    1980             :                               nullptr,
    1981             :                               "PeerConnectionImpl", aDefineOnGlobal,
    1982             :                               nullptr,
    1983           0 :                               false);
    1984             : }
    1985             : 
    1986             : JS::Handle<JSObject*>
    1987           0 : GetProtoObjectHandle(JSContext* aCx)
    1988             : {
    1989             :   /* Get the interface prototype object for this class.  This will create the
    1990             :      object as needed. */
    1991           0 :   bool aDefineOnGlobal = true;
    1992             : 
    1993             :   /* Make sure our global is sane.  Hopefully we can remove this sometime */
    1994           0 :   JSObject* global = JS::CurrentGlobalOrNull(aCx);
    1995           0 :   if (!(js::GetObjectClass(global)->flags & JSCLASS_DOM_GLOBAL)) {
    1996           0 :     return nullptr;
    1997             :   }
    1998             : 
    1999             :   /* Check to see whether the interface objects are already installed */
    2000           0 :   ProtoAndIfaceCache& protoAndIfaceCache = *GetProtoAndIfaceCache(global);
    2001           0 :   if (!protoAndIfaceCache.HasEntryInSlot(prototypes::id::PeerConnectionImpl)) {
    2002           0 :     JS::Rooted<JSObject*> rootedGlobal(aCx, global);
    2003           0 :     CreateInterfaceObjects(aCx, rootedGlobal, protoAndIfaceCache, aDefineOnGlobal);
    2004             :   }
    2005             : 
    2006             :   /*
    2007             :    * The object might _still_ be null, but that's OK.
    2008             :    *
    2009             :    * Calling fromMarkedLocation() is safe because protoAndIfaceCache is
    2010             :    * traced by TraceProtoAndIfaceCache() and its contents are never
    2011             :    * changed after they have been set.
    2012             :    *
    2013             :    * Calling address() avoids the read read barrier that does gray
    2014             :    * unmarking, but it's not possible for the object to be gray here.
    2015             :    */
    2016             : 
    2017           0 :   const JS::Heap<JSObject*>& entrySlot = protoAndIfaceCache.EntrySlotMustExist(prototypes::id::PeerConnectionImpl);
    2018           0 :   MOZ_ASSERT(JS::ObjectIsNotGray(entrySlot));
    2019           0 :   return JS::Handle<JSObject*>::fromMarkedLocation(entrySlot.address());
    2020             : }
    2021             : 
    2022             : JS::Handle<JSObject*>
    2023           0 : GetConstructorObjectHandle(JSContext* aCx, bool aDefineOnGlobal)
    2024             : {
    2025             :   /* Get the interface object for this class.  This will create the object as
    2026             :      needed. */
    2027             : 
    2028             :   /* Make sure our global is sane.  Hopefully we can remove this sometime */
    2029           0 :   JSObject* global = JS::CurrentGlobalOrNull(aCx);
    2030           0 :   if (!(js::GetObjectClass(global)->flags & JSCLASS_DOM_GLOBAL)) {
    2031           0 :     return nullptr;
    2032             :   }
    2033             : 
    2034             :   /* Check to see whether the interface objects are already installed */
    2035           0 :   ProtoAndIfaceCache& protoAndIfaceCache = *GetProtoAndIfaceCache(global);
    2036           0 :   if (!protoAndIfaceCache.HasEntryInSlot(constructors::id::PeerConnectionImpl)) {
    2037           0 :     JS::Rooted<JSObject*> rootedGlobal(aCx, global);
    2038           0 :     CreateInterfaceObjects(aCx, rootedGlobal, protoAndIfaceCache, aDefineOnGlobal);
    2039             :   }
    2040             : 
    2041             :   /*
    2042             :    * The object might _still_ be null, but that's OK.
    2043             :    *
    2044             :    * Calling fromMarkedLocation() is safe because protoAndIfaceCache is
    2045             :    * traced by TraceProtoAndIfaceCache() and its contents are never
    2046             :    * changed after they have been set.
    2047             :    *
    2048             :    * Calling address() avoids the read read barrier that does gray
    2049             :    * unmarking, but it's not possible for the object to be gray here.
    2050             :    */
    2051             : 
    2052           0 :   const JS::Heap<JSObject*>& entrySlot = protoAndIfaceCache.EntrySlotMustExist(constructors::id::PeerConnectionImpl);
    2053           0 :   MOZ_ASSERT(JS::ObjectIsNotGray(entrySlot));
    2054           0 :   return JS::Handle<JSObject*>::fromMarkedLocation(entrySlot.address());
    2055             : }
    2056             : 
    2057             : JSObject*
    2058           0 : GetConstructorObject(JSContext* aCx)
    2059             : {
    2060           0 :   return GetConstructorObjectHandle(aCx);
    2061             : }
    2062             : 
    2063             : } // namespace PeerConnectionImplBinding
    2064             : 
    2065             : 
    2066             : 
    2067             : } // namespace dom
    2068             : } // namespace mozilla

Generated by: LCOV version 1.13