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

          Line data    Source code
       1             : /* THIS FILE IS AUTOGENERATED FROM FetchObserver.webidl BY Codegen.py - DO NOT EDIT */
       2             : 
       3             : #ifndef mozilla_dom_FetchObserverBinding_h
       4             : #define mozilla_dom_FetchObserverBinding_h
       5             : 
       6             : #include "js/RootingAPI.h"
       7             : #include "jspubtd.h"
       8             : #include "mozilla/ErrorResult.h"
       9             : #include "mozilla/dom/BindingDeclarations.h"
      10             : #include "mozilla/dom/CallbackInterface.h"
      11             : #include "mozilla/dom/Nullable.h"
      12             : #include "mozilla/dom/ToJSValue.h"
      13             : 
      14             : namespace mozilla {
      15             : namespace dom {
      16             : 
      17             : class FetchObserver;
      18             : struct FetchObserverAtoms;
      19             : struct NativePropertyHooks;
      20             : class ObserverCallback;
      21             : struct ObserverCallbackAtoms;
      22             : class ProtoAndIfaceCache;
      23             : 
      24             : } // namespace dom
      25             : } // namespace mozilla
      26             : 
      27             : namespace mozilla {
      28             : namespace dom {
      29             : 
      30             : enum class FetchState : uint8_t {
      31             :   Requesting,
      32             :   Responding,
      33             :   Aborted,
      34             :   Errored,
      35             :   Complete,
      36             :   EndGuard_
      37             : };
      38             : 
      39             : namespace FetchStateValues {
      40             : extern const EnumEntry strings[6];
      41             : } // namespace FetchStateValues
      42             : 
      43             : bool
      44             : ToJSValue(JSContext* aCx, FetchState aArgument, JS::MutableHandle<JS::Value> aValue);
      45             : 
      46             : 
      47             : namespace FetchObserverBinding {
      48             : 
      49             :   typedef mozilla::dom::FetchObserver NativeType;
      50             : 
      51             :   bool
      52             :   ConstructorEnabled(JSContext* aCx, JS::Handle<JSObject*> aObj);
      53             : 
      54             :   JSObject*
      55             :   DefineDOMInterface(JSContext* aCx, JS::Handle<JSObject*> aGlobal, JS::Handle<jsid> id, bool aDefineOnGlobal);
      56             : 
      57             :   const JSClass*
      58             :   GetJSClass();
      59             : 
      60             :   bool
      61             :   Wrap(JSContext* aCx, mozilla::dom::FetchObserver* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector);
      62             : 
      63             :   template <class T>
      64           0 :   inline JSObject* Wrap(JSContext* aCx, T* aObject, JS::Handle<JSObject*> aGivenProto)
      65             :   {
      66           0 :     JS::Rooted<JSObject*> reflector(aCx);
      67           0 :     return Wrap(aCx, aObject, aObject, aGivenProto, &reflector) ? reflector.get() : nullptr;
      68             :   }
      69             : 
      70             :   // We declare this as an array so that retrieving a pointer to this
      71             :   // binding's property hooks only requires compile/link-time resolvable
      72             :   // address arithmetic.  Declaring it as a pointer instead would require
      73             :   // doing a run-time load to fetch a pointer to this binding's property
      74             :   // hooks.  And then structures which embedded a pointer to this structure
      75             :   // would require a run-time load for proper initialization, which would
      76             :   // then induce static constructors.  Lots of static constructors.
      77             :   extern const NativePropertyHooks sNativePropertyHooks[];
      78             : 
      79             :   void
      80             :   CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal);
      81             : 
      82             :   JS::Handle<JSObject*>
      83             :   GetProtoObjectHandle(JSContext* aCx);
      84             : 
      85             :   JS::Handle<JSObject*>
      86             :   GetConstructorObjectHandle(JSContext* aCx, bool aDefineOnGlobal = true);
      87             : 
      88             :   JSObject*
      89             :   GetConstructorObject(JSContext* aCx);
      90             : 
      91             : } // namespace FetchObserverBinding
      92             : 
      93             : 
      94             : 
      95           0 : class ObserverCallback : public CallbackInterface
      96             : {
      97             : public:
      98           0 :   explicit inline ObserverCallback(JSContext* aCx, JS::Handle<JSObject*> aCallback, nsIGlobalObject* aIncumbentGlobal)
      99           0 :     : CallbackInterface(aCx, aCallback, aIncumbentGlobal)
     100             :   {
     101           0 :   }
     102             : 
     103             :   explicit inline ObserverCallback(JS::Handle<JSObject*> aCallback, const FastCallbackConstructor& )
     104             :     : CallbackInterface(aCallback, FastCallbackConstructor())
     105             :   {
     106             :   }
     107             : 
     108             :   explicit inline ObserverCallback(JS::Handle<JSObject*> aCallback, JS::Handle<JSObject*> aAsyncStack, nsIGlobalObject* aIncumbentGlobal)
     109             :     : CallbackInterface(aCallback, aAsyncStack, aIncumbentGlobal)
     110             :   {
     111             :   }
     112             : 
     113             :   template <typename T>
     114             :   inline void
     115             :   HandleEvent(const T& thisVal, FetchObserver& observer, ErrorResult& aRv, const char* aExecutionReason = nullptr, ExceptionHandling aExceptionHandling = eReportExceptions, JSCompartment* aCompartment = nullptr)
     116             :   {
     117             :     MOZ_ASSERT(!aRv.Failed(), "Don't pass an already-failed ErrorResult to a callback!");
     118             :     if (!aExecutionReason) {
     119             :       aExecutionReason = "ObserverCallback.handleEvent";
     120             :     }
     121             :     CallSetup s(this, aRv, aExecutionReason, aExceptionHandling, aCompartment);
     122             :     if (!s.GetContext()) {
     123             :       MOZ_ASSERT(aRv.Failed());
     124             :       return;
     125             :     }
     126             :     JS::Rooted<JS::Value> thisValJS(s.GetContext());
     127             :     if (!ToJSValue(s.GetContext(), thisVal, &thisValJS)) {
     128             :       aRv.Throw(NS_ERROR_FAILURE);
     129             :       return;
     130             :     }
     131             :     return HandleEvent(s.GetContext(), thisValJS, observer, aRv);
     132             :   }
     133             : 
     134             :   inline void
     135           0 :   HandleEvent(FetchObserver& observer, ErrorResult& aRv, const char* aExecutionReason = nullptr, ExceptionHandling aExceptionHandling = eReportExceptions, JSCompartment* aCompartment = nullptr)
     136             :   {
     137           0 :     MOZ_ASSERT(!aRv.Failed(), "Don't pass an already-failed ErrorResult to a callback!");
     138           0 :     if (!aExecutionReason) {
     139           0 :       aExecutionReason = "ObserverCallback.handleEvent";
     140             :     }
     141           0 :     CallSetup s(this, aRv, aExecutionReason, aExceptionHandling, aCompartment);
     142           0 :     if (!s.GetContext()) {
     143           0 :       MOZ_ASSERT(aRv.Failed());
     144           0 :       return;
     145             :     }
     146           0 :     return HandleEvent(s.GetContext(), JS::UndefinedHandleValue, observer, aRv);
     147             :   }
     148             : 
     149             :   template <typename T>
     150             :   inline void
     151             :   HandleEvent(const T& thisVal, FetchObserver& observer, const char* aExecutionReason = nullptr)
     152             :   {
     153             :     IgnoredErrorResult rv;
     154             :     return HandleEvent(thisVal, observer, rv, aExecutionReason);
     155             :   }
     156             : 
     157             :   inline void
     158           0 :   HandleEvent(FetchObserver& observer, const char* aExecutionReason = nullptr)
     159             :   {
     160           0 :     IgnoredErrorResult rv;
     161           0 :     return HandleEvent(observer, rv, aExecutionReason, eReportExceptions, nullptr);
     162             :   }
     163             : 
     164             :   inline bool
     165             :   operator==(const ObserverCallback& aOther) const
     166             :   {
     167             :     return CallbackInterface::operator==(aOther);
     168             :   }
     169             : 
     170             : private:
     171             :   void HandleEvent(JSContext* cx, JS::Handle<JS::Value> aThisVal, FetchObserver& observer, ErrorResult& aRv);
     172             : 
     173             :   static bool
     174             :   InitIds(JSContext* cx, ObserverCallbackAtoms* atomsCache);
     175             : };
     176             : 
     177             : 
     178             : namespace binding_detail {
     179             : class FastObserverCallback : public ObserverCallback
     180             : {
     181             : public:
     182             :   explicit inline FastObserverCallback(JS::Handle<JSObject*> aCallback)
     183             :     : ObserverCallback(aCallback, FastCallbackConstructor())
     184             :   {
     185             :   }
     186             : 
     187             :   inline void
     188             :   Trace(JSTracer* aTracer)
     189             :   {
     190             :     ObserverCallback::Trace(aTracer);
     191             :   }
     192             : 
     193             :   inline void
     194             :   FinishSlowJSInitIfMoreThanOneOwner(JSContext* aCx)
     195             :   {
     196             :     ObserverCallback::FinishSlowJSInitIfMoreThanOneOwner(aCx);
     197             :   }
     198             : };
     199             : } // namespace binding_detail
     200             : 
     201             : 
     202             : } // namespace dom
     203             : } // namespace mozilla
     204             : 
     205             : #endif // mozilla_dom_FetchObserverBinding_h

Generated by: LCOV version 1.13