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

          Line data    Source code
       1             : /* THIS FILE IS AUTOGENERATED FROM MessageEvent.webidl BY Codegen.py - DO NOT EDIT */
       2             : 
       3             : #ifndef mozilla_dom_MessageEventBinding_h
       4             : #define mozilla_dom_MessageEventBinding_h
       5             : 
       6             : #include "EventBinding.h"
       7             : #include "js/RootingAPI.h"
       8             : #include "jspubtd.h"
       9             : #include "mozilla/ErrorResult.h"
      10             : #include "mozilla/dom/BindingDeclarations.h"
      11             : #include "mozilla/dom/FakeString.h"
      12             : #include "mozilla/dom/MessagePort.h"
      13             : #include "mozilla/dom/Nullable.h"
      14             : #include "mozilla/dom/UnionMember.h"
      15             : 
      16             : class nsPIDOMWindowOuter;
      17             : 
      18             : namespace mozilla {
      19             : namespace dom {
      20             : 
      21             : class MessageEvent;
      22             : struct MessageEventAtoms;
      23             : struct MessageEventInitAtoms;
      24             : class MessagePort;
      25             : struct NativePropertyHooks;
      26             : class OwningWindowProxyOrMessagePortOrServiceWorker;
      27             : class ProtoAndIfaceCache;
      28             : class WindowProxyOrMessagePortOrServiceWorker;
      29             : 
      30             : namespace workers {
      31             : 
      32             : class ServiceWorker;
      33             : 
      34             : } // namespace workers
      35             : 
      36             : } // namespace dom
      37             : } // namespace mozilla
      38             : 
      39             : namespace mozilla {
      40             : namespace dom {
      41             : 
      42             : void
      43             : ImplCycleCollectionTraverse(nsCycleCollectionTraversalCallback& aCallback, OwningWindowProxyOrMessagePortOrServiceWorker& aUnion, const char* aName, uint32_t aFlags = 0);
      44             : 
      45             : 
      46             : void
      47             : ImplCycleCollectionUnlink(OwningWindowProxyOrMessagePortOrServiceWorker& aUnion);
      48             : 
      49             : 
      50             : class WindowProxyOrMessagePortOrServiceWorker
      51             : {
      52             :   friend class WindowProxyOrMessagePortOrServiceWorkerArgument;
      53             :   enum Type
      54             :   {
      55             :     eUninitialized,
      56             :     eWindowProxy,
      57             :     eMessagePort,
      58             :     eServiceWorker
      59             :   };
      60             : 
      61           0 :   union Value
      62             :   {
      63             :     UnionMember<nsPIDOMWindowOuter* > mWindowProxy;
      64             :     UnionMember<NonNull<mozilla::dom::MessagePort> > mMessagePort;
      65             :     UnionMember<NonNull<mozilla::dom::workers::ServiceWorker> > mServiceWorker;
      66             : 
      67             :   };
      68             : 
      69             :   Type mType;
      70             :   Value mValue;
      71             : 
      72             :   WindowProxyOrMessagePortOrServiceWorker(const WindowProxyOrMessagePortOrServiceWorker&) = delete;
      73             :   WindowProxyOrMessagePortOrServiceWorker& operator=(const WindowProxyOrMessagePortOrServiceWorker&) = delete;
      74             : public:
      75           0 :   explicit inline WindowProxyOrMessagePortOrServiceWorker()
      76           0 :     : mType(eUninitialized)
      77             :   {
      78           0 :   }
      79             : 
      80           0 :   inline ~WindowProxyOrMessagePortOrServiceWorker()
      81           0 :   {
      82           0 :     Uninit();
      83           0 :   }
      84             : 
      85             :   inline nsPIDOMWindowOuter*&
      86             :   RawSetAsWindowProxy()
      87             :   {
      88             :     if (mType == eWindowProxy) {
      89             :       return mValue.mWindowProxy.Value();
      90             :     }
      91             :     MOZ_ASSERT(mType == eUninitialized);
      92             :     mType = eWindowProxy;
      93             :     return mValue.mWindowProxy.SetValue();
      94             :   }
      95             : 
      96             :   inline nsPIDOMWindowOuter*&
      97           0 :   SetAsWindowProxy()
      98             :   {
      99           0 :     if (mType == eWindowProxy) {
     100           0 :       return mValue.mWindowProxy.Value();
     101             :     }
     102           0 :     Uninit();
     103           0 :     mType = eWindowProxy;
     104           0 :     return mValue.mWindowProxy.SetValue();
     105             :   }
     106             : 
     107             :   inline bool
     108           0 :   IsWindowProxy() const
     109             :   {
     110           0 :     return mType == eWindowProxy;
     111             :   }
     112             : 
     113             :   inline nsPIDOMWindowOuter*&
     114             :   GetAsWindowProxy()
     115             :   {
     116             :     MOZ_ASSERT(IsWindowProxy(), "Wrong type!");
     117             :     return mValue.mWindowProxy.Value();
     118             :   }
     119             : 
     120             :   inline nsPIDOMWindowOuter*
     121           0 :   GetAsWindowProxy() const
     122             :   {
     123           0 :     MOZ_ASSERT(IsWindowProxy(), "Wrong type!");
     124           0 :     return mValue.mWindowProxy.Value();
     125             :   }
     126             : 
     127             :   inline NonNull<mozilla::dom::MessagePort>&
     128             :   RawSetAsMessagePort()
     129             :   {
     130             :     if (mType == eMessagePort) {
     131             :       return mValue.mMessagePort.Value();
     132             :     }
     133             :     MOZ_ASSERT(mType == eUninitialized);
     134             :     mType = eMessagePort;
     135             :     return mValue.mMessagePort.SetValue();
     136             :   }
     137             : 
     138             :   inline NonNull<mozilla::dom::MessagePort>&
     139             :   SetAsMessagePort()
     140             :   {
     141             :     if (mType == eMessagePort) {
     142             :       return mValue.mMessagePort.Value();
     143             :     }
     144             :     Uninit();
     145             :     mType = eMessagePort;
     146             :     return mValue.mMessagePort.SetValue();
     147             :   }
     148             : 
     149             :   inline bool
     150           0 :   IsMessagePort() const
     151             :   {
     152           0 :     return mType == eMessagePort;
     153             :   }
     154             : 
     155             :   inline NonNull<mozilla::dom::MessagePort>&
     156             :   GetAsMessagePort()
     157             :   {
     158             :     MOZ_ASSERT(IsMessagePort(), "Wrong type!");
     159             :     return mValue.mMessagePort.Value();
     160             :   }
     161             : 
     162             :   inline mozilla::dom::MessagePort&
     163           0 :   GetAsMessagePort() const
     164             :   {
     165           0 :     MOZ_ASSERT(IsMessagePort(), "Wrong type!");
     166           0 :     return mValue.mMessagePort.Value();
     167             :   }
     168             : 
     169             :   inline NonNull<mozilla::dom::workers::ServiceWorker>&
     170             :   RawSetAsServiceWorker()
     171             :   {
     172             :     if (mType == eServiceWorker) {
     173             :       return mValue.mServiceWorker.Value();
     174             :     }
     175             :     MOZ_ASSERT(mType == eUninitialized);
     176             :     mType = eServiceWorker;
     177             :     return mValue.mServiceWorker.SetValue();
     178             :   }
     179             : 
     180             :   inline NonNull<mozilla::dom::workers::ServiceWorker>&
     181             :   SetAsServiceWorker()
     182             :   {
     183             :     if (mType == eServiceWorker) {
     184             :       return mValue.mServiceWorker.Value();
     185             :     }
     186             :     Uninit();
     187             :     mType = eServiceWorker;
     188             :     return mValue.mServiceWorker.SetValue();
     189             :   }
     190             : 
     191             :   inline bool
     192           0 :   IsServiceWorker() const
     193             :   {
     194           0 :     return mType == eServiceWorker;
     195             :   }
     196             : 
     197             :   inline NonNull<mozilla::dom::workers::ServiceWorker>&
     198             :   GetAsServiceWorker()
     199             :   {
     200             :     MOZ_ASSERT(IsServiceWorker(), "Wrong type!");
     201             :     return mValue.mServiceWorker.Value();
     202             :   }
     203             : 
     204             :   inline mozilla::dom::workers::ServiceWorker&
     205           0 :   GetAsServiceWorker() const
     206             :   {
     207           0 :     MOZ_ASSERT(IsServiceWorker(), "Wrong type!");
     208           0 :     return mValue.mServiceWorker.Value();
     209             :   }
     210             : 
     211             :   inline void
     212           0 :   Uninit()
     213             :   {
     214           0 :     switch (mType) {
     215             :       case eUninitialized: {
     216           0 :         break;
     217             :       }
     218             :       case eWindowProxy: {
     219           0 :         DestroyWindowProxy();
     220           0 :         break;
     221             :       }
     222             :       case eMessagePort: {
     223           0 :         DestroyMessagePort();
     224           0 :         break;
     225             :       }
     226             :       case eServiceWorker: {
     227           0 :         DestroyServiceWorker();
     228           0 :         break;
     229             :       }
     230             :     }
     231           0 :   }
     232             : 
     233             :   bool
     234             :   ToJSVal(JSContext* cx, JS::Handle<JSObject*> scopeObj, JS::MutableHandle<JS::Value> rval) const;
     235             : 
     236             : private:
     237             :   inline void
     238           0 :   DestroyWindowProxy()
     239             :   {
     240           0 :     MOZ_ASSERT(IsWindowProxy(), "Wrong type!");
     241           0 :     mValue.mWindowProxy.Destroy();
     242           0 :     mType = eUninitialized;
     243           0 :   }
     244             : 
     245             :   inline void
     246           0 :   DestroyMessagePort()
     247             :   {
     248           0 :     MOZ_ASSERT(IsMessagePort(), "Wrong type!");
     249           0 :     mValue.mMessagePort.Destroy();
     250           0 :     mType = eUninitialized;
     251           0 :   }
     252             : 
     253             :   inline void
     254           0 :   DestroyServiceWorker()
     255             :   {
     256           0 :     MOZ_ASSERT(IsServiceWorker(), "Wrong type!");
     257           0 :     mValue.mServiceWorker.Destroy();
     258           0 :     mType = eUninitialized;
     259           0 :   }
     260             : };
     261             : 
     262             : 
     263             : class OwningWindowProxyOrMessagePortOrServiceWorker : public AllOwningUnionBase
     264             : {
     265             :   friend void ImplCycleCollectionUnlink(OwningWindowProxyOrMessagePortOrServiceWorker& aUnion);
     266             :   enum Type
     267             :   {
     268             :     eUninitialized,
     269             :     eWindowProxy,
     270             :     eMessagePort,
     271             :     eServiceWorker
     272             :   };
     273             : 
     274           0 :   union Value
     275             :   {
     276             :     UnionMember<RefPtr<nsPIDOMWindowOuter> > mWindowProxy;
     277             :     UnionMember<OwningNonNull<mozilla::dom::MessagePort> > mMessagePort;
     278             :     UnionMember<OwningNonNull<mozilla::dom::workers::ServiceWorker> > mServiceWorker;
     279             : 
     280             :   };
     281             : 
     282             :   Type mType;
     283             :   Value mValue;
     284             : 
     285             : public:
     286           0 :   explicit inline OwningWindowProxyOrMessagePortOrServiceWorker()
     287           0 :     : mType(eUninitialized)
     288             :   {
     289           0 :   }
     290             : 
     291             :   explicit inline OwningWindowProxyOrMessagePortOrServiceWorker(const OwningWindowProxyOrMessagePortOrServiceWorker& aOther)
     292             :     : mType(eUninitialized)
     293             :   {
     294             :     *this = aOther;
     295             :   }
     296             : 
     297           0 :   inline ~OwningWindowProxyOrMessagePortOrServiceWorker()
     298           0 :   {
     299           0 :     Uninit();
     300           0 :   }
     301             : 
     302             :   RefPtr<nsPIDOMWindowOuter>&
     303             :   RawSetAsWindowProxy();
     304             : 
     305             :   RefPtr<nsPIDOMWindowOuter>&
     306             :   SetAsWindowProxy();
     307             : 
     308             :   bool
     309             :   TrySetToWindowProxy(JSContext* cx, JS::Handle<JS::Value> value, bool& tryNext, bool passedToJSImpl = false);
     310             : 
     311             :   inline bool
     312           0 :   IsWindowProxy() const
     313             :   {
     314           0 :     return mType == eWindowProxy;
     315             :   }
     316             : 
     317             :   inline RefPtr<nsPIDOMWindowOuter>&
     318           0 :   GetAsWindowProxy()
     319             :   {
     320           0 :     MOZ_ASSERT(IsWindowProxy(), "Wrong type!");
     321           0 :     return mValue.mWindowProxy.Value();
     322             :   }
     323             : 
     324             :   inline RefPtr<nsPIDOMWindowOuter> const &
     325           0 :   GetAsWindowProxy() const
     326             :   {
     327           0 :     MOZ_ASSERT(IsWindowProxy(), "Wrong type!");
     328           0 :     return mValue.mWindowProxy.Value();
     329             :   }
     330             : 
     331             :   OwningNonNull<mozilla::dom::MessagePort>&
     332             :   RawSetAsMessagePort();
     333             : 
     334             :   OwningNonNull<mozilla::dom::MessagePort>&
     335             :   SetAsMessagePort();
     336             : 
     337             :   bool
     338             :   TrySetToMessagePort(JSContext* cx, JS::Handle<JS::Value> value, bool& tryNext, bool passedToJSImpl = false);
     339             : 
     340             :   inline bool
     341           0 :   IsMessagePort() const
     342             :   {
     343           0 :     return mType == eMessagePort;
     344             :   }
     345             : 
     346             :   inline OwningNonNull<mozilla::dom::MessagePort>&
     347           0 :   GetAsMessagePort()
     348             :   {
     349           0 :     MOZ_ASSERT(IsMessagePort(), "Wrong type!");
     350           0 :     return mValue.mMessagePort.Value();
     351             :   }
     352             : 
     353             :   inline OwningNonNull<mozilla::dom::MessagePort> const &
     354           0 :   GetAsMessagePort() const
     355             :   {
     356           0 :     MOZ_ASSERT(IsMessagePort(), "Wrong type!");
     357           0 :     return mValue.mMessagePort.Value();
     358             :   }
     359             : 
     360             :   OwningNonNull<mozilla::dom::workers::ServiceWorker>&
     361             :   RawSetAsServiceWorker();
     362             : 
     363             :   OwningNonNull<mozilla::dom::workers::ServiceWorker>&
     364             :   SetAsServiceWorker();
     365             : 
     366             :   bool
     367             :   TrySetToServiceWorker(JSContext* cx, JS::Handle<JS::Value> value, bool& tryNext, bool passedToJSImpl = false);
     368             : 
     369             :   inline bool
     370           0 :   IsServiceWorker() const
     371             :   {
     372           0 :     return mType == eServiceWorker;
     373             :   }
     374             : 
     375             :   inline OwningNonNull<mozilla::dom::workers::ServiceWorker>&
     376           0 :   GetAsServiceWorker()
     377             :   {
     378           0 :     MOZ_ASSERT(IsServiceWorker(), "Wrong type!");
     379           0 :     return mValue.mServiceWorker.Value();
     380             :   }
     381             : 
     382             :   inline OwningNonNull<mozilla::dom::workers::ServiceWorker> const &
     383           0 :   GetAsServiceWorker() const
     384             :   {
     385           0 :     MOZ_ASSERT(IsServiceWorker(), "Wrong type!");
     386           0 :     return mValue.mServiceWorker.Value();
     387             :   }
     388             : 
     389             :   void
     390             :   Uninit();
     391             : 
     392             :   bool
     393             :   ToJSVal(JSContext* cx, JS::Handle<JSObject*> scopeObj, JS::MutableHandle<JS::Value> rval) const;
     394             : 
     395             :   void
     396             :   TraceUnion(JSTracer* trc);
     397             : 
     398             :   OwningWindowProxyOrMessagePortOrServiceWorker&
     399             :   operator=(const OwningWindowProxyOrMessagePortOrServiceWorker& aOther);
     400             : 
     401             : private:
     402             :   void
     403             :   DestroyWindowProxy();
     404             : 
     405             :   void
     406             :   DestroyMessagePort();
     407             : 
     408             :   void
     409             :   DestroyServiceWorker();
     410             : };
     411             : 
     412             : 
     413           0 : struct MessageEventInit : public EventInit
     414             : {
     415             :   MOZ_INIT_OUTSIDE_CTOR JS::Value mData;
     416             :   MOZ_INIT_OUTSIDE_CTOR nsString mLastEventId;
     417             :   MOZ_INIT_OUTSIDE_CTOR nsString mOrigin;
     418             :   MOZ_INIT_OUTSIDE_CTOR Sequence<OwningNonNull<mozilla::dom::MessagePort>> mPorts;
     419             :   MOZ_INIT_OUTSIDE_CTOR Nullable<OwningWindowProxyOrMessagePortOrServiceWorker > mSource;
     420             : 
     421             :   MessageEventInit();
     422             : 
     423           0 :   explicit inline MessageEventInit(const FastDictionaryInitializer& )
     424           0 :     : EventInit(FastDictionaryInitializer()),
     425           0 :       mData(JS::UndefinedValue())
     426             :   {
     427             :     // Do nothing here; this is used by our "Fast" subclass
     428           0 :   }
     429             : 
     430             : private:
     431             :   MessageEventInit(const MessageEventInit&) = delete;
     432             :   MessageEventInit& operator=(const MessageEventInit&) = delete;
     433             : 
     434             :   static bool
     435             :   InitIds(JSContext* cx, MessageEventInitAtoms* atomsCache);
     436             : 
     437             : public:
     438             :   bool
     439             :   Init(JSContext* cx, JS::Handle<JS::Value> val, const char* sourceDescription = "Value", bool passedToJSImpl = false);
     440             : 
     441             :   bool
     442             :   ToObjectInternal(JSContext* cx, JS::MutableHandle<JS::Value> rval) const;
     443             : 
     444             :   void
     445             :   TraceDictionary(JSTracer* trc);
     446             : };
     447             : 
     448             : namespace binding_detail {
     449           0 : struct FastMessageEventInit : public MessageEventInit
     450             : {
     451           0 :   inline FastMessageEventInit()
     452           0 :     : MessageEventInit(FastDictionaryInitializer())
     453             :   {
     454             :     // Doesn't matter what int we pass to the parent constructor
     455           0 :   }
     456             : };
     457             : } // namespace binding_detail
     458             : 
     459             : 
     460             : namespace MessageEventBinding {
     461             : 
     462             :   typedef mozilla::dom::MessageEvent NativeType;
     463             : 
     464             :   JSObject*
     465             :   DefineDOMInterface(JSContext* aCx, JS::Handle<JSObject*> aGlobal, JS::Handle<jsid> id, bool aDefineOnGlobal);
     466             : 
     467             :   const JSClass*
     468             :   GetJSClass();
     469             : 
     470             :   bool
     471             :   Wrap(JSContext* aCx, mozilla::dom::MessageEvent* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector);
     472             : 
     473             :   template <class T>
     474           0 :   inline JSObject* Wrap(JSContext* aCx, T* aObject, JS::Handle<JSObject*> aGivenProto)
     475             :   {
     476           0 :     JS::Rooted<JSObject*> reflector(aCx);
     477           0 :     return Wrap(aCx, aObject, aObject, aGivenProto, &reflector) ? reflector.get() : nullptr;
     478             :   }
     479             : 
     480             :   // We declare this as an array so that retrieving a pointer to this
     481             :   // binding's property hooks only requires compile/link-time resolvable
     482             :   // address arithmetic.  Declaring it as a pointer instead would require
     483             :   // doing a run-time load to fetch a pointer to this binding's property
     484             :   // hooks.  And then structures which embedded a pointer to this structure
     485             :   // would require a run-time load for proper initialization, which would
     486             :   // then induce static constructors.  Lots of static constructors.
     487             :   extern const NativePropertyHooks sNativePropertyHooks[];
     488             : 
     489             :   void
     490             :   ClearCachedPortsValue(mozilla::dom::MessageEvent* aObject);
     491             : 
     492             :   void
     493             :   CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal);
     494             : 
     495             :   JS::Handle<JSObject*>
     496             :   GetProtoObjectHandle(JSContext* aCx);
     497             : 
     498             :   JS::Handle<JSObject*>
     499             :   GetConstructorObjectHandle(JSContext* aCx, bool aDefineOnGlobal = true);
     500             : 
     501             :   JSObject*
     502             :   GetConstructorObject(JSContext* aCx);
     503             : 
     504             : } // namespace MessageEventBinding
     505             : 
     506             : 
     507             : 
     508             : } // namespace dom
     509             : } // namespace mozilla
     510             : 
     511             : #endif // mozilla_dom_MessageEventBinding_h

Generated by: LCOV version 1.13