LCOV - code coverage report
Current view: top level - obj-x86_64-pc-linux-gnu/dist/include/mozilla/dom - RTCPeerConnectionBinding.h (source / functions) Hit Total Coverage
Test: output.info Lines: 0 121 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 56 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* THIS FILE IS AUTOGENERATED FROM RTCPeerConnection.webidl BY Codegen.py - DO NOT EDIT */
       2             : 
       3             : #ifndef mozilla_dom_RTCPeerConnectionBinding_h
       4             : #define mozilla_dom_RTCPeerConnectionBinding_h
       5             : 
       6             : #include "RTCIceCandidateBinding.h"
       7             : #include "RTCPeerConnectionBinding.h"
       8             : #include "js/RootingAPI.h"
       9             : #include "jspubtd.h"
      10             : #include "mozilla/DOMEventTargetHelper.h"
      11             : #include "mozilla/ErrorResult.h"
      12             : #include "mozilla/dom/BindingDeclarations.h"
      13             : #include "mozilla/dom/CallbackFunction.h"
      14             : #include "mozilla/dom/CallbackInterface.h"
      15             : #include "mozilla/dom/FakeString.h"
      16             : #include "mozilla/dom/Nullable.h"
      17             : #include "mozilla/dom/ToJSValue.h"
      18             : #include "mozilla/dom/UnionMember.h"
      19             : #include "nsWeakReference.h"
      20             : 
      21             : class nsIDOMDataChannel;
      22             : 
      23             : namespace mozilla {
      24             : 
      25             : class DOMMediaStream;
      26             : 
      27             : namespace dom {
      28             : 
      29             : class DOMError;
      30             : class EventHandlerNonNull;
      31             : class MediaStreamTrack;
      32             : struct NativePropertyHooks;
      33             : class ObjectOrString;
      34             : class OwningObjectOrString;
      35             : class OwningRTCIceCandidateInitOrRTCIceCandidate;
      36             : class Promise;
      37             : class ProtoAndIfaceCache;
      38             : struct RTCAnswerOptions;
      39             : struct RTCConfiguration;
      40             : struct RTCDataChannelInit;
      41             : struct RTCDataChannelInitAtoms;
      42             : class RTCIceCandidate;
      43             : class RTCIceCandidateInitOrRTCIceCandidate;
      44             : struct RTCOfferOptions;
      45             : struct RTCOfferOptionsAtoms;
      46             : class RTCPeerConnection;
      47             : struct RTCPeerConnectionAtoms;
      48             : class RTCPeerConnectionErrorCallback;
      49             : class RTCRtpReceiver;
      50             : class RTCRtpSender;
      51             : class RTCSessionDescription;
      52             : class RTCSessionDescriptionCallback;
      53             : struct RTCSessionDescriptionInit;
      54             : class RTCStatsCallback;
      55             : class RTCStatsReport;
      56             : class VoidFunction;
      57             : 
      58             : } // namespace dom
      59             : 
      60             : } // namespace mozilla
      61             : 
      62             : namespace mozilla {
      63             : namespace dom {
      64             : 
      65             : enum class RTCSignalingState : uint8_t {
      66             :   Stable,
      67             :   Have_local_offer,
      68             :   Have_remote_offer,
      69             :   Have_local_pranswer,
      70             :   Have_remote_pranswer,
      71             :   Closed,
      72             :   EndGuard_
      73             : };
      74             : 
      75             : namespace RTCSignalingStateValues {
      76             : extern const EnumEntry strings[7];
      77             : } // namespace RTCSignalingStateValues
      78             : 
      79             : bool
      80             : ToJSValue(JSContext* aCx, RTCSignalingState aArgument, JS::MutableHandle<JS::Value> aValue);
      81             : 
      82             : 
      83             : enum class RTCIceGatheringState : uint8_t {
      84             :   New,
      85             :   Gathering,
      86             :   Complete,
      87             :   EndGuard_
      88             : };
      89             : 
      90             : namespace RTCIceGatheringStateValues {
      91             : extern const EnumEntry strings[4];
      92             : } // namespace RTCIceGatheringStateValues
      93             : 
      94             : bool
      95             : ToJSValue(JSContext* aCx, RTCIceGatheringState aArgument, JS::MutableHandle<JS::Value> aValue);
      96             : 
      97             : 
      98             : enum class RTCIceConnectionState : uint8_t {
      99             :   New,
     100             :   Checking,
     101             :   Connected,
     102             :   Completed,
     103             :   Failed,
     104             :   Disconnected,
     105             :   Closed,
     106             :   EndGuard_
     107             : };
     108             : 
     109             : namespace RTCIceConnectionStateValues {
     110             : extern const EnumEntry strings[8];
     111             : } // namespace RTCIceConnectionStateValues
     112             : 
     113             : bool
     114             : ToJSValue(JSContext* aCx, RTCIceConnectionState aArgument, JS::MutableHandle<JS::Value> aValue);
     115             : 
     116             : 
     117             : void
     118             : ImplCycleCollectionTraverse(nsCycleCollectionTraversalCallback& aCallback, OwningRTCIceCandidateInitOrRTCIceCandidate& aUnion, const char* aName, uint32_t aFlags = 0);
     119             : 
     120             : 
     121             : void
     122             : ImplCycleCollectionUnlink(OwningRTCIceCandidateInitOrRTCIceCandidate& aUnion);
     123             : 
     124             : 
     125           0 : struct RTCDataChannelInit : public DictionaryBase
     126             : {
     127             :   MOZ_INIT_OUTSIDE_CTOR Optional<uint16_t> mId;
     128             :   MOZ_INIT_OUTSIDE_CTOR Optional<uint16_t> mMaxPacketLifeTime;
     129             :   MOZ_INIT_OUTSIDE_CTOR Optional<uint16_t> mMaxRetransmitTime;
     130             :   MOZ_INIT_OUTSIDE_CTOR Optional<uint16_t> mMaxRetransmits;
     131             :   MOZ_INIT_OUTSIDE_CTOR bool mNegotiated;
     132             :   MOZ_INIT_OUTSIDE_CTOR bool mOrdered;
     133             :   MOZ_INIT_OUTSIDE_CTOR nsString mProtocol;
     134             : 
     135             :   RTCDataChannelInit();
     136             : 
     137           0 :   explicit inline RTCDataChannelInit(const FastDictionaryInitializer& )
     138           0 :   {
     139             :     // Do nothing here; this is used by our "Fast" subclass
     140           0 :   }
     141             : 
     142             :   explicit inline RTCDataChannelInit(const RTCDataChannelInit& aOther)
     143             :   {
     144             :     *this = aOther;
     145             :   }
     146             : 
     147             :   bool
     148             :   Init(JSContext* cx, JS::Handle<JS::Value> val, const char* sourceDescription = "Value", bool passedToJSImpl = false);
     149             : 
     150             :   bool
     151             :   Init(const nsAString& aJSON);
     152             : 
     153             :   bool
     154             :   ToObjectInternal(JSContext* cx, JS::MutableHandle<JS::Value> rval) const;
     155             : 
     156             :   bool
     157             :   ToJSON(nsAString& aJSON) const;
     158             : 
     159             :   void
     160             :   TraceDictionary(JSTracer* trc);
     161             : 
     162             :   RTCDataChannelInit&
     163             :   operator=(const RTCDataChannelInit& aOther);
     164             : 
     165             : private:
     166             :   static bool
     167             :   InitIds(JSContext* cx, RTCDataChannelInitAtoms* atomsCache);
     168             : };
     169             : 
     170             : namespace binding_detail {
     171           0 : struct FastRTCDataChannelInit : public RTCDataChannelInit
     172             : {
     173           0 :   inline FastRTCDataChannelInit()
     174           0 :     : RTCDataChannelInit(FastDictionaryInitializer())
     175             :   {
     176             :     // Doesn't matter what int we pass to the parent constructor
     177           0 :   }
     178             : };
     179             : } // namespace binding_detail
     180             : 
     181             : 
     182             : class RTCIceCandidateInitOrRTCIceCandidate
     183             : {
     184             :   friend class RTCIceCandidateInitOrRTCIceCandidateArgument;
     185             :   enum Type
     186             :   {
     187             :     eUninitialized,
     188             :     eRTCIceCandidateInit,
     189             :     eRTCIceCandidate
     190             :   };
     191             : 
     192           0 :   union Value
     193             :   {
     194             :     UnionMember<binding_detail::FastRTCIceCandidateInit > mRTCIceCandidateInit;
     195             :     UnionMember<NonNull<mozilla::dom::RTCIceCandidate> > mRTCIceCandidate;
     196             : 
     197             :   };
     198             : 
     199             :   Type mType;
     200             :   Value mValue;
     201             : 
     202             :   RTCIceCandidateInitOrRTCIceCandidate(const RTCIceCandidateInitOrRTCIceCandidate&) = delete;
     203             :   RTCIceCandidateInitOrRTCIceCandidate& operator=(const RTCIceCandidateInitOrRTCIceCandidate&) = delete;
     204             : public:
     205           0 :   explicit inline RTCIceCandidateInitOrRTCIceCandidate()
     206           0 :     : mType(eUninitialized)
     207             :   {
     208           0 :   }
     209             : 
     210           0 :   inline ~RTCIceCandidateInitOrRTCIceCandidate()
     211           0 :   {
     212           0 :     Uninit();
     213           0 :   }
     214             : 
     215             :   inline binding_detail::FastRTCIceCandidateInit&
     216             :   RawSetAsRTCIceCandidateInit()
     217             :   {
     218             :     if (mType == eRTCIceCandidateInit) {
     219             :       return mValue.mRTCIceCandidateInit.Value();
     220             :     }
     221             :     MOZ_ASSERT(mType == eUninitialized);
     222             :     mType = eRTCIceCandidateInit;
     223             :     return mValue.mRTCIceCandidateInit.SetValue();
     224             :   }
     225             : 
     226             :   inline binding_detail::FastRTCIceCandidateInit&
     227             :   SetAsRTCIceCandidateInit()
     228             :   {
     229             :     if (mType == eRTCIceCandidateInit) {
     230             :       return mValue.mRTCIceCandidateInit.Value();
     231             :     }
     232             :     Uninit();
     233             :     mType = eRTCIceCandidateInit;
     234             :     return mValue.mRTCIceCandidateInit.SetValue();
     235             :   }
     236             : 
     237             :   inline bool
     238           0 :   IsRTCIceCandidateInit() const
     239             :   {
     240           0 :     return mType == eRTCIceCandidateInit;
     241             :   }
     242             : 
     243             :   inline binding_detail::FastRTCIceCandidateInit&
     244             :   GetAsRTCIceCandidateInit()
     245             :   {
     246             :     MOZ_ASSERT(IsRTCIceCandidateInit(), "Wrong type!");
     247             :     return mValue.mRTCIceCandidateInit.Value();
     248             :   }
     249             : 
     250             :   inline const RTCIceCandidateInit&
     251             :   GetAsRTCIceCandidateInit() const
     252             :   {
     253             :     MOZ_ASSERT(IsRTCIceCandidateInit(), "Wrong type!");
     254             :     return mValue.mRTCIceCandidateInit.Value();
     255             :   }
     256             : 
     257             :   inline NonNull<mozilla::dom::RTCIceCandidate>&
     258             :   RawSetAsRTCIceCandidate()
     259             :   {
     260             :     if (mType == eRTCIceCandidate) {
     261             :       return mValue.mRTCIceCandidate.Value();
     262             :     }
     263             :     MOZ_ASSERT(mType == eUninitialized);
     264             :     mType = eRTCIceCandidate;
     265             :     return mValue.mRTCIceCandidate.SetValue();
     266             :   }
     267             : 
     268             :   inline NonNull<mozilla::dom::RTCIceCandidate>&
     269             :   SetAsRTCIceCandidate()
     270             :   {
     271             :     if (mType == eRTCIceCandidate) {
     272             :       return mValue.mRTCIceCandidate.Value();
     273             :     }
     274             :     Uninit();
     275             :     mType = eRTCIceCandidate;
     276             :     return mValue.mRTCIceCandidate.SetValue();
     277             :   }
     278             : 
     279             :   inline bool
     280           0 :   IsRTCIceCandidate() const
     281             :   {
     282           0 :     return mType == eRTCIceCandidate;
     283             :   }
     284             : 
     285             :   inline NonNull<mozilla::dom::RTCIceCandidate>&
     286             :   GetAsRTCIceCandidate()
     287             :   {
     288             :     MOZ_ASSERT(IsRTCIceCandidate(), "Wrong type!");
     289             :     return mValue.mRTCIceCandidate.Value();
     290             :   }
     291             : 
     292             :   inline mozilla::dom::RTCIceCandidate&
     293             :   GetAsRTCIceCandidate() const
     294             :   {
     295             :     MOZ_ASSERT(IsRTCIceCandidate(), "Wrong type!");
     296             :     return mValue.mRTCIceCandidate.Value();
     297             :   }
     298             : 
     299             :   inline void
     300           0 :   Uninit()
     301             :   {
     302           0 :     switch (mType) {
     303             :       case eUninitialized: {
     304           0 :         break;
     305             :       }
     306             :       case eRTCIceCandidateInit: {
     307           0 :         DestroyRTCIceCandidateInit();
     308           0 :         break;
     309             :       }
     310             :       case eRTCIceCandidate: {
     311           0 :         DestroyRTCIceCandidate();
     312           0 :         break;
     313             :       }
     314             :     }
     315           0 :   }
     316             : 
     317             :   bool
     318             :   ToJSVal(JSContext* cx, JS::Handle<JSObject*> scopeObj, JS::MutableHandle<JS::Value> rval) const;
     319             : 
     320             : private:
     321             :   inline void
     322           0 :   DestroyRTCIceCandidateInit()
     323             :   {
     324           0 :     MOZ_ASSERT(IsRTCIceCandidateInit(), "Wrong type!");
     325           0 :     mValue.mRTCIceCandidateInit.Destroy();
     326           0 :     mType = eUninitialized;
     327           0 :   }
     328             : 
     329             :   inline void
     330           0 :   DestroyRTCIceCandidate()
     331             :   {
     332           0 :     MOZ_ASSERT(IsRTCIceCandidate(), "Wrong type!");
     333           0 :     mValue.mRTCIceCandidate.Destroy();
     334           0 :     mType = eUninitialized;
     335           0 :   }
     336             : };
     337             : 
     338             : 
     339             : class OwningRTCIceCandidateInitOrRTCIceCandidate : public AllOwningUnionBase
     340             : {
     341             :   friend void ImplCycleCollectionUnlink(OwningRTCIceCandidateInitOrRTCIceCandidate& aUnion);
     342             :   enum Type
     343             :   {
     344             :     eUninitialized,
     345             :     eRTCIceCandidateInit,
     346             :     eRTCIceCandidate
     347             :   };
     348             : 
     349             :   union Value
     350             :   {
     351             :     UnionMember<RTCIceCandidateInit > mRTCIceCandidateInit;
     352             :     UnionMember<OwningNonNull<mozilla::dom::RTCIceCandidate> > mRTCIceCandidate;
     353             : 
     354             :   };
     355             : 
     356             :   Type mType;
     357             :   Value mValue;
     358             : 
     359             : public:
     360             :   explicit inline OwningRTCIceCandidateInitOrRTCIceCandidate()
     361             :     : mType(eUninitialized)
     362             :   {
     363             :   }
     364             : 
     365             :   explicit inline OwningRTCIceCandidateInitOrRTCIceCandidate(const OwningRTCIceCandidateInitOrRTCIceCandidate& aOther)
     366             :     : mType(eUninitialized)
     367             :   {
     368             :     *this = aOther;
     369             :   }
     370             : 
     371             :   inline ~OwningRTCIceCandidateInitOrRTCIceCandidate()
     372             :   {
     373             :     Uninit();
     374             :   }
     375             : 
     376             :   RTCIceCandidateInit&
     377             :   RawSetAsRTCIceCandidateInit();
     378             : 
     379             :   RTCIceCandidateInit&
     380             :   SetAsRTCIceCandidateInit();
     381             : 
     382             :   bool
     383             :   TrySetToRTCIceCandidateInit(JSContext* cx, JS::Handle<JS::Value> value, bool& tryNext, bool passedToJSImpl = false);
     384             : 
     385             :   inline bool
     386           0 :   IsRTCIceCandidateInit() const
     387             :   {
     388           0 :     return mType == eRTCIceCandidateInit;
     389             :   }
     390             : 
     391             :   inline RTCIceCandidateInit&
     392             :   GetAsRTCIceCandidateInit()
     393             :   {
     394             :     MOZ_ASSERT(IsRTCIceCandidateInit(), "Wrong type!");
     395             :     return mValue.mRTCIceCandidateInit.Value();
     396             :   }
     397             : 
     398             :   inline RTCIceCandidateInit const &
     399           0 :   GetAsRTCIceCandidateInit() const
     400             :   {
     401           0 :     MOZ_ASSERT(IsRTCIceCandidateInit(), "Wrong type!");
     402           0 :     return mValue.mRTCIceCandidateInit.Value();
     403             :   }
     404             : 
     405             :   OwningNonNull<mozilla::dom::RTCIceCandidate>&
     406             :   RawSetAsRTCIceCandidate();
     407             : 
     408             :   OwningNonNull<mozilla::dom::RTCIceCandidate>&
     409             :   SetAsRTCIceCandidate();
     410             : 
     411             :   bool
     412             :   TrySetToRTCIceCandidate(JSContext* cx, JS::Handle<JS::Value> value, bool& tryNext, bool passedToJSImpl = false);
     413             : 
     414             :   inline bool
     415           0 :   IsRTCIceCandidate() const
     416             :   {
     417           0 :     return mType == eRTCIceCandidate;
     418             :   }
     419             : 
     420             :   inline OwningNonNull<mozilla::dom::RTCIceCandidate>&
     421           0 :   GetAsRTCIceCandidate()
     422             :   {
     423           0 :     MOZ_ASSERT(IsRTCIceCandidate(), "Wrong type!");
     424           0 :     return mValue.mRTCIceCandidate.Value();
     425             :   }
     426             : 
     427             :   inline OwningNonNull<mozilla::dom::RTCIceCandidate> const &
     428           0 :   GetAsRTCIceCandidate() const
     429             :   {
     430           0 :     MOZ_ASSERT(IsRTCIceCandidate(), "Wrong type!");
     431           0 :     return mValue.mRTCIceCandidate.Value();
     432             :   }
     433             : 
     434             :   void
     435             :   Uninit();
     436             : 
     437             :   bool
     438             :   ToJSVal(JSContext* cx, JS::Handle<JSObject*> scopeObj, JS::MutableHandle<JS::Value> rval) const;
     439             : 
     440             :   void
     441             :   TraceUnion(JSTracer* trc);
     442             : 
     443             :   OwningRTCIceCandidateInitOrRTCIceCandidate&
     444             :   operator=(const OwningRTCIceCandidateInitOrRTCIceCandidate& aOther);
     445             : 
     446             : private:
     447             :   void
     448             :   DestroyRTCIceCandidateInit();
     449             : 
     450             :   void
     451             :   DestroyRTCIceCandidate();
     452             : };
     453             : 
     454             : 
     455             : struct RTCOfferAnswerOptions : public DictionaryBase
     456             : {
     457             :   RTCOfferAnswerOptions();
     458             : 
     459           0 :   explicit inline RTCOfferAnswerOptions(const FastDictionaryInitializer& )
     460           0 :   {
     461             :     // Do nothing here; this is used by our "Fast" subclass
     462           0 :   }
     463             : 
     464             :   explicit inline RTCOfferAnswerOptions(const RTCOfferAnswerOptions& aOther)
     465             :   {
     466             :     *this = aOther;
     467             :   }
     468             : 
     469             :   bool
     470             :   Init(JSContext* cx, JS::Handle<JS::Value> val, const char* sourceDescription = "Value", bool passedToJSImpl = false);
     471             : 
     472             :   bool
     473             :   Init(const nsAString& aJSON);
     474             : 
     475             :   bool
     476             :   ToObjectInternal(JSContext* cx, JS::MutableHandle<JS::Value> rval) const;
     477             : 
     478             :   bool
     479             :   ToJSON(nsAString& aJSON) const;
     480             : 
     481             :   void
     482             :   TraceDictionary(JSTracer* trc);
     483             : 
     484             :   RTCOfferAnswerOptions&
     485             :   operator=(const RTCOfferAnswerOptions& aOther);
     486             : };
     487             : 
     488             : namespace binding_detail {
     489             : struct FastRTCOfferAnswerOptions : public RTCOfferAnswerOptions
     490             : {
     491             :   inline FastRTCOfferAnswerOptions()
     492             :     : RTCOfferAnswerOptions(FastDictionaryInitializer())
     493             :   {
     494             :     // Doesn't matter what int we pass to the parent constructor
     495             :   }
     496             : };
     497             : } // namespace binding_detail
     498             : 
     499             : 
     500             : struct RTCAnswerOptions : public RTCOfferAnswerOptions
     501             : {
     502             :   RTCAnswerOptions();
     503             : 
     504           0 :   explicit inline RTCAnswerOptions(const FastDictionaryInitializer& )
     505           0 :     : RTCOfferAnswerOptions(FastDictionaryInitializer())
     506             :   {
     507             :     // Do nothing here; this is used by our "Fast" subclass
     508           0 :   }
     509             : 
     510             :   explicit inline RTCAnswerOptions(const RTCAnswerOptions& aOther)
     511             :   {
     512             :     *this = aOther;
     513             :   }
     514             : 
     515             :   bool
     516             :   Init(JSContext* cx, JS::Handle<JS::Value> val, const char* sourceDescription = "Value", bool passedToJSImpl = false);
     517             : 
     518             :   bool
     519             :   Init(const nsAString& aJSON);
     520             : 
     521             :   bool
     522             :   ToObjectInternal(JSContext* cx, JS::MutableHandle<JS::Value> rval) const;
     523             : 
     524             :   bool
     525             :   ToJSON(nsAString& aJSON) const;
     526             : 
     527             :   void
     528             :   TraceDictionary(JSTracer* trc);
     529             : 
     530             :   RTCAnswerOptions&
     531             :   operator=(const RTCAnswerOptions& aOther);
     532             : };
     533             : 
     534             : namespace binding_detail {
     535             : struct FastRTCAnswerOptions : public RTCAnswerOptions
     536             : {
     537           0 :   inline FastRTCAnswerOptions()
     538           0 :     : RTCAnswerOptions(FastDictionaryInitializer())
     539             :   {
     540             :     // Doesn't matter what int we pass to the parent constructor
     541           0 :   }
     542             : };
     543             : } // namespace binding_detail
     544             : 
     545             : 
     546           0 : struct RTCOfferOptions : public RTCOfferAnswerOptions
     547             : {
     548             :   MOZ_INIT_OUTSIDE_CTOR bool mIceRestart;
     549             :   MOZ_INIT_OUTSIDE_CTOR Optional<bool> mMozBundleOnly;
     550             :   MOZ_INIT_OUTSIDE_CTOR Optional<bool> mMozDontOfferDataChannel;
     551             :   MOZ_INIT_OUTSIDE_CTOR Optional<int32_t> mOfferToReceiveAudio;
     552             :   MOZ_INIT_OUTSIDE_CTOR Optional<int32_t> mOfferToReceiveVideo;
     553             : 
     554             :   RTCOfferOptions();
     555             : 
     556           0 :   explicit inline RTCOfferOptions(const FastDictionaryInitializer& )
     557           0 :     : RTCOfferAnswerOptions(FastDictionaryInitializer())
     558             :   {
     559             :     // Do nothing here; this is used by our "Fast" subclass
     560           0 :   }
     561             : 
     562             :   explicit inline RTCOfferOptions(const RTCOfferOptions& aOther)
     563             :   {
     564             :     *this = aOther;
     565             :   }
     566             : 
     567             :   bool
     568             :   Init(JSContext* cx, JS::Handle<JS::Value> val, const char* sourceDescription = "Value", bool passedToJSImpl = false);
     569             : 
     570             :   bool
     571             :   Init(const nsAString& aJSON);
     572             : 
     573             :   bool
     574             :   ToObjectInternal(JSContext* cx, JS::MutableHandle<JS::Value> rval) const;
     575             : 
     576             :   bool
     577             :   ToJSON(nsAString& aJSON) const;
     578             : 
     579             :   void
     580             :   TraceDictionary(JSTracer* trc);
     581             : 
     582             :   RTCOfferOptions&
     583             :   operator=(const RTCOfferOptions& aOther);
     584             : 
     585             : private:
     586             :   static bool
     587             :   InitIds(JSContext* cx, RTCOfferOptionsAtoms* atomsCache);
     588             : };
     589             : 
     590             : namespace binding_detail {
     591           0 : struct FastRTCOfferOptions : public RTCOfferOptions
     592             : {
     593           0 :   inline FastRTCOfferOptions()
     594           0 :     : RTCOfferOptions(FastDictionaryInitializer())
     595             :   {
     596             :     // Doesn't matter what int we pass to the parent constructor
     597           0 :   }
     598             : };
     599             : } // namespace binding_detail
     600             : 
     601             : 
     602           0 : class RTCSessionDescriptionCallback : public CallbackFunction
     603             : {
     604             : public:
     605             :   explicit inline RTCSessionDescriptionCallback(JSContext* aCx, JS::Handle<JSObject*> aCallback, nsIGlobalObject* aIncumbentGlobal)
     606             :     : CallbackFunction(aCx, aCallback, aIncumbentGlobal)
     607             :   {
     608             :     MOZ_ASSERT(JS::IsCallable(mCallback));
     609             :   }
     610             : 
     611           0 :   explicit inline RTCSessionDescriptionCallback(JS::Handle<JSObject*> aCallback, const FastCallbackConstructor& )
     612           0 :     : CallbackFunction(aCallback, FastCallbackConstructor())
     613             :   {
     614           0 :     MOZ_ASSERT(JS::IsCallable(mCallback));
     615           0 :   }
     616             : 
     617             :   explicit inline RTCSessionDescriptionCallback(JS::Handle<JSObject*> aCallback, JS::Handle<JSObject*> aAsyncStack, nsIGlobalObject* aIncumbentGlobal)
     618             :     : CallbackFunction(aCallback, aAsyncStack, aIncumbentGlobal)
     619             :   {
     620             :     MOZ_ASSERT(JS::IsCallable(mCallback));
     621             :   }
     622             : 
     623             :   explicit inline RTCSessionDescriptionCallback(CallbackFunction* aOther)
     624             :     : CallbackFunction(aOther)
     625             :   {
     626             :   }
     627             : 
     628             :   template <typename T>
     629             :   inline void
     630             :   Call(const T& thisVal, const RTCSessionDescriptionInit& description, ErrorResult& aRv, const char* aExecutionReason = nullptr, ExceptionHandling aExceptionHandling = eReportExceptions, JSCompartment* aCompartment = nullptr)
     631             :   {
     632             :     MOZ_ASSERT(!aRv.Failed(), "Don't pass an already-failed ErrorResult to a callback!");
     633             :     if (!aExecutionReason) {
     634             :       aExecutionReason = "RTCSessionDescriptionCallback";
     635             :     }
     636             :     CallSetup s(this, aRv, aExecutionReason, aExceptionHandling, aCompartment);
     637             :     if (!s.GetContext()) {
     638             :       MOZ_ASSERT(aRv.Failed());
     639             :       return;
     640             :     }
     641             :     JS::Rooted<JS::Value> thisValJS(s.GetContext());
     642             :     if (!ToJSValue(s.GetContext(), thisVal, &thisValJS)) {
     643             :       aRv.Throw(NS_ERROR_FAILURE);
     644             :       return;
     645             :     }
     646             :     return Call(s.GetContext(), thisValJS, description, aRv);
     647             :   }
     648             : 
     649             :   inline void
     650             :   Call(const RTCSessionDescriptionInit& description, ErrorResult& aRv, const char* aExecutionReason = nullptr, ExceptionHandling aExceptionHandling = eReportExceptions, JSCompartment* aCompartment = nullptr)
     651             :   {
     652             :     MOZ_ASSERT(!aRv.Failed(), "Don't pass an already-failed ErrorResult to a callback!");
     653             :     if (!aExecutionReason) {
     654             :       aExecutionReason = "RTCSessionDescriptionCallback";
     655             :     }
     656             :     CallSetup s(this, aRv, aExecutionReason, aExceptionHandling, aCompartment);
     657             :     if (!s.GetContext()) {
     658             :       MOZ_ASSERT(aRv.Failed());
     659             :       return;
     660             :     }
     661             :     return Call(s.GetContext(), JS::UndefinedHandleValue, description, aRv);
     662             :   }
     663             : 
     664             :   template <typename T>
     665             :   inline void
     666             :   Call(const T& thisVal, const RTCSessionDescriptionInit& description, const char* aExecutionReason = nullptr)
     667             :   {
     668             :     IgnoredErrorResult rv;
     669             :     return Call(thisVal, description, rv, aExecutionReason);
     670             :   }
     671             : 
     672             :   inline void
     673             :   Call(const RTCSessionDescriptionInit& description, const char* aExecutionReason = nullptr)
     674             :   {
     675             :     IgnoredErrorResult rv;
     676             :     return Call(description, rv, aExecutionReason, eReportExceptions, nullptr);
     677             :   }
     678             : 
     679             :   inline bool
     680             :   operator==(const RTCSessionDescriptionCallback& aOther) const
     681             :   {
     682             :     return CallbackFunction::operator==(aOther);
     683             :   }
     684             : 
     685             : private:
     686             :   void Call(JSContext* cx, JS::Handle<JS::Value> aThisVal, const RTCSessionDescriptionInit& description, ErrorResult& aRv);
     687             : };
     688             : 
     689             : 
     690           0 : class RTCPeerConnectionErrorCallback : public CallbackFunction
     691             : {
     692             : public:
     693             :   explicit inline RTCPeerConnectionErrorCallback(JSContext* aCx, JS::Handle<JSObject*> aCallback, nsIGlobalObject* aIncumbentGlobal)
     694             :     : CallbackFunction(aCx, aCallback, aIncumbentGlobal)
     695             :   {
     696             :     MOZ_ASSERT(JS::IsCallable(mCallback));
     697             :   }
     698             : 
     699           0 :   explicit inline RTCPeerConnectionErrorCallback(JS::Handle<JSObject*> aCallback, const FastCallbackConstructor& )
     700           0 :     : CallbackFunction(aCallback, FastCallbackConstructor())
     701             :   {
     702           0 :     MOZ_ASSERT(JS::IsCallable(mCallback));
     703           0 :   }
     704             : 
     705             :   explicit inline RTCPeerConnectionErrorCallback(JS::Handle<JSObject*> aCallback, JS::Handle<JSObject*> aAsyncStack, nsIGlobalObject* aIncumbentGlobal)
     706             :     : CallbackFunction(aCallback, aAsyncStack, aIncumbentGlobal)
     707             :   {
     708             :     MOZ_ASSERT(JS::IsCallable(mCallback));
     709             :   }
     710             : 
     711             :   explicit inline RTCPeerConnectionErrorCallback(CallbackFunction* aOther)
     712             :     : CallbackFunction(aOther)
     713             :   {
     714             :   }
     715             : 
     716             :   template <typename T>
     717             :   inline void
     718             :   Call(const T& thisVal, DOMError& error, ErrorResult& aRv, const char* aExecutionReason = nullptr, ExceptionHandling aExceptionHandling = eReportExceptions, JSCompartment* aCompartment = nullptr)
     719             :   {
     720             :     MOZ_ASSERT(!aRv.Failed(), "Don't pass an already-failed ErrorResult to a callback!");
     721             :     if (!aExecutionReason) {
     722             :       aExecutionReason = "RTCPeerConnectionErrorCallback";
     723             :     }
     724             :     CallSetup s(this, aRv, aExecutionReason, aExceptionHandling, aCompartment);
     725             :     if (!s.GetContext()) {
     726             :       MOZ_ASSERT(aRv.Failed());
     727             :       return;
     728             :     }
     729             :     JS::Rooted<JS::Value> thisValJS(s.GetContext());
     730             :     if (!ToJSValue(s.GetContext(), thisVal, &thisValJS)) {
     731             :       aRv.Throw(NS_ERROR_FAILURE);
     732             :       return;
     733             :     }
     734             :     return Call(s.GetContext(), thisValJS, error, aRv);
     735             :   }
     736             : 
     737             :   inline void
     738             :   Call(DOMError& error, ErrorResult& aRv, const char* aExecutionReason = nullptr, ExceptionHandling aExceptionHandling = eReportExceptions, JSCompartment* aCompartment = nullptr)
     739             :   {
     740             :     MOZ_ASSERT(!aRv.Failed(), "Don't pass an already-failed ErrorResult to a callback!");
     741             :     if (!aExecutionReason) {
     742             :       aExecutionReason = "RTCPeerConnectionErrorCallback";
     743             :     }
     744             :     CallSetup s(this, aRv, aExecutionReason, aExceptionHandling, aCompartment);
     745             :     if (!s.GetContext()) {
     746             :       MOZ_ASSERT(aRv.Failed());
     747             :       return;
     748             :     }
     749             :     return Call(s.GetContext(), JS::UndefinedHandleValue, error, aRv);
     750             :   }
     751             : 
     752             :   template <typename T>
     753             :   inline void
     754             :   Call(const T& thisVal, DOMError& error, const char* aExecutionReason = nullptr)
     755             :   {
     756             :     IgnoredErrorResult rv;
     757             :     return Call(thisVal, error, rv, aExecutionReason);
     758             :   }
     759             : 
     760             :   inline void
     761             :   Call(DOMError& error, const char* aExecutionReason = nullptr)
     762             :   {
     763             :     IgnoredErrorResult rv;
     764             :     return Call(error, rv, aExecutionReason, eReportExceptions, nullptr);
     765             :   }
     766             : 
     767             :   inline bool
     768             :   operator==(const RTCPeerConnectionErrorCallback& aOther) const
     769             :   {
     770             :     return CallbackFunction::operator==(aOther);
     771             :   }
     772             : 
     773             : private:
     774             :   void Call(JSContext* cx, JS::Handle<JS::Value> aThisVal, DOMError& error, ErrorResult& aRv);
     775             : };
     776             : 
     777             : 
     778           0 : class RTCStatsCallback : public CallbackFunction
     779             : {
     780             : public:
     781             :   explicit inline RTCStatsCallback(JSContext* aCx, JS::Handle<JSObject*> aCallback, nsIGlobalObject* aIncumbentGlobal)
     782             :     : CallbackFunction(aCx, aCallback, aIncumbentGlobal)
     783             :   {
     784             :     MOZ_ASSERT(JS::IsCallable(mCallback));
     785             :   }
     786             : 
     787           0 :   explicit inline RTCStatsCallback(JS::Handle<JSObject*> aCallback, const FastCallbackConstructor& )
     788           0 :     : CallbackFunction(aCallback, FastCallbackConstructor())
     789             :   {
     790           0 :     MOZ_ASSERT(JS::IsCallable(mCallback));
     791           0 :   }
     792             : 
     793             :   explicit inline RTCStatsCallback(JS::Handle<JSObject*> aCallback, JS::Handle<JSObject*> aAsyncStack, nsIGlobalObject* aIncumbentGlobal)
     794             :     : CallbackFunction(aCallback, aAsyncStack, aIncumbentGlobal)
     795             :   {
     796             :     MOZ_ASSERT(JS::IsCallable(mCallback));
     797             :   }
     798             : 
     799             :   explicit inline RTCStatsCallback(CallbackFunction* aOther)
     800             :     : CallbackFunction(aOther)
     801             :   {
     802             :   }
     803             : 
     804             :   template <typename T>
     805             :   inline void
     806             :   Call(const T& thisVal, RTCStatsReport& report, ErrorResult& aRv, const char* aExecutionReason = nullptr, ExceptionHandling aExceptionHandling = eReportExceptions, JSCompartment* aCompartment = nullptr)
     807             :   {
     808             :     MOZ_ASSERT(!aRv.Failed(), "Don't pass an already-failed ErrorResult to a callback!");
     809             :     if (!aExecutionReason) {
     810             :       aExecutionReason = "RTCStatsCallback";
     811             :     }
     812             :     CallSetup s(this, aRv, aExecutionReason, aExceptionHandling, aCompartment);
     813             :     if (!s.GetContext()) {
     814             :       MOZ_ASSERT(aRv.Failed());
     815             :       return;
     816             :     }
     817             :     JS::Rooted<JS::Value> thisValJS(s.GetContext());
     818             :     if (!ToJSValue(s.GetContext(), thisVal, &thisValJS)) {
     819             :       aRv.Throw(NS_ERROR_FAILURE);
     820             :       return;
     821             :     }
     822             :     return Call(s.GetContext(), thisValJS, report, aRv);
     823             :   }
     824             : 
     825             :   inline void
     826             :   Call(RTCStatsReport& report, ErrorResult& aRv, const char* aExecutionReason = nullptr, ExceptionHandling aExceptionHandling = eReportExceptions, JSCompartment* aCompartment = nullptr)
     827             :   {
     828             :     MOZ_ASSERT(!aRv.Failed(), "Don't pass an already-failed ErrorResult to a callback!");
     829             :     if (!aExecutionReason) {
     830             :       aExecutionReason = "RTCStatsCallback";
     831             :     }
     832             :     CallSetup s(this, aRv, aExecutionReason, aExceptionHandling, aCompartment);
     833             :     if (!s.GetContext()) {
     834             :       MOZ_ASSERT(aRv.Failed());
     835             :       return;
     836             :     }
     837             :     return Call(s.GetContext(), JS::UndefinedHandleValue, report, aRv);
     838             :   }
     839             : 
     840             :   template <typename T>
     841             :   inline void
     842             :   Call(const T& thisVal, RTCStatsReport& report, const char* aExecutionReason = nullptr)
     843             :   {
     844             :     IgnoredErrorResult rv;
     845             :     return Call(thisVal, report, rv, aExecutionReason);
     846             :   }
     847             : 
     848             :   inline void
     849             :   Call(RTCStatsReport& report, const char* aExecutionReason = nullptr)
     850             :   {
     851             :     IgnoredErrorResult rv;
     852             :     return Call(report, rv, aExecutionReason, eReportExceptions, nullptr);
     853             :   }
     854             : 
     855             :   inline bool
     856             :   operator==(const RTCStatsCallback& aOther) const
     857             :   {
     858             :     return CallbackFunction::operator==(aOther);
     859             :   }
     860             : 
     861             : private:
     862             :   void Call(JSContext* cx, JS::Handle<JS::Value> aThisVal, RTCStatsReport& report, ErrorResult& aRv);
     863             : };
     864             : 
     865             : 
     866             : namespace binding_detail {
     867           0 : class FastRTCSessionDescriptionCallback : public RTCSessionDescriptionCallback
     868             : {
     869             : public:
     870           0 :   explicit inline FastRTCSessionDescriptionCallback(JS::Handle<JSObject*> aCallback)
     871           0 :     : RTCSessionDescriptionCallback(aCallback, FastCallbackConstructor())
     872             :   {
     873           0 :   }
     874             : 
     875             :   inline void
     876           0 :   Trace(JSTracer* aTracer)
     877             :   {
     878           0 :     RTCSessionDescriptionCallback::Trace(aTracer);
     879           0 :   }
     880             : 
     881             :   inline void
     882           0 :   FinishSlowJSInitIfMoreThanOneOwner(JSContext* aCx)
     883             :   {
     884           0 :     RTCSessionDescriptionCallback::FinishSlowJSInitIfMoreThanOneOwner(aCx);
     885           0 :   }
     886             : };
     887             : } // namespace binding_detail
     888             : 
     889             : 
     890             : namespace binding_detail {
     891           0 : class FastRTCPeerConnectionErrorCallback : public RTCPeerConnectionErrorCallback
     892             : {
     893             : public:
     894           0 :   explicit inline FastRTCPeerConnectionErrorCallback(JS::Handle<JSObject*> aCallback)
     895           0 :     : RTCPeerConnectionErrorCallback(aCallback, FastCallbackConstructor())
     896             :   {
     897           0 :   }
     898             : 
     899             :   inline void
     900           0 :   Trace(JSTracer* aTracer)
     901             :   {
     902           0 :     RTCPeerConnectionErrorCallback::Trace(aTracer);
     903           0 :   }
     904             : 
     905             :   inline void
     906           0 :   FinishSlowJSInitIfMoreThanOneOwner(JSContext* aCx)
     907             :   {
     908           0 :     RTCPeerConnectionErrorCallback::FinishSlowJSInitIfMoreThanOneOwner(aCx);
     909           0 :   }
     910             : };
     911             : } // namespace binding_detail
     912             : 
     913             : 
     914             : namespace binding_detail {
     915           0 : class FastRTCStatsCallback : public RTCStatsCallback
     916             : {
     917             : public:
     918           0 :   explicit inline FastRTCStatsCallback(JS::Handle<JSObject*> aCallback)
     919           0 :     : RTCStatsCallback(aCallback, FastCallbackConstructor())
     920             :   {
     921           0 :   }
     922             : 
     923             :   inline void
     924           0 :   Trace(JSTracer* aTracer)
     925             :   {
     926           0 :     RTCStatsCallback::Trace(aTracer);
     927           0 :   }
     928             : 
     929             :   inline void
     930           0 :   FinishSlowJSInitIfMoreThanOneOwner(JSContext* aCx)
     931             :   {
     932           0 :     RTCStatsCallback::FinishSlowJSInitIfMoreThanOneOwner(aCx);
     933           0 :   }
     934             : };
     935             : } // namespace binding_detail
     936             : 
     937             : 
     938             : namespace RTCPeerConnectionBinding {
     939             : 
     940             :   typedef mozilla::dom::RTCPeerConnection NativeType;
     941             : 
     942             :   bool
     943             :   ConstructorEnabled(JSContext* aCx, JS::Handle<JSObject*> aObj);
     944             : 
     945             :   JSObject*
     946             :   DefineDOMInterface(JSContext* aCx, JS::Handle<JSObject*> aGlobal, JS::Handle<jsid> id, bool aDefineOnGlobal);
     947             : 
     948             :   const JSClass*
     949             :   GetJSClass();
     950             : 
     951             :   bool
     952             :   Wrap(JSContext* aCx, mozilla::dom::RTCPeerConnection* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector);
     953             : 
     954             :   template <class T>
     955           0 :   inline JSObject* Wrap(JSContext* aCx, T* aObject, JS::Handle<JSObject*> aGivenProto)
     956             :   {
     957           0 :     JS::Rooted<JSObject*> reflector(aCx);
     958           0 :     return Wrap(aCx, aObject, aObject, aGivenProto, &reflector) ? reflector.get() : nullptr;
     959             :   }
     960             : 
     961             :   // We declare this as an array so that retrieving a pointer to this
     962             :   // binding's property hooks only requires compile/link-time resolvable
     963             :   // address arithmetic.  Declaring it as a pointer instead would require
     964             :   // doing a run-time load to fetch a pointer to this binding's property
     965             :   // hooks.  And then structures which embedded a pointer to this structure
     966             :   // would require a run-time load for proper initialization, which would
     967             :   // then induce static constructors.  Lots of static constructors.
     968             :   extern const NativePropertyHooks sNativePropertyHooks[];
     969             : 
     970             :   void
     971             :   CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal);
     972             : 
     973             :   JS::Handle<JSObject*>
     974             :   GetProtoObjectHandle(JSContext* aCx);
     975             : 
     976             :   JSObject*
     977             :   GetProtoObject(JSContext* aCx);
     978             : 
     979             :   JS::Handle<JSObject*>
     980             :   GetConstructorObjectHandle(JSContext* aCx, bool aDefineOnGlobal = true);
     981             : 
     982             :   JSObject*
     983             :   GetConstructorObject(JSContext* aCx);
     984             : 
     985             : } // namespace RTCPeerConnectionBinding
     986             : 
     987             : 
     988             : 
     989           0 : class RTCPeerConnectionJSImpl : public CallbackInterface
     990             : {
     991             : public:
     992           0 :   explicit inline RTCPeerConnectionJSImpl(JSContext* aCx, JS::Handle<JSObject*> aCallback, nsIGlobalObject* aIncumbentGlobal)
     993           0 :     : CallbackInterface(aCx, aCallback, aIncumbentGlobal)
     994             :   {
     995           0 :   }
     996             : 
     997             :   explicit inline RTCPeerConnectionJSImpl(JS::Handle<JSObject*> aCallback, const FastCallbackConstructor& )
     998             :     : CallbackInterface(aCallback, FastCallbackConstructor())
     999             :   {
    1000             :   }
    1001             : 
    1002             :   explicit inline RTCPeerConnectionJSImpl(JS::Handle<JSObject*> aCallback, JS::Handle<JSObject*> aAsyncStack, nsIGlobalObject* aIncumbentGlobal)
    1003             :     : CallbackInterface(aCallback, aAsyncStack, aIncumbentGlobal)
    1004             :   {
    1005             :   }
    1006             : 
    1007             :   void SetIdentityProvider(const nsAString& provider, const Optional<nsAString>& protocol, const Optional<nsAString>& username, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
    1008             : 
    1009             :   already_AddRefed<Promise> GetIdentityAssertion(ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
    1010             : 
    1011             :   already_AddRefed<Promise> CreateOffer(const RTCOfferOptions& options, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
    1012             : 
    1013             :   already_AddRefed<Promise> CreateOffer(RTCSessionDescriptionCallback& successCallback, RTCPeerConnectionErrorCallback& failureCallback, const RTCOfferOptions& options, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
    1014             : 
    1015             :   already_AddRefed<Promise> CreateAnswer(const RTCAnswerOptions& options, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
    1016             : 
    1017             :   already_AddRefed<Promise> CreateAnswer(RTCSessionDescriptionCallback& successCallback, RTCPeerConnectionErrorCallback& failureCallback, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
    1018             : 
    1019             :   already_AddRefed<Promise> SetLocalDescription(const RTCSessionDescriptionInit& description, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
    1020             : 
    1021             :   already_AddRefed<Promise> SetLocalDescription(const RTCSessionDescriptionInit& description, VoidFunction& successCallback, RTCPeerConnectionErrorCallback& failureCallback, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
    1022             : 
    1023             :   already_AddRefed<Promise> SetRemoteDescription(const RTCSessionDescriptionInit& description, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
    1024             : 
    1025             :   already_AddRefed<Promise> SetRemoteDescription(const RTCSessionDescriptionInit& description, VoidFunction& successCallback, RTCPeerConnectionErrorCallback& failureCallback, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
    1026             : 
    1027             :   already_AddRefed<Promise> AddIceCandidate(const Nullable<RTCIceCandidateInitOrRTCIceCandidate>& candidate, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
    1028             : 
    1029             :   already_AddRefed<Promise> AddIceCandidate(RTCIceCandidate& candidate, VoidFunction& successCallback, RTCPeerConnectionErrorCallback& failureCallback, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
    1030             : 
    1031             :   void GetConfiguration(RTCConfiguration& aRetVal, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
    1032             : 
    1033             :   void GetLocalStreams(nsTArray<RefPtr<DOMMediaStream>>& aRetVal, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
    1034             : 
    1035             :   void GetRemoteStreams(nsTArray<RefPtr<DOMMediaStream>>& aRetVal, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
    1036             : 
    1037             :   void AddStream(DOMMediaStream& stream, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
    1038             : 
    1039             :   already_AddRefed<RTCRtpSender> AddTrack(MediaStreamTrack& track, DOMMediaStream& stream, const nsTArray<OwningNonNull<DOMMediaStream>>& moreStreams, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
    1040             : 
    1041             :   void RemoveTrack(RTCRtpSender& sender, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
    1042             : 
    1043             :   void GetSenders(nsTArray<RefPtr<RTCRtpSender>>& aRetVal, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
    1044             : 
    1045             :   void GetReceivers(nsTArray<RefPtr<RTCRtpReceiver>>& aRetVal, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
    1046             : 
    1047             :   void MozAddRIDExtension(RTCRtpReceiver& receiver, uint16_t extensionId, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
    1048             : 
    1049             :   void MozAddRIDFilter(RTCRtpReceiver& receiver, const nsAString& rid, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
    1050             : 
    1051             :   void Close(ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
    1052             : 
    1053             :   already_AddRefed<Promise> GetStats(const Optional<MediaStreamTrack*>& selector, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
    1054             : 
    1055             :   already_AddRefed<Promise> GetStats(MediaStreamTrack* selector, RTCStatsCallback& successCallback, RTCPeerConnectionErrorCallback& failureCallback, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
    1056             : 
    1057             :   already_AddRefed<nsIDOMDataChannel> CreateDataChannel(const nsAString& label, const RTCDataChannelInit& dataChannelDict, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
    1058             : 
    1059             :   void __Init(const RTCConfiguration& configuration, const Optional<JS::Handle<JSObject*>>& constraints, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
    1060             : 
    1061             :   inline bool
    1062             :   operator==(const RTCPeerConnectionJSImpl& aOther) const
    1063             :   {
    1064             :     return CallbackInterface::operator==(aOther);
    1065             :   }
    1066             : 
    1067             :   already_AddRefed<RTCSessionDescription> GetLocalDescription(ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
    1068             : 
    1069             :   already_AddRefed<RTCSessionDescription> GetRemoteDescription(ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
    1070             : 
    1071             :   RTCSignalingState GetSignalingState(ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
    1072             : 
    1073             :   Nullable<bool> GetCanTrickleIceCandidates(ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
    1074             : 
    1075             :   RTCIceGatheringState GetIceGatheringState(ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
    1076             : 
    1077             :   RTCIceConnectionState GetIceConnectionState(ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
    1078             : 
    1079             :   already_AddRefed<Promise> GetPeerIdentity(ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
    1080             : 
    1081             :   void GetIdpLoginUrl(nsString& aRetVal, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
    1082             : 
    1083             :   void GetId(nsString& aRetVal, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
    1084             : 
    1085             :   already_AddRefed<EventHandlerNonNull> GetOnnegotiationneeded(ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
    1086             : 
    1087             :   already_AddRefed<EventHandlerNonNull> GetOnicecandidate(ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
    1088             : 
    1089             :   already_AddRefed<EventHandlerNonNull> GetOnsignalingstatechange(ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
    1090             : 
    1091             :   already_AddRefed<EventHandlerNonNull> GetOnaddstream(ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
    1092             : 
    1093             :   already_AddRefed<EventHandlerNonNull> GetOnaddtrack(ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
    1094             : 
    1095             :   already_AddRefed<EventHandlerNonNull> GetOntrack(ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
    1096             : 
    1097             :   already_AddRefed<EventHandlerNonNull> GetOnremovestream(ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
    1098             : 
    1099             :   already_AddRefed<EventHandlerNonNull> GetOniceconnectionstatechange(ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
    1100             : 
    1101             :   already_AddRefed<EventHandlerNonNull> GetOnicegatheringstatechange(ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
    1102             : 
    1103             :   already_AddRefed<EventHandlerNonNull> GetOndatachannel(ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
    1104             : 
    1105             :   void SetId(const nsAString& arg, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
    1106             : 
    1107             :   void SetOnnegotiationneeded(EventHandlerNonNull* arg, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
    1108             : 
    1109             :   void SetOnicecandidate(EventHandlerNonNull* arg, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
    1110             : 
    1111             :   void SetOnsignalingstatechange(EventHandlerNonNull* arg, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
    1112             : 
    1113             :   void SetOnaddstream(EventHandlerNonNull* arg, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
    1114             : 
    1115             :   void SetOnaddtrack(EventHandlerNonNull* arg, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
    1116             : 
    1117             :   void SetOntrack(EventHandlerNonNull* arg, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
    1118             : 
    1119             :   void SetOnremovestream(EventHandlerNonNull* arg, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
    1120             : 
    1121             :   void SetOniceconnectionstatechange(EventHandlerNonNull* arg, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
    1122             : 
    1123             :   void SetOnicegatheringstatechange(EventHandlerNonNull* arg, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
    1124             : 
    1125             :   void SetOndatachannel(EventHandlerNonNull* arg, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
    1126             : 
    1127             : private:
    1128             :   static bool
    1129             :   InitIds(JSContext* cx, RTCPeerConnectionAtoms* atomsCache);
    1130             : };
    1131             : 
    1132             : 
    1133             : class RTCPeerConnection : public mozilla::DOMEventTargetHelper
    1134             : {
    1135             : public:
    1136             :   NS_DECL_ISUPPORTS_INHERITED
    1137           0 :   NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(RTCPeerConnection, mozilla::DOMEventTargetHelper)
    1138             : 
    1139             : private:
    1140             :   RefPtr<RTCPeerConnectionJSImpl> mImpl;
    1141             :   nsCOMPtr<nsISupports> mParent;
    1142             : 
    1143             : public:
    1144             :   RTCPeerConnection(JS::Handle<JSObject*> aJSImplObject, nsIGlobalObject* aParent);
    1145             : 
    1146             : protected:
    1147             :   virtual ~RTCPeerConnection();
    1148             : 
    1149             : public:
    1150             :   nsISupports* GetParentObject() const;
    1151             : 
    1152             :   virtual JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
    1153             : 
    1154             :   static already_AddRefed<RTCPeerConnection> Constructor(const GlobalObject& global, JSContext* cx, const RTCConfiguration& configuration, const Optional<JS::Handle<JSObject*>>& constraints, ErrorResult& aRv);
    1155             : 
    1156             :   void SetIdentityProvider(const nsAString& provider, const Optional<nsAString>& protocol, const Optional<nsAString>& username, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
    1157             : 
    1158             :   // Return a raw pointer here to avoid refcounting, but make sure it's safe (the object should be kept alive by the callee).
    1159             :   already_AddRefed<Promise> GetIdentityAssertion(ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
    1160             : 
    1161             :   // Return a raw pointer here to avoid refcounting, but make sure it's safe (the object should be kept alive by the callee).
    1162             :   already_AddRefed<Promise> CreateOffer(const RTCOfferOptions& options, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
    1163             :   // Return a raw pointer here to avoid refcounting, but make sure it's safe (the object should be kept alive by the callee).
    1164             :   already_AddRefed<Promise> CreateOffer(RTCSessionDescriptionCallback& successCallback, RTCPeerConnectionErrorCallback& failureCallback, const RTCOfferOptions& options, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
    1165             : 
    1166             :   // Return a raw pointer here to avoid refcounting, but make sure it's safe (the object should be kept alive by the callee).
    1167             :   already_AddRefed<Promise> CreateAnswer(const RTCAnswerOptions& options, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
    1168             :   // Return a raw pointer here to avoid refcounting, but make sure it's safe (the object should be kept alive by the callee).
    1169             :   already_AddRefed<Promise> CreateAnswer(RTCSessionDescriptionCallback& successCallback, RTCPeerConnectionErrorCallback& failureCallback, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
    1170             : 
    1171             :   // Return a raw pointer here to avoid refcounting, but make sure it's safe (the object should be kept alive by the callee).
    1172             :   already_AddRefed<Promise> SetLocalDescription(const RTCSessionDescriptionInit& description, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
    1173             :   // Return a raw pointer here to avoid refcounting, but make sure it's safe (the object should be kept alive by the callee).
    1174             :   already_AddRefed<Promise> SetLocalDescription(const RTCSessionDescriptionInit& description, VoidFunction& successCallback, RTCPeerConnectionErrorCallback& failureCallback, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
    1175             : 
    1176             :   // Return a raw pointer here to avoid refcounting, but make sure it's safe (the object should be kept alive by the callee).
    1177             :   already_AddRefed<Promise> SetRemoteDescription(const RTCSessionDescriptionInit& description, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
    1178             :   // Return a raw pointer here to avoid refcounting, but make sure it's safe (the object should be kept alive by the callee).
    1179             :   already_AddRefed<Promise> SetRemoteDescription(const RTCSessionDescriptionInit& description, VoidFunction& successCallback, RTCPeerConnectionErrorCallback& failureCallback, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
    1180             : 
    1181             :   // Return a raw pointer here to avoid refcounting, but make sure it's safe (the object should be kept alive by the callee).
    1182             :   already_AddRefed<RTCSessionDescription> GetLocalDescription(ErrorResult& aRv, JSCompartment* aCompartment = nullptr) const;
    1183             : 
    1184             :   // Return a raw pointer here to avoid refcounting, but make sure it's safe (the object should be kept alive by the callee).
    1185             :   already_AddRefed<RTCSessionDescription> GetRemoteDescription(ErrorResult& aRv, JSCompartment* aCompartment = nullptr) const;
    1186             : 
    1187             :   RTCSignalingState GetSignalingState(ErrorResult& aRv, JSCompartment* aCompartment = nullptr) const;
    1188             : 
    1189             :   // Return a raw pointer here to avoid refcounting, but make sure it's safe (the object should be kept alive by the callee).
    1190             :   already_AddRefed<Promise> AddIceCandidate(const Nullable<RTCIceCandidateInitOrRTCIceCandidate>& candidate, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
    1191             :   // Return a raw pointer here to avoid refcounting, but make sure it's safe (the object should be kept alive by the callee).
    1192             :   already_AddRefed<Promise> AddIceCandidate(RTCIceCandidate& candidate, VoidFunction& successCallback, RTCPeerConnectionErrorCallback& failureCallback, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
    1193             : 
    1194             :   Nullable<bool> GetCanTrickleIceCandidates(ErrorResult& aRv, JSCompartment* aCompartment = nullptr) const;
    1195             : 
    1196             :   RTCIceGatheringState GetIceGatheringState(ErrorResult& aRv, JSCompartment* aCompartment = nullptr) const;
    1197             : 
    1198             :   RTCIceConnectionState GetIceConnectionState(ErrorResult& aRv, JSCompartment* aCompartment = nullptr) const;
    1199             : 
    1200             :   // Return a raw pointer here to avoid refcounting, but make sure it's safe (the object should be kept alive by the callee).
    1201             :   already_AddRefed<Promise> GetPeerIdentity(ErrorResult& aRv, JSCompartment* aCompartment = nullptr) const;
    1202             : 
    1203             :   void GetIdpLoginUrl(nsString& aRetVal, ErrorResult& aRv, JSCompartment* aCompartment = nullptr) const;
    1204             : 
    1205             :   void GetId(nsString& aRetVal, ErrorResult& aRv, JSCompartment* aCompartment = nullptr) const;
    1206             : 
    1207             :   void SetId(const nsAString& arg, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
    1208             : 
    1209             :   void GetConfiguration(RTCConfiguration& aRetVal, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
    1210             : 
    1211             :   void GetLocalStreams(nsTArray<RefPtr<DOMMediaStream>>& aRetVal, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
    1212             : 
    1213             :   void GetRemoteStreams(nsTArray<RefPtr<DOMMediaStream>>& aRetVal, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
    1214             : 
    1215             :   void AddStream(DOMMediaStream& stream, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
    1216             : 
    1217             :   // Return a raw pointer here to avoid refcounting, but make sure it's safe (the object should be kept alive by the callee).
    1218             :   already_AddRefed<RTCRtpSender> AddTrack(MediaStreamTrack& track, DOMMediaStream& stream, const Sequence<OwningNonNull<DOMMediaStream>>& moreStreams, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
    1219             : 
    1220             :   void RemoveTrack(RTCRtpSender& sender, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
    1221             : 
    1222             :   void GetSenders(nsTArray<RefPtr<RTCRtpSender>>& aRetVal, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
    1223             : 
    1224             :   void GetReceivers(nsTArray<RefPtr<RTCRtpReceiver>>& aRetVal, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
    1225             : 
    1226             :   void MozAddRIDExtension(RTCRtpReceiver& receiver, uint16_t extensionId, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
    1227             : 
    1228             :   void MozAddRIDFilter(RTCRtpReceiver& receiver, const nsAString& rid, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
    1229             : 
    1230             :   void Close(ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
    1231             : 
    1232             :   already_AddRefed<EventHandlerNonNull> GetOnnegotiationneeded(ErrorResult& aRv, JSCompartment* aCompartment = nullptr) const;
    1233             : 
    1234             :   void SetOnnegotiationneeded(EventHandlerNonNull* arg, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
    1235             : 
    1236             :   already_AddRefed<EventHandlerNonNull> GetOnicecandidate(ErrorResult& aRv, JSCompartment* aCompartment = nullptr) const;
    1237             : 
    1238             :   void SetOnicecandidate(EventHandlerNonNull* arg, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
    1239             : 
    1240             :   already_AddRefed<EventHandlerNonNull> GetOnsignalingstatechange(ErrorResult& aRv, JSCompartment* aCompartment = nullptr) const;
    1241             : 
    1242             :   void SetOnsignalingstatechange(EventHandlerNonNull* arg, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
    1243             : 
    1244             :   already_AddRefed<EventHandlerNonNull> GetOnaddstream(ErrorResult& aRv, JSCompartment* aCompartment = nullptr) const;
    1245             : 
    1246             :   void SetOnaddstream(EventHandlerNonNull* arg, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
    1247             : 
    1248             :   already_AddRefed<EventHandlerNonNull> GetOnaddtrack(ErrorResult& aRv, JSCompartment* aCompartment = nullptr) const;
    1249             : 
    1250             :   void SetOnaddtrack(EventHandlerNonNull* arg, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
    1251             : 
    1252             :   already_AddRefed<EventHandlerNonNull> GetOntrack(ErrorResult& aRv, JSCompartment* aCompartment = nullptr) const;
    1253             : 
    1254             :   void SetOntrack(EventHandlerNonNull* arg, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
    1255             : 
    1256             :   already_AddRefed<EventHandlerNonNull> GetOnremovestream(ErrorResult& aRv, JSCompartment* aCompartment = nullptr) const;
    1257             : 
    1258             :   void SetOnremovestream(EventHandlerNonNull* arg, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
    1259             : 
    1260             :   already_AddRefed<EventHandlerNonNull> GetOniceconnectionstatechange(ErrorResult& aRv, JSCompartment* aCompartment = nullptr) const;
    1261             : 
    1262             :   void SetOniceconnectionstatechange(EventHandlerNonNull* arg, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
    1263             : 
    1264             :   already_AddRefed<EventHandlerNonNull> GetOnicegatheringstatechange(ErrorResult& aRv, JSCompartment* aCompartment = nullptr) const;
    1265             : 
    1266             :   void SetOnicegatheringstatechange(EventHandlerNonNull* arg, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
    1267             : 
    1268             :   // Return a raw pointer here to avoid refcounting, but make sure it's safe (the object should be kept alive by the callee).
    1269             :   already_AddRefed<Promise> GetStats(const Optional<MediaStreamTrack*>& selector, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
    1270             :   // Return a raw pointer here to avoid refcounting, but make sure it's safe (the object should be kept alive by the callee).
    1271             :   already_AddRefed<Promise> GetStats(MediaStreamTrack* selector, RTCStatsCallback& successCallback, RTCPeerConnectionErrorCallback& failureCallback, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
    1272             : 
    1273             :   // Return a raw pointer here to avoid refcounting, but make sure it's safe (the object should be kept alive by the callee).
    1274             :   already_AddRefed<nsIDOMDataChannel> CreateDataChannel(const nsAString& label, const RTCDataChannelInit& dataChannelDict, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
    1275             : 
    1276             :   already_AddRefed<EventHandlerNonNull> GetOndatachannel(ErrorResult& aRv, JSCompartment* aCompartment = nullptr) const;
    1277             : 
    1278             :   void SetOndatachannel(EventHandlerNonNull* arg, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
    1279             : 
    1280             :   static bool
    1281             :   _Create(JSContext* cx, unsigned argc, JS::Value* vp);
    1282             : };
    1283             : 
    1284             : 
    1285             : } // namespace dom
    1286             : } // namespace mozilla
    1287             : 
    1288             : #endif // mozilla_dom_RTCPeerConnectionBinding_h

Generated by: LCOV version 1.13