LCOV - code coverage report
Current view: top level - obj-x86_64-pc-linux-gnu/dist/include/mozilla/dom - MutationObserverBinding.h (source / functions) Hit Total Coverage
Test: output.info Lines: 21 46 45.7 %
Date: 2017-07-14 16:53:18 Functions: 8 17 47.1 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* THIS FILE IS AUTOGENERATED FROM MutationObserver.webidl BY Codegen.py - DO NOT EDIT */
       2             : 
       3             : #ifndef mozilla_dom_MutationObserverBinding_h
       4             : #define mozilla_dom_MutationObserverBinding_h
       5             : 
       6             : #include "MutationObserverBinding.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/CallbackFunction.h"
      12             : #include "mozilla/dom/Nullable.h"
      13             : #include "mozilla/dom/ToJSValue.h"
      14             : #include "nsINode.h"
      15             : 
      16             : class nsDOMMutationObserver;
      17             : struct nsDOMMutationObserverAtoms;
      18             : class nsDOMMutationRecord;
      19             : struct nsDOMMutationRecordAtoms;
      20             : class nsINode;
      21             : 
      22             : namespace mozilla {
      23             : namespace dom {
      24             : 
      25             : class MutationCallback;
      26             : struct MutationObserverInitAtoms;
      27             : struct MutationObservingInfoAtoms;
      28             : struct NativePropertyHooks;
      29             : class ProtoAndIfaceCache;
      30             : 
      31             : } // namespace dom
      32             : } // namespace mozilla
      33             : 
      34             : namespace mozilla {
      35             : namespace dom {
      36             : 
      37           1 : struct MutationObserverInit : public DictionaryBase
      38             : {
      39             :   MOZ_INIT_OUTSIDE_CTOR bool mAnimations;
      40             :   MOZ_INIT_OUTSIDE_CTOR Optional<Sequence<nsString>> mAttributeFilter;
      41             :   MOZ_INIT_OUTSIDE_CTOR Optional<bool> mAttributeOldValue;
      42             :   MOZ_INIT_OUTSIDE_CTOR Optional<bool> mAttributes;
      43             :   MOZ_INIT_OUTSIDE_CTOR Optional<bool> mCharacterData;
      44             :   MOZ_INIT_OUTSIDE_CTOR Optional<bool> mCharacterDataOldValue;
      45             :   MOZ_INIT_OUTSIDE_CTOR bool mChildList;
      46             :   MOZ_INIT_OUTSIDE_CTOR bool mNativeAnonymousChildList;
      47             :   MOZ_INIT_OUTSIDE_CTOR bool mSubtree;
      48             : 
      49             :   MutationObserverInit();
      50             : 
      51           1 :   explicit inline MutationObserverInit(const FastDictionaryInitializer& )
      52           1 :   {
      53             :     // Do nothing here; this is used by our "Fast" subclass
      54           1 :   }
      55             : 
      56             :   explicit inline MutationObserverInit(const MutationObserverInit& aOther)
      57             :   {
      58             :     *this = aOther;
      59             :   }
      60             : 
      61             :   bool
      62             :   Init(JSContext* cx, JS::Handle<JS::Value> val, const char* sourceDescription = "Value", bool passedToJSImpl = false);
      63             : 
      64             :   bool
      65             :   Init(const nsAString& aJSON);
      66             : 
      67             :   bool
      68             :   ToObjectInternal(JSContext* cx, JS::MutableHandle<JS::Value> rval) const;
      69             : 
      70             :   bool
      71             :   ToJSON(nsAString& aJSON) const;
      72             : 
      73             :   void
      74             :   TraceDictionary(JSTracer* trc);
      75             : 
      76             :   MutationObserverInit&
      77             :   operator=(const MutationObserverInit& aOther);
      78             : 
      79             : private:
      80             :   static bool
      81             :   InitIds(JSContext* cx, MutationObserverInitAtoms* atomsCache);
      82             : };
      83             : 
      84             : namespace binding_detail {
      85           1 : struct FastMutationObserverInit : public MutationObserverInit
      86             : {
      87           1 :   inline FastMutationObserverInit()
      88           1 :     : MutationObserverInit(FastDictionaryInitializer())
      89             :   {
      90             :     // Doesn't matter what int we pass to the parent constructor
      91           1 :   }
      92             : };
      93             : } // namespace binding_detail
      94             : 
      95             : 
      96           0 : struct MutationObservingInfo : public MutationObserverInit
      97             : {
      98             :   MOZ_INIT_OUTSIDE_CTOR RefPtr<nsINode> mObservedNode;
      99             : 
     100             :   MutationObservingInfo();
     101             : 
     102             :   explicit inline MutationObservingInfo(const FastDictionaryInitializer& )
     103             :     : MutationObserverInit(FastDictionaryInitializer())
     104             :   {
     105             :     // Do nothing here; this is used by our "Fast" subclass
     106             :   }
     107             : 
     108             :   explicit inline MutationObservingInfo(const MutationObservingInfo& aOther)
     109             :   {
     110             :     *this = aOther;
     111             :   }
     112             : 
     113             :   bool
     114             :   Init(JSContext* cx, JS::Handle<JS::Value> val, const char* sourceDescription = "Value", bool passedToJSImpl = false);
     115             : 
     116             :   bool
     117             :   ToObjectInternal(JSContext* cx, JS::MutableHandle<JS::Value> rval) const;
     118             : 
     119             :   void
     120             :   TraceDictionary(JSTracer* trc);
     121             : 
     122             :   MutationObservingInfo&
     123             :   operator=(const MutationObservingInfo& aOther);
     124             : 
     125             : private:
     126             :   static bool
     127             :   InitIds(JSContext* cx, MutationObservingInfoAtoms* atomsCache);
     128             : };
     129             : 
     130             : namespace binding_detail {
     131             : struct FastMutationObservingInfo : public MutationObservingInfo
     132             : {
     133             :   inline FastMutationObservingInfo()
     134             :     : MutationObservingInfo(FastDictionaryInitializer())
     135             :   {
     136             :     // Doesn't matter what int we pass to the parent constructor
     137             :   }
     138             : };
     139             : } // namespace binding_detail
     140             : 
     141             : 
     142           0 : class MutationCallback : public CallbackFunction
     143             : {
     144             : public:
     145             :   explicit inline MutationCallback(JSContext* aCx, JS::Handle<JSObject*> aCallback, nsIGlobalObject* aIncumbentGlobal)
     146             :     : CallbackFunction(aCx, aCallback, aIncumbentGlobal)
     147             :   {
     148             :     MOZ_ASSERT(JS::IsCallable(mCallback));
     149             :   }
     150             : 
     151           1 :   explicit inline MutationCallback(JS::Handle<JSObject*> aCallback, const FastCallbackConstructor& )
     152           1 :     : CallbackFunction(aCallback, FastCallbackConstructor())
     153             :   {
     154           1 :     MOZ_ASSERT(JS::IsCallable(mCallback));
     155           1 :   }
     156             : 
     157             :   explicit inline MutationCallback(JS::Handle<JSObject*> aCallback, JS::Handle<JSObject*> aAsyncStack, nsIGlobalObject* aIncumbentGlobal)
     158             :     : CallbackFunction(aCallback, aAsyncStack, aIncumbentGlobal)
     159             :   {
     160             :     MOZ_ASSERT(JS::IsCallable(mCallback));
     161             :   }
     162             : 
     163             :   explicit inline MutationCallback(CallbackFunction* aOther)
     164             :     : CallbackFunction(aOther)
     165             :   {
     166             :   }
     167             : 
     168             :   template <typename T>
     169             :   inline void
     170           0 :   Call(const T& thisVal, const Sequence<OwningNonNull<nsDOMMutationRecord>>& mutations, nsDOMMutationObserver& observer, ErrorResult& aRv, const char* aExecutionReason = nullptr, ExceptionHandling aExceptionHandling = eReportExceptions, JSCompartment* aCompartment = nullptr)
     171             :   {
     172           0 :     MOZ_ASSERT(!aRv.Failed(), "Don't pass an already-failed ErrorResult to a callback!");
     173           0 :     if (!aExecutionReason) {
     174           0 :       aExecutionReason = "MutationCallback";
     175             :     }
     176           0 :     CallSetup s(this, aRv, aExecutionReason, aExceptionHandling, aCompartment);
     177           0 :     if (!s.GetContext()) {
     178           0 :       MOZ_ASSERT(aRv.Failed());
     179           0 :       return;
     180             :     }
     181           0 :     JS::Rooted<JS::Value> thisValJS(s.GetContext());
     182           0 :     if (!ToJSValue(s.GetContext(), thisVal, &thisValJS)) {
     183           0 :       aRv.Throw(NS_ERROR_FAILURE);
     184           0 :       return;
     185             :     }
     186           0 :     return Call(s.GetContext(), thisValJS, mutations, observer, aRv);
     187             :   }
     188             : 
     189             :   inline void
     190             :   Call(const Sequence<OwningNonNull<nsDOMMutationRecord>>& mutations, nsDOMMutationObserver& observer, ErrorResult& aRv, const char* aExecutionReason = nullptr, ExceptionHandling aExceptionHandling = eReportExceptions, JSCompartment* aCompartment = nullptr)
     191             :   {
     192             :     MOZ_ASSERT(!aRv.Failed(), "Don't pass an already-failed ErrorResult to a callback!");
     193             :     if (!aExecutionReason) {
     194             :       aExecutionReason = "MutationCallback";
     195             :     }
     196             :     CallSetup s(this, aRv, aExecutionReason, aExceptionHandling, aCompartment);
     197             :     if (!s.GetContext()) {
     198             :       MOZ_ASSERT(aRv.Failed());
     199             :       return;
     200             :     }
     201             :     return Call(s.GetContext(), JS::UndefinedHandleValue, mutations, observer, aRv);
     202             :   }
     203             : 
     204             :   template <typename T>
     205             :   inline void
     206           0 :   Call(const T& thisVal, const Sequence<OwningNonNull<nsDOMMutationRecord>>& mutations, nsDOMMutationObserver& observer, const char* aExecutionReason = nullptr)
     207             :   {
     208           0 :     IgnoredErrorResult rv;
     209           0 :     return Call(thisVal, mutations, observer, rv, aExecutionReason);
     210             :   }
     211             : 
     212             :   inline void
     213             :   Call(const Sequence<OwningNonNull<nsDOMMutationRecord>>& mutations, nsDOMMutationObserver& observer, const char* aExecutionReason = nullptr)
     214             :   {
     215             :     IgnoredErrorResult rv;
     216             :     return Call(mutations, observer, rv, aExecutionReason, eReportExceptions, nullptr);
     217             :   }
     218             : 
     219             :   inline bool
     220             :   operator==(const MutationCallback& aOther) const
     221             :   {
     222             :     return CallbackFunction::operator==(aOther);
     223             :   }
     224             : 
     225             : private:
     226             :   void Call(JSContext* cx, JS::Handle<JS::Value> aThisVal, const Sequence<OwningNonNull<nsDOMMutationRecord>>& mutations, nsDOMMutationObserver& observer, ErrorResult& aRv);
     227             : };
     228             : 
     229             : 
     230             : namespace binding_detail {
     231           0 : class FastMutationCallback : public MutationCallback
     232             : {
     233             : public:
     234           1 :   explicit inline FastMutationCallback(JS::Handle<JSObject*> aCallback)
     235           1 :     : MutationCallback(aCallback, FastCallbackConstructor())
     236             :   {
     237           1 :   }
     238             : 
     239             :   inline void
     240           0 :   Trace(JSTracer* aTracer)
     241             :   {
     242           0 :     MutationCallback::Trace(aTracer);
     243           0 :   }
     244             : 
     245             :   inline void
     246           1 :   FinishSlowJSInitIfMoreThanOneOwner(JSContext* aCx)
     247             :   {
     248           1 :     MutationCallback::FinishSlowJSInitIfMoreThanOneOwner(aCx);
     249           1 :   }
     250             : };
     251             : } // namespace binding_detail
     252             : 
     253             : 
     254             : namespace MutationObserverBinding {
     255             : 
     256             :   typedef nsDOMMutationObserver NativeType;
     257             : 
     258             :   JSObject*
     259             :   DefineDOMInterface(JSContext* aCx, JS::Handle<JSObject*> aGlobal, JS::Handle<jsid> id, bool aDefineOnGlobal);
     260             : 
     261             :   const JSClass*
     262             :   GetJSClass();
     263             : 
     264             :   bool
     265             :   Wrap(JSContext* aCx, nsDOMMutationObserver* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector);
     266             : 
     267             :   template <class T>
     268           1 :   inline JSObject* Wrap(JSContext* aCx, T* aObject, JS::Handle<JSObject*> aGivenProto)
     269             :   {
     270           2 :     JS::Rooted<JSObject*> reflector(aCx);
     271           2 :     return Wrap(aCx, aObject, aObject, aGivenProto, &reflector) ? reflector.get() : nullptr;
     272             :   }
     273             : 
     274             :   // We declare this as an array so that retrieving a pointer to this
     275             :   // binding's property hooks only requires compile/link-time resolvable
     276             :   // address arithmetic.  Declaring it as a pointer instead would require
     277             :   // doing a run-time load to fetch a pointer to this binding's property
     278             :   // hooks.  And then structures which embedded a pointer to this structure
     279             :   // would require a run-time load for proper initialization, which would
     280             :   // then induce static constructors.  Lots of static constructors.
     281             :   extern const NativePropertyHooks sNativePropertyHooks[];
     282             : 
     283             :   void
     284             :   CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal);
     285             : 
     286             :   JS::Handle<JSObject*>
     287             :   GetProtoObjectHandle(JSContext* aCx);
     288             : 
     289             :   JS::Handle<JSObject*>
     290             :   GetConstructorObjectHandle(JSContext* aCx, bool aDefineOnGlobal = true);
     291             : 
     292             :   JSObject*
     293             :   GetConstructorObject(JSContext* aCx);
     294             : 
     295             : } // namespace MutationObserverBinding
     296             : 
     297             : 
     298             : 
     299             : namespace MutationRecordBinding {
     300             : 
     301             :   typedef nsDOMMutationRecord NativeType;
     302             : 
     303             :   JSObject*
     304             :   DefineDOMInterface(JSContext* aCx, JS::Handle<JSObject*> aGlobal, JS::Handle<jsid> id, bool aDefineOnGlobal);
     305             : 
     306             :   const JSClass*
     307             :   GetJSClass();
     308             : 
     309             :   bool
     310             :   Wrap(JSContext* aCx, nsDOMMutationRecord* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector);
     311             : 
     312             :   template <class T>
     313           0 :   inline JSObject* Wrap(JSContext* aCx, T* aObject, JS::Handle<JSObject*> aGivenProto)
     314             :   {
     315           0 :     JS::Rooted<JSObject*> reflector(aCx);
     316           0 :     return Wrap(aCx, aObject, aObject, aGivenProto, &reflector) ? reflector.get() : nullptr;
     317             :   }
     318             : 
     319             :   // We declare this as an array so that retrieving a pointer to this
     320             :   // binding's property hooks only requires compile/link-time resolvable
     321             :   // address arithmetic.  Declaring it as a pointer instead would require
     322             :   // doing a run-time load to fetch a pointer to this binding's property
     323             :   // hooks.  And then structures which embedded a pointer to this structure
     324             :   // would require a run-time load for proper initialization, which would
     325             :   // then induce static constructors.  Lots of static constructors.
     326             :   extern const NativePropertyHooks sNativePropertyHooks[];
     327             : 
     328             :   void
     329             :   CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal);
     330             : 
     331             :   JS::Handle<JSObject*>
     332             :   GetProtoObjectHandle(JSContext* aCx);
     333             : 
     334             :   JS::Handle<JSObject*>
     335             :   GetConstructorObjectHandle(JSContext* aCx, bool aDefineOnGlobal = true);
     336             : 
     337             :   JSObject*
     338             :   GetConstructorObject(JSContext* aCx);
     339             : 
     340             : } // namespace MutationRecordBinding
     341             : 
     342             : 
     343             : 
     344             : } // namespace dom
     345             : } // namespace mozilla
     346             : 
     347             : #endif // mozilla_dom_MutationObserverBinding_h

Generated by: LCOV version 1.13